7. Appendices

7.1. A. Compiling netCDF

By far the easiest way to use RH is when the proper HDF5 library is already installed in the system. This is the case at most supercomputers, but not usually in user workstations or laptops. Even if your operative system can provide HDF5 through its packaging system (e.g. macports in macOS, rpm in linux distributions), this is often unsuitable for running RH. The reason is that there needs to be consistency between the compiler, MPI libraries used, and the HDF5 library must be compiled with parallel support.

Compiling all of this from scratch is burdensome and prone to fail. Care must be taken to ensure that each library is built properly, and that MPI functions well. Errors with MPI libraries are particularly difficult to diagnose.

The recommended approach is to use an MPI library already in the system. If this is not possible or it is not working properly, then MPI must also be compiled (see below for instructions for Open MPI). The following instructions go through the different steps of compiling the libraries. They assume a bash shell is used, so please adapt if you need csh or tcsh.

Note

The download binary is assumed to be curl (commonly available in macOS), but one can also use wget (commonly available in Linux). To change, replace curl -O by wget -c.

Note

The instructions below download specific versions of the libraries, the latest at the time of writing. These should work, but feel free to use more recent versions if available.

7.1.1. Compilers and installation directory

One should compile all the libraries with the same compiler or family of compilers. And of course be aware of the different flags of each. Once MPI is compiled, one should always use the mpicc and mpif90 binaries for the compiler of HDF5. If compiling MPI, then one should use the proper name (e.g. gcc, clang, icc). For this, one uses the CC environment variable, e.g.:

export CC=mpicc     # or gcc, clang, icc,
export FC=gfortran  # or mpif90, ifort

All of the instructions below assume all the libraries to be installed under a directory local to the user, and set to the MYPREFIX environment variable, e.g.:

export MYPREFIX=/home/user/local

7.1.2. Compiling Open MPI (optional)

Use this if you don’t currently have any MPI library or suspect it is not working properly (e.g. too old).