Basic Code Compilation
Serial Code
Codeblock |
---|
language | bash |
---|
title | Intel compiler |
---|
collapse | true |
---|
|
module load intel
icc -o hello.bin hello.c
ifort -o hello.bin hello.f90
icpc -o hello.bin hello.cpp |
Codeblock |
---|
language | bash |
---|
title | GNU Compiler |
---|
collapse | true |
---|
|
module load gcc
gcc -o hello.bin hello.c
gfortran -o hello.bin hello.f90
g++ -o hello.bin hello.cpp |
Parallel Code with MPI
Examples are for Intel MPI with Intel and GNU compilers, respectively. We recommend using the specific compiler wrappers as follows.
Codeblock |
---|
language | bash |
---|
title | Intel Compiler |
---|
collapse | true |
---|
|
module load intel
module load impi
mpiicc -Wl,-rpath,$LD_RUN_PATH -o hello.bin hello.c
mpiifort -Wl,-rpath,$LD_RUN_PATH -o hello.bin hello.f90
mpiicpc -Wl,-rpath,$LD_RUN_PATH -o hello.bin hello.cpp |
Codeblock |
---|
language | bash |
---|
title | GNU Compiler |
---|
collapse | true |
---|
|
module load gcc
module load impi
mpigcc -Wl,-rpath,$LD_RUN_PATH -o hello.bin hello.c
mpif90 -Wl,-rpath,$LD_RUN_PATH -o hello.bin hello.f90
mpigxx -Wl,-rpath,$LD_RUN_PATH -o hello.bin hello.cpp |
Parallel Code with OpenMP
The syntax of Intel and GNU options differs slightly.
Codeblock |
---|
language | bash |
---|
title | Intel Compiler |
---|
collapse | true |
---|
|
module load intel
icc -qopenmp -o hello.bin hello.c
ifort -qopenmp -o hello.bin hello.f90
icpc -qopenmp -o hello.bin hello.cpp |
Codeblock |
---|
language | bash |
---|
title | GNU Compiler |
---|
collapse | true |
---|
|
module load gcc
gcc -fopenmp -o hello.bin hello.c
gfortran -fopenmp -o hello.bin hello.f90
g++ -fopenmp -o hello.bin hello.cpp |
Hybrid Code with MPI and OpenMP
Codeblock |
---|
language | bash |
---|
title | Intel Compiler |
---|
collapse | true |
---|
|
module load intel
module load impi
mpiicc -qopenmp -Wl,-rpath,$LD_RUN_PATH -o hello.bin hello.c
mpiifort -qopenmp -Wl,-rpath,$LD_RUN_PATH -o hello.bin hello.f90
mpiicpc -qopenmp -Wl,-rpath,$LD_RUN_PATH -o hello.bin hello.cpp |
Codeblock |
---|
language | bash |
---|
title | GNU Compiler |
---|
collapse | true |
---|
|
module load gcc
module load impi
mpigcc -fopenmp -Wl,-rpath,$LD_RUN_PATH -o hello.bin hello.c
mpif90 -fopenmp -Wl,-rpath,$LD_RUN_PATH -o hello.bin hello.f90
mpigxx -fopenmp -Wl,-rpath,$LD_RUN_PATH -o hello.bin hello.cpp |
MPI, communication libraries, OpenMP
We provide several communication libraries:
As Intel MPI is the communication library recommended by the system vendor, currently only documentation for Intel MPI is provided, except for application specific documentation.
OpenMP support ist built in with the compilers from Intel and GNU.
Important compiler flags
To make full use of the vectorizing capabilities of the CPUs, AVX512 instructions and the 512bit ZMM registers can be used with the following compile flags with the Intel compilers:
Kein Format |
---|
-xCORE-AVX512 -qopt-zmm-usage=high |
However, high ZMM usage is not recommended in all cases (read moreImage Removed).
With GNU compilers (GCC 7.x and later), architecture-specific optimization for Skylake and Cascade Lake CPUs is enabled with
Kein Format |
---|
-march=skylake-avx512 |
Using the Intel MKL
The Intel® Math Kernel Library (Intel® MKL) is designed to run on multiple processors and operating systems. It is also compatible with several compilers and third party libraries, and provides different interfaces to the functionality. To support these different environments, tools, and interfaces Intel MKL provides multiple libraries from which to choose.
Check out the link below to see what libraries are recommended for a particular use case. https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/Image RemovedPlease read the page Workflow compiler how to compile
- serial code or
- OpenMP parallel code
- with the Intel compiler or the Gnu compiler.
Please read the page Workflow Intel MPI how to compile
- MPI parallel code or
- MPI, OpenMP parallel code
- with the Intel compiler or the Gnu compiler.