Compiling your Code


The following compiler suites are installed on Guillimin, and are currently supported by us and corresponding vendors:

Compiling a serial code

We recommend to start with Intel compilers, unless another compiler family is required by your code due to specific reasons. Intel compiler suite includes ifort (Fortran-90), icc (C), and icpc (C++) compilers. The whole family of Intel compilers can be "loaded" to your environment using the following command:

user@guillimin$ module add ifort_icc

Then you compile your Fortran code with the following command (For C and C++ compilers use icc and icpc compiler names respectively):

user@guillimin$ ifort -O3 yourcode.F -o <your_binary_name>

The optimization of the third level (-O3) is quite aggressive and for some programs it may lead to significant slowing down (or even hanging) of compilation process, as well as reducing of performance of the binary code. If this is the case for your program, a lower-level optimization (-O2) should be used. We advise you to start with -O3, and then go to -O2 in case you find problems.

If you are compiling and linking several program files into one binary (which is usually the case when using Makefile), the "-ipo" optimization option is also advised. It performs inter-procedural optimizations between parts of your code, saved in different files.

Compiling a parallel code

For the codes, parallelized with OpenMP, the compilation procedure is the same as for the serial codes, except for the additional "-openmp"  option should be added to compiler flags.

For compilation of MPI-parallelized program you need to load an MPI module, corresponding to the compiler that you use. The compiler module itself should also be loaded. We currently support MVAPICH and OpenMPI packages, built with all 3 supported compiler suits. You can see all these packages among available software modules by issuing "module avail" command.

Let's assume, for example, that you would like to build your MPI program using Intel compiler and MVAPICH package. First, you load software modules for compiler suite and MPI package:

user@guillimin$ module add ifort_icc mvapich2-intel

Any MPI module provides you with wrappers (mpif90, mpicc, mpicxx), which automatically link your code with all necessary MPI librararies. You compile your MPI code with the following command:

user@guillimin$ mpif90 -O3 yourcode.F -o <your_binary_name>