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-examples
directory rungit submodule update --init --recursive
to fetch the rest of the components - (Optional) In
MOM6-examples/src/MOM6
andMOM6-examples/src/FMS
, rungit checkout dev/gfdl
andgit 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-nci
directory and edit./gen_build.sh
to point thesrcdir
variable to thesrc
directory of MOM6-examples (e.g.$HOME/MOM6-examples/src
) - Run
./gen_build.sh
to generate the overall config file for compiler flags (you may edit theconfig.ninja
file 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.sh
to generate the build script - (Optional) Check
build.ninja
seems 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.sh
to generate the build script - (Optional) Check
build.ninja
seems 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
.