General info on [[MOM6]]
Compiling on ARCHER2¶
Following the general instructions on the MOM6 wiki.
Info on [[ARCHER2]]
Dataset downloads¶
Download datasets to ARCHER2 with
wget -r ftp://ftp.gfdl.noaa.gov/perm/Alistair.Adcroft/MOM6-testing/unpack them, then link them with
cd MOM6-examples # navigate to base directory
ln -sf /path/to/downloaded/data .datasetsmkmf approach¶
Necessary for anything other than ocean-only configurations (ocean-only configurations can be built with the auto-configure approach, though I’ve not tried this on ARCHER2)
The compilation environment should be established with the following module calls:
module load PrgEnv-gnu
module load cray-hdf5
module load cray-netcdf
module load cmakePer the MOM6 wiki here, this can be included in a env file if desired, using
mkdir build
cat > build/env << EOFA
module load PrgEnv-gnu
module load cray-hdf5
module load cray-netcdf
module load cmake
EOFAand load these modules with source build/env.
mkmf template modifications¶
Compiling with mkmf requires the use of certain templates, found in src/mkmf/templates, for which we will use linux-gnu.md. A file containing the necessary modifications to this template can be found at /work/e786/shared/graemem/MOM6-examples/src/mkmf/templates/archer-gnu.mk.
The specific modifications are:
Set the compiler and library names to the default wrappers on ARCHER2 (see here). Do this on lines 8-11, which should now read:
############
# Commands Macros
FC = ftn
CC = cc
CXX = CC
LD = ftn $(MAIN_PROGRAM)Add the following flags to the Fortran compiler flags (line 95):
-fallow-invalid-boz -fallow-argument-mismatchCompile FMS¶
In creating the Makefile one additional flag is required: -DHAVE_GETTID. The set of commands now reads (pointing to the modified template file):
mkdir -p build/fms/
(cd build/fms; rm -f path_names; \
../../src/mkmf/bin/list_paths -l ../../src/FMS; \
../../src/mkmf/bin/mkmf -t ../../src/mkmf/templates/archer-gnu.mk -p libfms.a -c "-Duse_libMPI -Duse_netCDF -DHAVE_GETTID" path_names)This generates the Makefile. Compile with:
(cd build/fms/; source ../env; make NETCDF=3 REPRO=1 libfms.a -j)Compile MOM6¶
Generate the Makefile :
mkdir -p build/ocean_only/
(cd build/ocean_only/; rm -f path_names; \
../../src/mkmf/bin/list_paths -l ./ ../../src/MOM6/{config_src/infra/FMS1,config_src/memory/dynamic_symmetric,config_src/drivers/solo_driver,config_src/external,src/{*,*/*}}/ ; \
../../src/mkmf/bin/mkmf -t ../../src/mkmf/templates/archer-gnu.mk -o '-I../fms' -p MOM6 -l '-L../fms -lfms' path_names)Compile with:
(cd build/ocean_only/; source ../env; make REPRO=1 MOM6 -j)Compile MOM6-SIS2¶
Generate the Makefile:
mkdir -p build/ice_ocean_SIS2/
(cd build/ice_ocean_SIS2/; rm -f path_names; \
../../src/mkmf/bin/list_paths -l ./ ../../src/MOM6/config_src/{infra/FMS1,memory/dynamic_symmetric,drivers/FMS_cap,external} ../../src/SIS2/config_src/dynamic_symmetric ../../src/MOM6/src/{*,*/*}/ ../../src/{atmos_null,coupler,land_null,ice_param,icebergs/src,SIS2,FMS/coupler,FMS/include}/)
(cd build/ice_ocean_SIS2/; \
../../src/mkmf/bin/mkmf -t ../../src/mkmf/templates/archer-gnu.mk -o '-I../fms' -p MOM6 -l '-L../fms -lfms' -c '-Duse_AM3_physics -D_USE_LEGACY_LAND_' path_names )Compile with:
(cd build/ice_ocean_SIS2/; source ../env; make REPRO=1 MOM6 -j)Run a test¶
Just to check that the compilation has worked, run one of the test configurations via an interactive job. First, start the job:
salloc --nodes=8 --ntasks-per-node=128 --cpus-per-task=1 --time=00:20:00 --partition=standard --qos=shortThen, run the test:
cd ocean_only/double_gyre/
mkdir -p RESTART
srun -n 8 ../../build/ocean_only/MOM6Compiling on a Mac¶
This information is derived from compiling the model on a 2018 MacBook Pro, running OSX 13.2 (Ventura).
autoconf approach¶
Detailed instructions here.
Preliminary steps:
Deactive any
condaenvironment. Details of setting up an appropriatecondaenvironment can be found here. For this set-up, I am installing everything in the native user environment (i.e. notconda). Note that you need to deactivatecondaeach time before you create the Makefile usingautoconf, otherwise it will pick up some of the associatedcondapackages and lead to errors.Set up environment, using
homebrewto install required dependencies (see dependencies here):
brew install make
brew install gfortran
brew install mpich
brew install netcdf
brew install netcdf-fortran
brew install autoconf
brew install automake(Ensure that command line tools (xcode) are up-to-date. I ran sudo xcode-select --install to ensure this was the case.)
Compile steps
Compile FMS
Issue
make -jinsrc/MOM6/ac/deps. This clones and compilesFMSand builds it in the local directory.
Create configuration script
Issue
autoreconfinsrc/MOM6/ac. Createsconfigurescript in local directory.
Compile the model
Create
builddirectory (preferable to do this inMOM6-examples/build).Execute
configurescript (found insrc/MOM6/src/ac) to create aMakefile.Issue
make -jinbuilddirectory to compile.