Building NU-WRF’s External Libraries
Over two dozen third-party libraries must be installed before building NU-WRF. Except as noted, the libraries must be compiled using the same compilers as NU-WRF. We recommend using Intel compilers with Intel MPI, though we also successfully used GNU compilers with OpenMPI.
To help build all the libraries, we’ve included some scripts with the NU-WRF source code (see scripts/other/baselibs.*) that facilitate the installation of all software packages The scripts can be adapted to other systems with modifications. It is highly recommended that static library files be created and linked rather than shared object. The list of libraries is as follows:
BOXMG 0.1 (Used to build with WRF_ELEC option).
BUFRLIB 11.0
CAIRO 1.14.8
ECCODES 2.23.0
ESMF 8.5.0 compiled with MPI support.
FLEX (can use precompiled system binary on Linux).
FORTRANGIS 3.0
FREETYPE 2.11.0
G2CLIB 1.6.0
GDAL 2.4.4
GEOTIFF 1.5.1
GHOSTSCRIPT 8.11
GRIB_API 1.17.0
GSL 2.3
HDF4 4.2.16
HDF5 1.14.3
HDF-EOS 2.3.0
JASPER 2.0.14
JPEG 9b.
LIBGEOTIFF 1.7.1.
LIBPNG 1.6.37.
NCAR Graphics 6.0.0. (Newer versions of NCAR Graphics require compilation and linking to the CAIRO library, which is currently only supported by MET.)
NETCDF 4.9.2 (C library), NETCDF-Fortran 4.6.1, and NETCDF-CXX 4.3.0.1 (C++ library), built with HDF5 compression.
OPENJPEG 2.5.2.
PROJ 9.3.
PIXMAN 0.40.0.
SQLITE 3.43.02
YACC (can use preinstalled version on Linux).
ZLIB 1.2.11.
In addition to the above libraries you may need to install the curl 7.64
library, if not installed on your system. NU-WRF also requires perl
,
python3
, bash
, tcsh
, gmake
, sed
, awk
, m4
,
and the UNIX uname
command to be available on the computer.
The tarballs for the above packages can be obtained from:
https://portal.nccs.nasa.gov/datashare/astg/nuwrf/baselibs/ or, if you have
accesss to NASA’s Discover, you can get all the tarballs from here:
/discover/nobackup/projects/nu-wrf/lib/tarballs
.
Running the Library Build Scripts
The two baselibs
scripts depend on another script in the same directory,
scripts/other/set_module_env.bash
, which sets up important environment
variables. You must edit this script to
remove hardwired checks for platforms that will abort execution of the script.
set LIBDIR_TAG to the root directory for these new libraries that you plan to build (e.g.,
/shared/libs
)change the modules as appropriate for your for system binaries and libraries (compilers, MPI, etc).
The baselibs
scripts also assume the use of the “Environmental Libraries
Package” (AKA module environment
, http://modules.sourceforge.net/). If your system does not
have that package installed, comment out the module
commands and explicitly edit the PATH
and LD_LIBRARY_PATH
environment variables.
For example, a recent port to an AWS cluster used these settings to define the environment:
LIBDIR=/shared/libs
LIBDIR_TAG=/shared/libs/gnu-13.2.0_openmpi-4.1.6
NUWRFDIR=/home/username/nuwrf/src/nu_wrf_dev
MPI_VENDOR=openmpi
COMPILER_VENDOR=gnu
URL_LOCAL=${LIBDIR}/tarballs
spack load gcc@13.2.0
. /usr/share/modules/init/sh
module use --append /shared/modules/modulefiles
module load python openmpi/4.1.6
These settings are significantly simpler than the ones specified in
set_module_env.bash
and exemplify the important settings needed in
a port.
Before running the scripts, view/edit the file baselibs.cfg to ensure all the URLs and versions are set correctly. The script can either retrieve lib source- code directly from the Internet, or from a set of local tarballs, which were previously downloaded.
Transfer them to your system, then set the environment variable $URL_LOCAL to the folder where you’ve downloaded the tarballs.
To begin running the baselibs.sh script, go its directory:
cd $NUWRFDIR/scripts/other
and issue a command similar to:
./baselibs.sh -c gnu -m openmpi
where the options can be:
-c intel -m intelmpi (sgimpt, mvapich2)
-c gnu -m openmpi (sgimpt, mvapich2)
-c nag -m mvapich2
-c pgi -m openmpi
If all goes well, the libraries will be built in about a few hours. More often you will have to troubleshoot a few errors before everything works. If the process aborts, look for the error logs under $LIBDIR.