Skip to content

Repository files navigation

fesm-utils

Convenience repository holding the shared Fortran utility library and the external libraries needed to run fast Earth system models, like CLIMBER-X and yelmox.

Directory structure

The repository bundles the FESM utility library together with three vendored external libraries, each in its own folder holding the upstream source plus the compiled serial / omp install prefixes:

fesm-utils/
  fftw/   fftw-3.3.10/   fftw-serial/   fftw-omp/      # FFTW (autotools)
  lis/    lis-2.1.11/    lis-serial/    lis-omp/       # LIS solver (autotools)
  SHTns/  shtns-3.7.5/   shtns-serial/  shtns-omp/     # SHTns (autotools)
  src/ test/ include-serial/ include-omp/ ...          # the utils library
  config/ Makefile common.mk libs.mk legacy/           # build configuration
  Makefile                                             # generated by configme
  • utils (src/, compiled into include-{serial,omp}/libfesmutils.a) — a self-contained collection of Fortran modules (coordinates, mapping, ncio, …).
  • fftw, lis, SHTns — vendored upstream libraries, each built by its own autotools configure/make/make install into <lib>/<lib>-{serial,omp}.

Everything is driven from a single root Makefile, generated per machine by configme. A serial and an OpenMP variant coexist side by side; pick one with openmp=0 (default) or openmp=1.

Building

1. Configure (generate the Makefile)

configme is the single source of machine/compiler truth (Fortran flags, netCDF autodetection). It generates the root Makefile from the tracked template config/Makefile:

configme install fesm-utils -m macbook -c gfortran   # clone + configure + build
# or, in an existing checkout, just (re)generate the Makefile:
configme config fesm-utils -m macbook -c gfortran

2. Build with make

One consistent interface for everything, selecting the variant with openmp=:

make fftw  openmp=0        # build serial FFTW  -> fftw/fftw-serial
make lis   openmp=1        # build OpenMP LIS   -> lis/lis-omp
make shtns openmp=0        # build serial SHTns -> SHTns/shtns-serial
make libs  openmp=0        # fftw + lis + shtns, one variant
make fesmutils-static openmp=0   # build the utils library (libfesmutils.a)
make usage                 # list the main targets

Notes:

  • Build the external libraries serially (a one-time autotools build — do not pass -j to make libs). SHTns links the FFTW built here, so fftw must be installed before shtns.
  • On clusters, module load your compiler + netCDF toolchain first — the library builds and netCDF autodetection use the environment already loaded in your shell.

Machine configuration

Two kinds of build config, both selected by machine/compiler:

  1. Fortran + netCDF (for the utils library) — lives in configme's machine/compiler fragments and is auto-detected (nf-config/nc-config). configme bakes it into the generated Makefile.
  2. C-library autotools quirks (for fftw/lis/shtns) — live in config/libs.mk, keyed on $(MACHINE) / $(COMPILER) (which configme writes into the Makefile). This one file is the home for every autotools quirk: the macOS Homebrew-gcc pick, the autoconf C-standard pins, the Intel runtime-lib fix, and the SHTns kernel-compiler / -march handling. To support a new machine, add a block there and a configme fragment for the Fortran side.

Override either on the command line for a one-off:

make fftw openmp=1 MACHINE=dkrz_levante COMPILER=ifx

Legacy path (without configme)

The utils library can still be configured the old way — a template + a per-host fragment under config/legacy/:

python config.py config/legacy/macbook_gfortran   # writes ./Makefile
make clean
make fesmutils-static openmp=0

Use the libraries

A symlink can be made to this repository for use within, e.g., CLIMBER-X:

cd climber-x/
ln -s /path/to/fesm-utils ./

Downstream builds reference the install prefixes directly, e.g. fesm-utils/include-serial (utils), fesm-utils/fftw/fftw-serial, fesm-utils/lis/lis-serial, fesm-utils/SHTns/shtns-serial.

To get the original libraries

Mainly relevant for maintainers, or to try a different upstream version. Unpack the source into the matching container folder (fftw/, lis/, SHTns/):

### FFTW
wget https://www.fftw.org/fftw-3.3.10.tar.gz
tar -xvf fftw-3.3.10.tar.gz -C fftw/
rm fftw-3.3.10.tar.gz

### LIS
wget https://www.ssisc.org/lis/dl/lis-2.1.11.zip
unzip lis-2.1.11.zip -d lis/
rm lis-2.1.11.zip

Then build with make as described above.

About

Convenience repository holding external libraries needed to run FESMs.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages