The installation of Open MPI on Mac is surprisingly easy.
- Download source code from http://www.open-mpi.org/software/. At the time of posting the current stable release of Open MPI is version 1.6.1.
- Copy the archive file to a temporary location to compile it. Open Terminal.app and change directories to the new location of the Open MPI archive. If you downloaded the source code as a
.tar.gz
file, you can untar/zip it by typingtar zxvf openmpi-1.6.1.tar.gz
which will create a directory calledopenmpi-1.6.1/
. Change directories into the new directory. - Assuming you have some compilers installed, you can now run the configuration script. As mentioned above, if you don't have any compilers installed, you can check out my page on installing the GNU compilers before proceeding. If you only have one set of compilers installed, you can run the configuration script by typing
./configure --prefix=/usr/local
If you would like to install Open MPI someplace other than/usr/local
, you can change the directory listed for theprefix
flag. - If you have multiple compilers installed, you can specify which compilers you would like to use as follows
./configure CC=icc CXX=icpc F77=ifort FC=ifort --prefix=/usr/local
where you specify the C (CC
), C++ (CXX
), Fortran 77 (F77
) and Fortran 90 (FC
) compilers with the listed variables*. - Assuming the configuration script runs without issue, you can compile the code by typing
make all
which will compile the Open MPI libraries/binaries and configure the wrappers for using the specified compilers. This should take a bit... - Again, assuming the code compiles without issue, you can install Open MPI by typing
sudo make install
Beware that using sudo can do major damage to your computer if you aren't careful. You can now feel free to delete the temporary Open MPI build directory (e.g.,openmpi-1.6.1/
) since the code has been installed. If you think you might want to rebuild with different compilers or change the configuration, you may want to keep this directory around.
mpicc
,mpicxx
, mpif77
, mpif90
) and run MPI-enabled programs with mpiexec
. If you try to use the new Open MPI executables and they are not found, it may be that/usr/local/bin
(or wherever you specified with the --prefix
flag in the configure stage) is not in your $PATH
environment variable. You can confirm this by typing echo $PATH
if you do not see
/usr/local/bin
listed between the colons, you will need to add it. I describe how to do this at the end of my page on installing the GNU compilers.
For assistance on linking to Open MPI or running MPI-enabled software, check out the Open MPI documentation.
* Minor typo fixed 08/12A previous version of this page listed the configuration step as
./configure CC=icc CXX=icpc F77=ifort F90=ifort --prefix=/usr/local
where you specify the C (CC
), C++ (CXX
), Fortran 77 (F77
) and Fortran 90 (F90
) compilers with the listed variables.
I believe that the use of the environment variable
F90
is no longer supported and F90
has been replaced by FC
in the GNU automake tools.
No comments:
Post a Comment