Howto install ESMF and ESMPy with OpenMPI support

To install the Earth System Modelling Framework Python interface (ESMPy) on OSX Mavericks follow these steps.

1. Install OpenMPI by downloading the source code here. Next, unpack the source code to a location on your hard drive.

tar zxvf openmpi-1.8.1.tar.gz

In the root folder of the etxracted source code, execute the following:

./configure --prefix=/usr/local
make all

If the compilation was successful, continue with the installation.

sudo make install

Finally, add the installation directory to your PATH variable unless it is already present (do this in iether your .bashrc or .profile file):

export PATH=/usr/local/bin:$PATH

2. Download the ESMF package. You have to provide your email address prior to doing so. When the tar package has been downloaded extract it to a location on your hard drive.

tar zxvf ESMPy_630r_01b.tar.gz

You can also download the bleeding edge development of this toolbox through git repository:

 git.code.sf.net/p/esmf/esmf

Next, move into the source files root folder and define the following environmental variables:

export ESMF_DIR=/Users/trondkr/GMT/ESMF-clang/esmf
export ESMF_NETCDF="local"
export ESMF_COMPILER=intelclang
export ESMF_COMM=openmpi
export ESMF_CXXLINKLIBS=-lsvml
export ESMF_F90LINKLIBS=-lsvml
export ESMF_F90COMPILER=/opt/intel/composer_xe_2013_sp1.3.166/bin/intel64/ifort
export ESMF_TESTEXHAUSTIVE=on
export ESMF_TESTSHAREDOBJ=on
export ESMF_NETCDF_INCLUDE=/usr/local/include
export ESMF_NETCDF_LIBS="-lnetcdf -lnetcdff"
export ESMF_NETCDF_LIBPATH=/usr/local/lib
export ESMF_INSTALL_PREFIX=/Users/trondkr/GMT/ESMF

I decided to compile ESMF and ESMPy using the Clang C compiler that ships with OSX Mavericks in combination with Intel Fortran and thats why I use the option ESMF_COMPILER=intelclang. I contacted ESMF and received the git (bleeding edge) version of the ESMF to be able to use the Clang compiler as support for this compiler is in progress. I also received fantastic support from ESMF to get this to work. (Thanks Walter and Ryan!). Next, compile the source code:

make

If successfull, run the tests to make sure everything is okay before installing to the directory specified earlier by ESMF_INSTALL_PREFIX:

make check
make all_tests
make install

Next I also wanted to install ESMPy, the Python interface to ESMF. To do this start by moving into folder

$ESMF_DIR/src/addon/ESMPy

before you run the build and install commands:

python setup.py build --ESMFMKFILE=/Users/trondkr/GMT/ESMF/lib/libO/Darwin.intelclang.64.openmpi.default/esmf.mk
python setup.py install --prefix=/Users/trondkr/Library/Enthought/Canopy_64bit/User

This installed the ESMF module (ESMPy) into directory:

/Users/trondkr/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/lib/python2.7/site-packages/

Finally, I wanted to test that everything worked fine and ran the unit tests:

(Canopy 64bit) HI-06392:ESMPy trondkr$ python setup.py test
running test
Unit test results: run_unit_test.log
PASS = 41
FAIL = 0
SKIP = 2

2 thoughts on “Howto install ESMF and ESMPy with OpenMPI support”

  1. Hello Trond

    I’m trying to install the ESMF for interpolate the SODA database for use as boundary countorn, but I don’t know how continue from the “make”, after to download the ESMPy_630r_01b.tar, getting the next observation

    “makefile:20: /Users/trondkr/GMT/ESMF-clang/esmf/build/common.mk: No such file or directory

    make: *** No rule to make target `lib’, needed by `all’. Stop.”

    I can’t to finish the installation. You can help me?

    Thank you

  2. Hi. You have an error in your path to common.mk. You need to change “/Users/trondkr” to your own path (e.g. /Users/juan) so that ESMF can find the files required to run make. You should also email support at ESMF as they are extremely helpful and knowledgeable about everything ESMF. Hope it compiles! Cheers, Trond

Leave a Reply

Your email address will not be published. Required fields are marked *