Compiling MPI Code

OPTIMUM has installed both MPICH and OpenMPI utilities for different version combination of MPI package and GCC suite. You can:

  • list available module names with module avail MPICH or module avail OpenMPI
  • and choose what you need using module load module_name command.

I addition to GCC based installation, PGIcompiler suite includes also integrated OpenMPI utilities and libraries. Check versions using module avail PGI and load using module load module_name (always load the most recent one when compiling).

Note. If you are using FOTRAN, make sure that you use Fortran compiler version consistent across your code and supporting libraries.

Running MPI Jobs

Here is the minimum syntax for running MPI jobs:

  1. MPICH
    1. mpiexec.hydra executable args ...
    2. depending on the application it might be beneficial to add mpiexec's option -bind-to core
  2. OpenMPI
    1. mpiexec -hostfile $(openmpi_nodefile) -np N executable args .. where N is number of processors/workers in MPI pool (e.g. $PBS_NP)
    2. depending on the application it might be beneficial to add mpiexec's option -bind-to-core or --bind-to core, depending on OpenMPI version

For either MPICH or OpenMPI, in simple cases where you just want to start MPI executable, you can use Bqsub to directly submit executable to the queue without the need to write your own script. Check help for Bqsub.