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:
The output will be as follows:
Currently Loaded Modulefiles:
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|
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 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.