This post provides instructions on building and using Open MPI 2.0 on OS X with Absoft Pro Fortran 2016 (v16.0) and later.
The Open MPI Project is an open source MPI-3 implementation that is developed and maintained by a consortium of academic, research, and industry partners.
SPECIAL NOTE FOR IMSL 7.0 USERSThe MPI features of the IMSL 7.0 libraries for OS X and Absoft Pro Fortran require the MPICH MPI implementation and will not work correctly with OpenMPI. Information on building MPICH is available in the Building MPICH2 on OS X post in this forum.
DOWNLOADING THE REQUIRED PACKAGEThe Open MPI 2.0 package is available from
http://www.open-mpi.org. At the time this post was last updated, the current stable release for Open MPI was 2.0.0. It was released on July 27, 2016. The instructions below use the source code package named openmpi-2.0.0.tar.gz and were tested on OS X OS X 10.11 (El Capitan) using the Xcode 7.3 command line tools.
CREATING THE OPEN MPI SOURCE TREEExtract the Open MPI source with the following command:
tar -xzvf openmpi-2.0.0.tar.gz
This will create a directory named openmpi-2.0.0 in the current working directory.
MAKING A TARGET BUILD DIRECTORYIt is possible to configure and build Open MPI directly inside the source directory. However, creating a separate build directory makes re-configuring or maintaining more than one build (for example 32 and 64 bit builds) easier. The instructions below assume that separate build directories have been created in the directory containing the Open MPI source directory using these commands:
mkdir ompi-32build
mkdir ompi-64build
ESTABLISHING THE COMPILATION ENVIRONMENTBefore configuring the Open MPI software, you need to establish the Absoft compiler's environment variables by sourcing the absvars.sh script from the Absoft bin directory. For example, this command establishes the environment for Absoft Pro Fortran 2016 (v16.0) under the BASH shell:
source /Applications/Absoft16.0/bin/absvars.sh
C shell users should use this command:
source /Applications/Absoft16.0/bin/absvars.csh
NOTE: The instructions below were developed and tested using the C/C++ compiler included with Apple's Xcode development toolkit. You may have to make adjustments if you are attempting to use a different C/C++ compiler.
CONFIGURING, BUILDING AND INSTALLING 64 BIT OPEN MPIUse following commands to configure, build and install 64 bit Open MPI with Absoft Pro Fortran 2016 (v16.0) and later. These commands configure Open MPI to install into /opt/openmpi-64. If you want to install to a different location, replace /opt/openmpi-64 in the --prefix= argument to the configure command.
cd ompi-64build
../openmpi-2.0.0/configure --prefix=/opt/openmpi-64 \
FC=$ABSOFT/bin/af90 FCFLAGS=-m64 \
CFLAGS=-m64 CXXFLAGS=-m64 LDFLAGS=-m64 \
--with-wrapper-fcflags=-m64 \
--enable-static --disable-shared
make
sudo make install
CONFIGURING, BUILDING AND INSTALLING 32 BIT OPEN MPIUse following commands configure, build and install 32 bit Open MPI with Absoft Pro Fortran 2016 (v16.0) and later. These commands configure Open MPI to install into /opt/openmpi-32. If you want to install to a different location, replace /opt/openmpi-32 in the --prefix= argument to the configure command.
cd ompi-32build
../openmpi-2.0.0/configure --prefix=/opt/openmpi-32 \
FC=$ABSOFT/bin/af90 FCFLAGS=-m32 \
CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 \
--with-wrapper-fcflags=-m32 --with-wrapper-cflags=-m32 \
--enable-static --disable-shared
make
sudo make install
USING OPEN MPI IN ABSOFTTOOLSAbsoftTools has support for creating projects that use Open MPI. There is one configuration step which is required to enable this support. You must set the path to your Open MPI bin directory in AbsoftTools Preferences.
- Launch /Applications/Absoft16.0/AbsoftTools.app
- Use the AbsoftTools Preferences.. command to display Preferences dialog
- Select the Directories page in the Preferences dialog
- Click the button at right of the MPI bin directory field to display a directory selection dialog
- Navigate to your Open MPI bin directory (/opt/openmpi-64/bin or /opt/openmpi-32-bin for these instructions)
- Click Choose to close the directory selection dialog
- Click OK to close the Preference dialog
After setting the AbsoftTools MPI bin directory preference, you can create new Open MPI projects by selecting "MPI Application" as the Target Type in the Target page of the AbsoftTools Project Options dialog. If you are using 64 bit Open MPI, you should also check the 64 bit Code box on the Target page.
USING OPEN MPI FROM THE COMMAND PROMPTIn order insure that correct Open MPI commands are invoked, the installed Open MPI bin directory should be added to your PATH variable. This is particularly important on OS X as Apple includes a version of Open MPI which is built without Fortran support. If you do not put the newly installed Open MPI into your path, invoking mpif77 will produce a message which states "Unfortunately, this installation of Open MPI was not compiled with Fortran 77 support. As such, the mpif77 compiler is non-functional."
For bash and sh users:
export PATH=/opt/openmpi-32/bin:$PATH
or
export PATH=/opt/openmpi-64/bin:$PATH
For csh and tcsh users:
setenv PATH /opt/openmpi-32/bin:$PATH
or
setenv PATH /opt/openmpi-64/bin:$PATH
FURTHER INFORMATIONFurther information on building Open MPI can be found in the file named README located in the openmpi-2.0.0 source directory.