Open MPI is a Message Passing Interface (MPI) library project combining technologies and resources from several other projects. MPI protocol has been generously used in high-performance computing, especially for parallel computation. This post is going to install OpenMPI on Linux distribution.
For this writing, I install OpenMPI 3.1.3 on CentOS cluster step-by-step. The procedure also works well with the newer or lower version. Official website: https://www.open-mpi.org/software. On this day, the latest version of OpenMPI is 4.0.0.
Use wget or curl tool to download the tarball source from its official website to your Linux
wget
wget https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.3.tar.gz
curl
curl -O https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.3.tar.gz
1. Install gcc compiler using command (skip this step if you have already installed gcc)
yum groupinstall "Development tools"
2. Uncompress the tarball
tar -xzvf openmpi-3.1.3.tar.gz
3. Navigate to OpenMPI folder and setting up compilation configuration for install
cd openmpi-3.1.3
./configure --prefix=/usr/local/
If you want to install other versions, you should define the --prefix to the specific directory, e.g.,
./configure --prefix=/usr/local/openmpi-3.1.3/
3. Install OpenMPI using make command
sudo make all install
After make install is completed, mpirun or orterun executable should be at /usr/local/bin/.
4. Set environment variables for OpenMPI using commands
echo "export PATH=$PATH:/usr/local/bin" >> $HOME/.bashrc
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib" >> $HOME/.bashrc
Otherwise, put the following command into /etc/bashrc (only root/sudo can do), or into $HOME/.bashrc (for user)
export PATH=$PATH:/usr/local/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
5. Activate resource file
source $HOME/.bashrc
6. Check version of OpenMPI using command
mpirun --version
Procedure is quite similar to installation with root/sudo.
1. Change directory to OpenMPI
cd openmpi-3.1.3
2. Set up configuration.
./configure --prefix="/$HOME/openmpi-3.1.3-local"
3. Compile OpenMPI
make
make install
4. Put the following commands into $HOME/.bashrc
export PATH="$PATH:/$HOME/openmpi-3.1.3-local/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/$HOME/openmpi-3.1.3-local/lib/"
5. Activate .bashrc file.
source /$HOME/.bashrc
If it fails, you can try the following command for setting up configuration and recompile.
./configure --prefix=/usr/local/openmpi-3.1.3 CC=icc CXX=icpc F77=ifort FC=ifort --with-devel-headers --enable-binaries
Rangsiman Ketkaew