Install OpenMPI in Linux
Install OpenMPI in Linux
OpenMPI
By:
Daniel Guerrero Martnez
Sergio Rodrguez Lumley
1
Index of content
Installation of OpenMPI.......................................................................................................................3
Quick install for Ubuntu (Debian, Linux/Unix)..............................................................................3
Manual install for any linux distribution.........................................................................................4
Some common errors.......................................................................................................................5
2
Installation of OpenMPI
Open MPI is an open source MPI-2 implementation that is developed and maintained by a
consortium of academic, research, and industry partners. Open MPI is therefore able to combine the
expertise, technologies, and resources from all across the High Performance Computing community
in order to build the best MPI library available.
You can download the last version from it's official page:
http://www.open-mpi.org/
Prerequisites:
It is necessary to have installed a C/C++ compiler before installing OpenMPI. Installing this
on Ubuntu by package manager will automatically resolve this problem.
It is necessary to have the make utility for manual installation.
Quick command:
sudo apt-get install openmpi-bin openmpi-common openssh-client openssh-server libopenmpi1.3
libopenmpi-dbg libopenmpi-dev
Please note that if you are using Ubuntu, it will automatically install a C/C++ compiler, and it will
check for compatibilities and installed components.
3
Manual install for any linux distribution
Start downloading the last version of OpenMPI from it's official page:
http://www.open-mpi.org/software/ompi
Here you'll be able to downlad a version on tar.gz, tar.bz2 or on rpm. If your system supports rpm
this is the package you should download, if this is the case, you'll only have to install it without any
of the following steps (usually double-clicking).
If your system does not support rmp, follow the next steps:
cd openmpi-*
3. Configure the installation file (making use of the superuser privileges of your system) and
start preparing a cup of coffee, because this task usually takes between 5 and 10
minutes.
It is necessary to add on the prefix the installation directory we want to use for OpenMPI.
The normal thing to do would be to select the next directory /home/<user>/.openmpi.
./configure --prefix="/home/$USER/.openmpi"
4. Now is the time for the hard work, install it. For it, we'll make use of the make tool. This
is a good moment for the coffee, this should take between 10 and 15 minutes, so let it
work.
make
sudo make install
5. All that is left to do is to include the path to our path environment the path
installation_directory/bin and to the library environment variable
installation_directory/lib/. If your system uses bash you'll have to use the command
export.
export PATH="$PATH:/home/$USER/.openmpi/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/$USER/.openmpi/lib/"
1. If you want the exportation to be effective for the next sessions and terminals, you'll
have to write the exports in the environment variable's file. By default it should be
/home/<user>/.bashrc for bash users.
4
If everything went Ok, when you run the command mpirun it'll show the how to use message, the
same for mpicc.
When I run the command MPIRUN or MPICC an error tells me that no file was found
Please make sure the environmental variables configuration (Step 5 on manual installation). In case
you made tha automatic installation, we recommend to restart the computer, if this doesn't work,
you can always do step 5 manually. By default the paths are /usr/include/openmpi/ for PATH and
/usr/lib/openmpi/lib for LD_LIBRARY_PATH).