Installing ESMF on Ubuntu

 

Created on: 6/4/19
Last update: 6/4/19

Installing Dependencies

Essential packages:

sudo apt-get install openssh-client openssh-server

OpenMPI

Installing OpenMPI 1:

sudo apt-get install openmpi-bin openmpi-common libopenmpi1.10 libopenmpi-dev 

GCC

Install GNU C complier 2:

sudo apt-get install build-essential

Verify:

whereis gcc make
gcc --version
make -v

Netcdf

Install Netcdf-c and Netcdf-f 3 4:

apt-get install libnetcdf-dev libnetcdff-dev liblapack-dev liblapack3 libopenblas-base libopenblas-dev

Set Netcdf Variables 5:

export ESMF_NETCDF="split"
export ESMF_NETCDF_INCLUDE=/usr/include
export ESMF_NETCDF_LIBPATH=/usr/lib/x86_64-linux-gnu
export ESMF_NETCDF_LIBS="-lnetcdff -lnetcdf"

Installing ESMF

Download ESMF Program

Create a directory:

mkdir /usr/local/esmf

Download source code:

cd /usr/local/esmf
wget http://www.earthsystemmodeling.org/esmf_releases/public/ESMF_7_1_0r/esmf_7_1_0r_src.tar.gz

Untar the file:

tar -xvf esmf_7_1_0r_src.tar.gz

Set Environment Variables

Check the variables:

make info

Set ESMF root Variable:

export ESMF_DIR=/usr/local/esmf/esmf
export ESMF_LAPACK="netlib" 

Set following variables if they do not match in make info:

export ESMF_COMM=openmpi
export ESMF_COMPILER=gfortran
export ESMF_INSTALL_PREFIX=/usr/local/esmf/esmf

Build

cd $ESMF_DIR
make check
make install all
make build_apps

The ESMF Applications are located at /usr/local/esmf/esmf/apps/appsO/Linux.gfortran.64.mpiuni.default.

Test

ESMF_RegridWeightGen:

mpirun --allow-run-as-root -np 4 /usr/local/esmf/esmf/apps/appsO/Linux.gfortran.64.mpiuni.default/ESMF_RegridWeightGen -s /home/czhang/esmpy/examples/data/mpas_uniform_10242_dual_counterclockwise.nc -d /home/czhang/esmpy/examples/data/mpas_uniform_10242_dual_counterclockwise.nc -w /ESMF_CACHE/w.nc --src_loc center --dst_loc center

ESMF_Regrid:

mpirun --allow-run-as-root -np 4 ./ESMF_Regrid -s /home/czhang/esmpy/examples/data/mpas_uniform_10242_dual_counterclockwise.nc -d /home/czhang/esmpy/examples/data/mpas_uniform_10242_dual_counterclockwise.nc --src_var zeta --dst_var zeta

Reference manual

ESMF Quick Start

Building and Installing the ESMF