Skip to content

1. Setting up

jenjar93 edited this page Oct 5, 2022 · 1 revision

Compiling NEMO, XIOS and Tools

To build the NEMO, XIOS and Tools needed to run the SANH relocatable model, navigate to the SCRIPTS folder in a bash terminal and edit make_paths.sh as necessary (likely only the $CONFIG and $WORK paths). Then, run the following scripts (e.g. . ./make_paths.sh) in order:

cd SCRIPTS
. ./make_paths.sh
. ./make_directories.sh
. ./make_xios.sh
. ./make_nemo.sh

These are made before the domain file so some of the tooling and directory structures can be reused.

Installing XIOS

After running make_paths.sh and make_directories.sh, view the make_xios.sh script. Navigate to your $WDIR and load the necessary modules (they might change to depending on your HPC):

cd $WDIR
module swap craype-network-ofi craype-network-ucx
module swap cray-mpich cray-mpich-ucx
module load cray-hdf5-parallel/1.12.0.7
module load cray-netcdf-hdf5parallel/4.7.4.7

Download XIOS:

svn checkout http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/branchs/xios-2.5 $XIOS_DIR
cd $XIOS_DIR

Copy over the necessary arch files and compile:

cp $GITCLONE/XIOS_ARCH/arch-X86_ARCHER2-Cray.* arch/.
./make_xios --prod --arch X86_ARCHER2-Cray --netcdf_lib netcdf4_par --full --job 4

Note, the first time will fail. You will have to change the FC flag in $XIOS_DIR/tools/FCM/lib/Fcm/Config.pm and recompile:

sed -i "s/FC_MODSEARCH => ''/FC_MODSEARCH => '-J'/g" tools/FCM/lib/Fcm/Config.pm

./make_xios --prod --arch X86_ARCHER2-Cray --netcdf_lib netcdf4_par --full --job 4
cd $SCRIPTS

Compiling NEMO

The script to compile NEMO is similar to the one used for building XIOS. Open the make_nemo.sh script and download NEMO:

cd $WDIR
svn co http://forge.ipsl.jussieu.fr/nemo/svn/NEMO/branches/UKMO/NEMO_4.0.4_mirror NEMO_4.0.4

Comment out this download line after it has been download (to avoid overwriting files).

Load modules (these may change depending on your HPC):

module load craype-network-ucx
module load cray-mpich-ucx
module load cray-hdf5-parallel/1.12.0.7
module load cray-netcdf-hdf5parallel/4.7.4.7

Then copy over the arch file for your HPC and edit some of the configuration parameters:

cp $GITCLONE/NEMO_ARCH/arch-X86_ARCHER2-Cray.fcm $NEMO/arch/arch-X86_ARCHER2-Cray.fcm

cd $NEMO
sed -i "s/FC_MODSEARCH => ''/FC_MODSEARCH => '-J'/g" ext/FCM/lib/Fcm/Config.pm

Compile NEMO:

cd $NEMO
./makenemo -n $CONFIG -r AMM12  -m X86_ARCHER2-Cray -j 16

Copy over the keys and the MY_SRC directory (both of these are configured for the SANH model configuration):

cd $CDIR/$CONFIG
cp $GITCLONE/cpp_SANH.fcm cpp_$CONFIG.fcm
cp -r -f $GITCLONE/MY_SRC ./

Finally, clean and recompile NEMO with the updates included:

cd $NEMO
./makenemo -r $CONFIG -m X86_ARCHER2-Cray -j 16 clean
./makenemo -r $CONFIG -m X86_ARCHER2-Cray -j 16
cd $SCRIPTS

Installing miniconda

Miniconda is needed for python preprocessing, specifically for using PyNEMO (for generation of the boundary conditions).

To install miniconda, use the script make_miniconda.sh (link tested Jul 2022):

cd $WORK
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod u+x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh

When prompted, set the installation path to '/work/n01/n01/$USER/miniconda3'.

Just before initialization, allow it modify the PYTHONPATH in .bashrc when prompted. This path should then be shown as modified in the initialization overview when finished.

Compiling the NEMO tools

To compile the NEMO tools, use the script: 'make_tools.sh'.

First, load the modules (these will vary depending on your machine), and copy over an edited DOMAINzgr source code file (adjusted to include more varied vertical coordinates) into the NEMO tools directory:

module swap craype-network-ofi craype-network-ucx
module swap cray-mpich cray-mpich-ucx
module load cray-hdf5-parallel/1.12.0.7
module load cray-netcdf-hdf5parallel/4.7.4.7

cp $EXTRA/DOMAIN/domzgr.f90.melange $TDIR/DOMAINcfg/src/domzgr.f90

Then, apply the necessary patches to the weight file code:

cd $NEMO/tools/WEIGHTS/src
patch -b < $EXTRA/patch_files/scripinterp_mod.patch
patch -b < $EXTRA/patch_files/scripinterp.patch
patch -b < $EXTRA/patch_files/scrip.patch
patch -b < $EXTRA/patch_files/scripshape.patch
patch -b < $EXTRA/patch_files/scripgrid.patch

And finally compile the NEMO tools:

cd $NEMO/tools
./maketools -m X86_ARCHER2-Cray -n NESTING
./maketools -m X86_ARCHER2-Cray -n REBUILD_NEMO
./maketools -m X86_ARCHER2-Cray -n WEIGHTS
./maketools -m X86_ARCHER2-Cray -n DOMAINcfg

cd $SCRIPTS

Clone this wiki locally