Compilation

INTEL compilers

Sequential code

  • To load INTEL compilers : ifort, icc, icpc, ...:
$ module load intel/19.0.3/gcc-4.8.5
  • After loading, you can use INTEL compilers:
$ ifort program.f90
$ icc program.c
$ icpc program.C

Compiling an OpenMP parallel code

Compiling a fortran OpenMP parallel code:

$ ifort -qopenmp -o prog_omp_exe prog_omp.f

Compiling a C OpenMP code:

$ icc -qopenmp -o prog_omp_exe prog_omp.c

Compiling a C++ OpenMP code:

$ icpc -qopenmp -o prog_omp_exe prog_omp.cc

MPI parallel code

  • To load INTEL MPI wrappers : mpiifort, mpiicc, mpiicpc, ...:
$ module load intel/19.0.3/gcc-4.8.5
$ module load intel-mpi/2019.3.199/intel-19.0.3.199
  • Using the INTEL MPI wrappers:
$ mpiifort program.f90
$ mpiicc program.c
$ mpiicpc program.C
  • To load libraries (for example HF5) with module:
# Loading of INTEL MPI wrappers 
$ module load intel/19.0.3/gcc-4.8.5
$ module load intel-mpi/2019.3.199/intel-19.0.3.199

# Loading of HDF5 libraries
$ module load hdf5/1.10.6/intel-19.0.3.199-intel-mpi
  • After loading libraries, you need to define libraries (for example HDF5) at compile or link phases without include PATH or libraries PATH:
# Compilation
$ mpiifort -c program.f90

# Linking with HDF5 libraries
$ mpiifort -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 program.o 
  • Remarks:
    • During the compilation phase, don't add the include PATH (-I, ..) of headers .h or Fortran module .mod
    • During the link phase, don't add the libraries PATH (-L, -Wl,-rpath, ...) of libraries *.a, *.so, ...