Uppsala Multidisciplinary Center for Advanced Computational Science

How can I compile MPI programs on UPPMAX?

The module system and wrappers to the compilers make it relatively easy:

First load the module of the compiler you wish to use, most probably the intel or the pgi compilers, with the intel or pgi module:

module load intel/12.0
module load pgi/2011

On all UPPMAX systems the default MPI implementation is OpenMPI. To use this you must load the openmpi module:

module load openmpi/1.5.0

To compile mpi code when the modules are loaded, a number of wrapper scripts are available. So to compile C code use the mpicc command for parallel code instead of pgcc (or icc) for serial code. For C++ use the mpiCC command. For fortran77 the mpif77 command is used and for fortran90/95 the mpif90 command. The wrappers know all about where include files and libraries are located, so one should not need to either copy include files or give any extra arguments about which MPI libraries to link to.

mpicc  ...
mpif77 ...
mpiCC ...
mpif90 ...

For more information see the MPI and OpenMP user guide.