NERSCPowering Scientific Discovery Since 1974

Compiling Codes


Open Mpi is the the only MPI library available on Euclid.  This implementation of MPI-2 is described at Open MPI: Open Source High Performance Computing.

The default compiler suite is from the Portland Group which is loaded by default at login, along with the PGI compiled Open MPI environment.

% module list
Currently Loaded Modulefiles:
  1) pgi/10.8        2) openmpi/1.4.2


Basic Example

Open MPI provides a convenient set of wrapper commands which you should use in all cases for compiling and linking parallel programs. Using the wrappers will automatically provide the necessary MPI include files and libraries.

  • For Fortran source code use mpif90:
% mpif90  -o example.x example.f90
  • For C source code use mpicc:
% mpicc -o example.x example.c
  • For C++ source code use mpiCC:
% mpiCC -o example.x example.C


PGI Compilers (C/C++/Fortran)

See PGI compiler for information about this compiler.


GNU Compilers (C/C++/Fortran)

GNU compilers (gfortran, gcc, and g++) are available in the "standard" location as part of the base operating system installation.

If you want to use the GNU instead of the PGI compilers with MPI you must switch the compiler and openmpi modules:

% module unload pgi
% module swap openmpi openmpi-gnu
and then recompile with the mpi... wrapper flags as shown above.
See GNU compiler for more information about this compiler.