Painless shell scripts to set up a ninja build of MOM6 on NCI with Intel compilers. As prerequisites, I recommend you have the latest intel-compiler module loaded, netcdf, and a modern version of OpenMPI (4.0.x).
- Clone https://github.com/NOAA-GFDL/MOM6-examples to your home directory
- From within the
MOM6-examplesdirectory rungit submodule update --init --recursiveto fetch the rest of the components - (Optional) In
MOM6-examples/src/MOM6andMOM6-examples/src/FMS, rungit checkout dev/gfdlandgit checkout 2021.01, respectively to track the most recent set of compatible versions - Clone this repository (preferably on
/scratch, as the directories will fill up with object files and executables) - Go inside
mom6-ninja-ncidirectory and edit./gen_build.shto point thesrcdirvariable to thesrcdirectory of MOM6-examples (e.g.$HOME/MOM6-examples/src) - Run
./gen_build.shto generate the overall config file for compiler flags (you may edit theconfig.ninjafile afterwards to change these) - Make sure you have the ninja executable somewhere in your
PATH
The shared subdirectory is to build the FMS library against which MOM6 is linked.
- In
shared, run./gen_build.shto generate the build script - (Optional) Check
build.ninjaseems sensibly populated - Build it! Run
ninja
The ocean_only_symmetric subdirectory contains configuration for the ocean only (i.e. no sea ice or other coupling), symmetric C-grid, dynamic memory version of the model. Build steps are identical to FMS:
- In
ocean_only_symmetric, run./gen_build.shto generate the build script - (Optional) Check
build.ninjaseems sensibly populated - Build it! Run
ninja
You now have a MOM6 executable.
Most of the time, you will only be tweaking MOM6 source, so only MOM6 itself needs to be rebuilt. In many cases, changes to the source won't change the dependency order, so you can just re-run ninja, which will recompile only what is necessary, as any build system would. If the dependency order is changed (usually from added use statements here and there), re-run ./gen_build.sh.