Main navigation

Open MPI

OpenMPI is an open source MPI-2 implementation that is developed and maintained by a consortium of academic, research, and industry partners.

How to load OpenMPI in your environment

OpenMPI is loaded into the user environment upon loading its module file:

module load openmpi/1.4

How to compile with OpenMPI

Once OpenMPI is loaded into your environment, use the following commands to compile program source files:

Commands Source types
mpif77 Fortran 77
mpif90 Fortran 90/95
mpicc C
mpicxx C++

Use the --showme option to display the underlying compiler options. For example, mpicc --showme.

How to run batch jobs with OpenMPI

To use the job script generator, enter the command

openmpi.q

and answer all the interactive questions. You can also write your own job script. In that case, make sure to include the following lines before the mpiexeccommand:

source /u/local/Modules/default/init/modules.sh
module load intel/11.1
module load openmpi/1.4

If your job script is written in csh, replace modules.sh with module.csh above.

How to build OpenMPI under my home directory

Sometimes you may need to use a particular OpenMPI version that is not installed on Hoffman2. The following instructions can install OpenMPI under your home directory, $HOME.

Step 1. Download OpenMPI from http://www.open-mpi.org/software/ompi

Step 2. Configure and install to $HOME/openmpi (you can certainly use a different path):

tar xvfz openmpi-XXX.tar.gz
cd openmpi-XXX
configure --prefix=$HOME/openmpi --with-sge --with-openib=/usr CC=icc CXX=icpc F77=ifort FC=ifort
make
make install

Once done, add the following lines to the bottom of your ~/.bashrc file:

export PATH=$HOME/openmpi:$PATH
export LD_LIBRARY_PATH=$HOME/openmpi:$LD_LIBRARY_PATH

Log out and log in again. Now you can use the OpenMPI compiler commands (mpicc etc. mentioned above) of the version you just built. At this point, when you enter the command

which mpicc

You should see something similar to:

/your/home/directory/openmpi/bin/mpicc

 

Last updated April, 2014.

Report Typos and Errors
UCLA OIT

© 2016 UC REGENTS TERMS OF USE & PRIVACY POLICY