-
Notifications
You must be signed in to change notification settings - Fork 25
Run BLOM iHAMOCC stand alone
BLOM/iHAMOCC is mainly used as a component in the NorESM system, but can also run as a stand alone ocean model. We distinguish between three different configurations:
- NorESM config, fully coupled: This is the standard configurations for most NorESM experiments, with active model components for ocean, atmosphere and land.
- NorESM config, stand alone: This configuration makes use of the NorESM coupling and build system, but with only BLOM/iHAMOCC and CICE as active model components, making use of reanalysis data to represent input from other domains. This is the configuration used for OMIP-type experiments.
- stand alone, uncoupled: Only BLOM/iHAMOCC, without using the NorESM coupling and build system.
Please refer to NorESM documentation for information on how to build and run BLOM/iHAMOCC with NorESM. The following is documentation for building and running BLOM/iHAMOCC in a stand alone, uncoupled configuration.
When compiling BLOM with NorESM, the NorESM build system should be used. A stand-alone
BLOM executable can be built by using the meson build system.
To build the code ensure that Meson
is available.
The following will build the default version of BLOM without MPI
.
$ meson setup builddir --buildtype=debugoptimized
$ meson compile -C builddir
The executable blom
file will then be stored in the ./builddir
directory.
The code has several different configuration options setup in
meson_options.txt
which can be specified either when
setting up or through meson configure
.
To change the configuration, after meson setup
, use meson configure
. E.g. to
enable MPI
and parallel NetCDF
one could reconfigure the build by
$ meson configure builddir -D mpi=true -D parallel_netcdf=true
$ meson compile -C builddir
The same configuration when setting up would be
$ meson setup builddir --buildtype=debugoptimized -D mpi=true -D parallel_netcdf=true
$ meson compile -C builddir
BLOM/iHAMOCC supports OpenMP, but meson will only build BLOM/iHAMOCC with OpenMP if it is supported on the local system. The OpenMP argument has three options: 'auto' (default), 'enabled' and 'disabled'. For some test cases (e.g. single column) it can be more efficient to run without any parallel processing, i.e. build with
$ meson setup builddir --buildtype=debugoptimized -D openmp=disabled
The iHAMOCC component can be enabled by setting the build option ecosys=true
. The
source code does not include input data that are needed for iHAMOCC, so this needs to be
provided separately.
$ meson setup builddir_eco --buildtype=debugoptimized -D ecosys=true
To change the compiler one must define the FC
(Fortran compiler) and CC
(C
compiler) environment variables. As an example, the following changes the
compiler suite to the Intel compilers.
$ CC=icc FC=ifort meson setup builddir --buildtype=debugoptimized
$ meson compile -C builddir
After the first line all subsequent compiles (and changes with meson configure
) will utilize the Intel compiler to build and link BLOM.
Similarly, to change the mpi library to mpiifort
$ FC=ifort I_MPI_F90=mpifort meson setup builddir
After successfully building the code it can be a good idea to test that the code behaves as expected and changes to the code does not affect the output.
Tests can be run with the following:
$ meson test -C builddir
The previous command will run all the test suites defined for BLOM. To run tests
quicker one can select a few tests to run or just a single test suite. To list
the available tests run meson test -C builddir --list
. One can then run a
single test with:
$ meson test -C builddir "run single_column"
Sometimes the BLOM/iHAMOCC model will stop at the initiation phase with a segmentation fault, indicating a problem with memory access. One possible cause for this problem may be that the program is running out of stack memory, in which case you need to increase the memory stack size. To check the current stack size:
$ ulimit -a # full list of resource limits
$ ulimit -s # stack size limit in kbytes
The stack size is often limited to 8192 kbytes (8 MB) by default. To increase the stack size to e.g. 32768 kbytes (32 MB):
$ ulimit -s 32768
This can also be encapsulated in a basic run script:
#!/bin/bash
ulimit -s 32768
./blom
BLOM wiki, © Copyright 2023, BLOM development team. This documentation is licensed under a ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/.