Skip to content

Running MOM6 on Google's Compute Platform (GCP)

Alistair Adcroft edited this page May 10, 2018 · 2 revisions

Disclaimer

As for Installing MOM6 in a virtual machine running Ubuntu this page provides guidance for running MOM6 on the Google Cloud Platform (GCP) but we cannot provide support for this particular process. Be aware that services on GCP might cost you money.


Synopsis

  1. Configure an instance of a Virtual Machine on Google Compute Engine
  2. Launch and connect to an instance
  3. Install required linux packages
  4. Clone, build and run MOM6

Configure an instance of a Virtual Machine

If you have a configured instance already, skip to the next section.

  1. Login to https://console.cloud.google.com/
  2. Click through to Compute Engine -> VM instances
  3. Click +Create instance
    • Here you need to make some choices:
      • A name
      • Number of cores (under Machine type)
      • A boot disk (we're using Debian GNU/Linux 9)
      • Under "Management, disks, networking, SSH keys" we select "Preemptibility=On" to reduce costs and avoid accidentally leaving an instance live forever
    • Click "Create" and after a short while the new instance will appear in the list

Launch and connect to an instance

  1. Find you instance in the list. If it does not already show a green check and use the three dots menu to start the instance.
  2. Click SSH to have a browser-based shell open on the instance, or use the pull-down menu to connect another way.

Install required linux packages

At the shell prompt you'll see that you are logged in as regular user. Use sudo permission elevation to install the required packages

sudo apt install git make gfortran pkg-config netcdf-bin libnetcdf-dev libnetcdff-dev openmpi-bin libopenmpi-dev

Clone, build and run MOM6

Clone MOM6-examples recursively which will fetch all required source and packages for ocean-only and ice-ocean configurations:

git clone --recursive https://github.com/NOAA-GFDL/MOM6-examples.git

Build MOM6 (here we'll build MOM6 and FMS in one step rather than build intermediate libraries):

cd MOM6-examples
mkdir -p build
cd build
../src/mkmf/bin/list_paths -l ../src/FMS ../src/MOM6/{config_src/{dynamic_symmetric,solo_driver},src}
../src/mkmf/bin/mkmf -t ../src/mkmf/templates/linux-ubuntu-trusty-gnu.mk -c '-Duse_libMPI -Duse_netCDF -DSPMD' -p MOM6 path_names
make -s -j

To run MOM6 you need to be in an experiment directory:

cd ~/MOM6-examples/ocean_only/benchmark/

To avoid an error while ending, create a directory for restart files:

mkdir -p RESTART

Run the model:

mpirun -n 8 ../../build/MOM6

where "8" should be no more than the number of cores you selected when you configured the instance.

The model runs for one model day and takes ~1 minute on 8 cores.


Extras

Quick scaling tests can be done with this double loop that runs the model 4 times on 4 to 96 cores:

for r in $(seq 1 4); do for np in 4 8 12 16 24 32 36 48 60 64 96; do echo mpirun -n $np ../../build/MOM6 x log.c$np.r$r ; mpirun -n $np ../../build/MOM6 > log.c$np.r$r ; done ; done
grep -h "Main loop" log.* | awk '{pe = $10 + 1 ; print pe,"\t",$4}' | sort -n -k1

To use "wide halos" in the barotropic solver and non-blocking communication do:

echo -e "BTHALO = 10\nNONBLOCKING_UPDATES = True" >> MOM_override

The model uses a 360x180x22 cell mesh by default. To quadruple the problem size use:

echo -e "#override NIGLOBAL = 720\n#override NJGLOBAL = 360" >> MOM_override
Clone this wiki locally