Department Logo Information Services and Technology

OpenMPI 1.2.8 for Linux Users

Using OpenMPI

In order to use OpenMPI, the executables must be in your path. To place the executables in your path use the modules command:

module load openmpi/1.2.8

To determine if the openmpi module is loaded issue the following command:

module list

The output will be as follows:

Currently Loaded Modulefiles:

1) openmpi/1.2.8

In addition to putting the executable in your path, the "module" command also makes the manpages available. Loaded modules carry over from one login to the next. Although it doesn't hurt anything, it is unnecessary to load the openmpi module on each login. OpenMPI can be used to compile Fortran 77, Fortran 90, C, or C++ code. See the following table for the correct command to use.

Language OpenMPI Compile Command
Fortran 77   mpif77
Fortran 90   mpif90
C mpicc
   C++   mpic++

For example, to compile Fortran 77 code:

mpif77 -o [output_filename] code_filename.F

To run the compiled program use mpirun:

mpirun -n [number of processors] filename

Sample Programs

Sample programs are available in the following directory:


These programs compute pi by integrating the following function from 0 to 1

f(x) = 4/(1 + x**2)

To use these programs copy them to your home directory. You can then compile, study, and/or edit the code.