Building Git Baselibs
This page will detail the process of building ESMA Baselibs from git. For the purposes of this page, ESMA-Baselibs-5.2.2 is an example tag.
Obtaining Baselibs
Check out Baselibs
The first step is to check out the tag you want.
For the latest ESMA Baselibs (5.0.3 and higher), you'll need access to the NASA Internal Github (request through NAMS). If you can't get that, please contact Matt Thompson (matthew.thompson AT nasa.gov) and a tarball can be provided. Assuming access to the NASA Internal Github you can run:
$ git clone -b 5.2.2 --recursive -j 6 git@developer.nasa.gov:mathomp4/ESMA-Baselibs.git ESMA-Baselibs-5.2.2/src
where 5.2.2 is the version.
Build Baselibs
The next task is to build Baselibs.
Load modules
For our example we want to load these modules:
1) other/comp/gcc-6.3 2) comp/intel-18.0.5.274 3) mpi/impi-18.0.5.274 4) lib/mkl-18.0.5.274 5) other/python/GEOSpyD/Ana2018.12_py2.7 6) other/git-2.11.0 7) other/cmake-3.8.2
Or for copy/paste:
$ module purge $ module load other/comp/gcc-6.3 comp/intel-18.0.5.274 mpi/impi-18.0.5.274 lib/mkl-18.0.5.274 other/python/GEOSpyD/Ana2018.12_py2.7 other/git-2.11.0 other/cmake-3.8.2
Note: It's a good idea to build Baselibs in a clean environment. If you have cruft in, say, LD_LIBRARY_PATH, it's possible the build will not pick up the libraries you expect.
Undo any CPP Environment Variable
Before doing any make (especially with PGI), you should issue:
$ unsetenv CPP DEFAULT_CPP
Some modules set these and most of the Baselibs assume the C-preprocessor will be gcc, not, say, pgcpp (which is not a C++ compiler!).
DISCOVER: Add to PATH
NOTE: On discover, because SLES11 is so old, you'll need newer basic utilities to build Baselibs. To do this:
$ setenv PATH /discover/swdev/mathomp4/bin:$PATH
(or the bash export equivalent)
Build Environment Settings
In order to correctly build Baselibs, two arguments are needed: ESMF_COMM and CONFIG_SETUP.
ESMF_COMM
ESMF_COMM is the MPI stack used by ESMF (usually intelmpi, mpi (for SGI MPT or other vendor MPI), openmpi, or mpich3).
CONFIG_SETUP
CONFIG_SETUP is actually an "identifier" that will allow you to build multiple versions of Baselibs for multiple compiler/MPI combination in the same checkout. The style recommended is for, say, Intel 18.0.5.274 and Intel MPI 18.0.5.274 is: CONFIG_SETUP=ifort_18.0.5.274-intelmpi_18.0.5.274 where you identify the compiler (by its name on the command line), its version, the MPI stack, and its version.
Note that if you do not add a CONFIG_SETUP, it will instead build into a directory named after $(FC), so ifort or gfortran. This is fine as long as you only build for that compiler once. Build again (say for a different MPI stack) and you will overwrite that first build!
(OPTIONAL) ESMF_BOPT
If you want to build ESMF with debugging on also add ESMF_BOPT=g
(OPTIONAL) Set MPICC_CC and MPICXX_CXX variables if using MPT
If you are using SGI MPT, and you wish to use, say, the PGI C and C++ compilers instead of GNU, you must set the MPICC_CC and MPICXX_CXX variables to be the "correct" compilers. This can be done either in the environment full (beware!) or during the install by adding at the end:
MPICC_CC=pgcc MPICXX_CXX=pgc++
Build and install
So for the above example you'd issue:
$ make install ESMF_COMM=intelmpi CONFIG_SETUP=ifort_18.0.5.274-intelmpi_18.0.5.274 |& tee makeinstall.ifort_18.0.5.274-intelmpi_18.0.5.274.log
and it would build all the libraries. The tee is so that you can capture the install log, and also see it real-time.
Once built, check for "Error" in your log file, and if you don't see any "Error 2" messages, you are probably safe.
make verify
You can also use make verify which will check the status of the build (by looking for xxx.config and xxx.install files) and print a table like:
-------+---------+---------+-------------- Config | Install | Check | Package -------+---------+---------+-------------- ok | ok | -- | antlr ok | ok | -- | gsl ok | ok | -- | jpeg ok | ok | -- | zlib ok | ok | -- | szlib ok | ok | -- | curl ok | ok | -- | hdf4 ok | ok | -- | hdf5 ok | ok | -- | netcdf ok | ok | -- | netcdf-fortran ok | ok | -- | udunits2 ok | ok | -- | nco ok | ok | -- | cdo ok | ok | -- | nccmp ok | ok | -- | esmf ok | ok | -- | pFUnit ok | ok | -- | gFTL ok | ok | -- | pFlogger ok | ok | -- | FLAP ok | ok | -- | uuid ok | ok | -- | cmor ok | ok | -- | hdfeos ok | ok | -- | hdfeos5 ok | ok | -- | SDPToolkit -------+---------+---------+--------------
Note that this is not as comprehensive as looking at the log file as it is possible that some submakes will fail but not communicate that well enough to the main make process. Test
Checking Baselibs
This is optional, but recommended. Many of the Baselibs have the ability to do a check. You should do this only in an environment where you can run MPI (like compute nodes at NCCS or NAS). This is because parallel NetCDF and ESMF tests are run:
$ make check ESMF_COMM=intelmpi CONFIG_SETUP=ifort_18.0.5.274-intelmpi_18.0.5.274 |& tee makecheck.ifort_18.0.5.274-intelmpi_18.0.5.274.log
Note that at the moment, many will exit with errors. For example, NetCDF has tests that require internet access and if a check is done on a compute node with no external access, it will fail.