Skip to content
This repository has been archived by the owner on Oct 23, 2020. It is now read-only.

machine instructions ubuntu gfortran

Phillip Wolfram edited this page Dec 5, 2017 · 9 revisions

Install system dependencies

sudo apt-get install gfortran libhdf5-dev m4 cmake libopenmpi-dev

Create an anaconda environment

This environment is appropriate for setting up and running ocean initial conditions from COMPASS test cases (though some may require additional libraries)

conda create -n mpas python=2 netcdf4 numpy scipy shapely matplotlib
source activate mpas
conda update --all

Build NETCDF dependencies

Download and untar the latest netcdf, netcdf-fortran, netcdf-cxx (not netcdf-cxx4) and parallel-netcdf source. These are the latest at the time of this writing:

netcdf-4.3.3.1.tar.gz

netcdf-fortran-4.4.2.tar.gz

netcdf-cxx-4.2.tar.gz

parallel-netcdf-1.6.1.tar.gz

You can modify /usr/local below to be a path where you would like to install the dependencies. You may be able to remove sudo from make install commands if you're not installing to a system folder.

export NETCDF=/usr/local
export PNETCDF=$NETCDF
export PIO=$NETCDF

export HDF5_INCLUDE=/usr/include/hdf5/serial/
export HDF5_LIB=/usr/lib/x86_64-linux-gnu/hdf5/serial/

export CPPFLAGS="-I$HDF5_INCLUDE -I${NETCDF}/include"
export LDFLAGS="-L$HDF5_LIB -L${NETCDF}/lib"

cd netcdf-4.3.3.1
./configure --disable-dap --enable-netcdf-4 --disable-cxx --enable-shared --disable-static --enable-fortran \
 --enable-hdf5 --prefix=$NETCDF
make
make check
sudo make install
sudo ldconfig
cd ..

cd netcdf-fortran-4.4.2
./configure --disable-static --prefix=$NETCDF
make
make check
sudo make install
cd ..

cd netcdf-cxx-4.2
./configure --disable-static --prefix=$NETCDF
make
make check
sudo make install
cd ..

sudo ldconfig

cd parallel-netcdf-1.6.1
./configure --prefix=$NETCDF
make
make check
sudo make install
cd ..

sudo ldconfig

export NETCDF_PATH=$NETCDF
export PNETCDF_PATH=$PNETCDF

git clone git@github.com:NCAR/ParallelIO.git
cd ParallelIO
git checkout tags/pio1_7_2
cd pio
./configure --prefix=$NETCDF
make
sudo make install
sudo ldconfig
cd ../..

As an alternative to using ldconfig, you can add $NETCDF to LD_LIBRARY_PATH but this may interfere with your mpas anaconda environment.

Loading dependencies

To load dependencies before compiling MPAS, it is useful to create a bash file (e.g. setup_mpas_dependencies.bash) that can be sourced before compiling MPAS. Here is an example:

source activate mpas

export CORE=ocean

export NETCDF=/path/to/dependencies
export PNETCDF=$NETCDF
export PIO=$NETCDF

Building MPAS

make gfortran
Clone this wiki locally