Skip to content

Compiling

Cheng Da edited this page Dec 10, 2020 · 9 revisions

Config files

The first step in compiling is to setup the configuration files in the in the config/ directory. The following files are needed:

  • makefile.mk - specifies the compiler options used during the build process for the CFS code
  • setenv.sh - specifies the environemnt and modules loaded, used during the build process as well as when running the model or scripts. user must run source setenv.sh in any new bash shell when run running or compiling the CFS.

These files need to exist by creating a symbolic link to one of the other existing machine depenent files (or by creating new ones using the exising files as a guide). E.g, on the Deepthought 2 computer, run the following from within config/:

ln -s makefile.dt2_intel.mk makefile.mk
ln -s setenv.dt2_intel.sh setenv.sh

Number of processors

The NPROC_OM and NPROC_AM environment variables in setenv.sh are responsible for determining the number of cores for the CFS. As configured for DT2, the coupler and ocean model run on one node using 1 and 19 cores, respectively, and the atmosphere model runs with 20 cores on another node. These setting will depend on the computer being used, but in general you'll want to make sure there are enough cores for the ocean model, if it has too few errors might occur.

For the data assimilation, NPROC_LETKF_O (cores for ocean LETKF) and NPROC_LETKF_A (cores for atmosphere LETKF) need to be set as well, and should be a multiple of the number of cores on each node of the supercomputer (NPROC_PERNODE)

Building CFSv2 and CFSv2-LETKF

To build the CFS and CFSv2-LETKF (assuming using a bash shell):

Setup the top-level environment

  • If not already done so in the current shell, run source config/setenv.sh

Setup the environment for the LETKF-MOM

Under /letkf-mom/config, change the variable MACHINE in machine.sh with your machine name, and then create 4 configuration files your_machine_name.fortran.sh, your_machine_name.mpi.sh, your_machine_name.obs.sh, and your_machine_name.netcdf.sh. You can create those based on the configuration files for Deepthought 2 (i.e., DT2.*.sh).

Configure the makefiles

The depenencies for the makefiles are automatically generated by the fmkmf script, this only needs to be done once. If you modify the code of the CFS-LETKF, you may have to run configure again to rebuild the dependencies

  • run ./configure

This runs the configuration scripts within /util, /letkf-mom, and /letkf-gfs. You can also directly run configure in any of those subdirectories if you need to rebuild only a certain part of the code.

Compiling

  • run make

This will run make within /lib-ncep, /cfs, /util, /letkf-gfs, /letkf-mom. You can also directly run make in any of those subdirectories if you need to build only certain parts of the code

Verify compilation

You can check to make sure the following end files are produced in the given directories if you want:

/lib-ncep

  • folders in /incmod: /gfsio_4 /landsfcutil_4 /landsfcutil_8 /landsfcutil_d /sfcio_4 /sigio_4
  • files in /lib: 18 files ending with .a, you should have seen erros during compiling if anything wasn't build

/cfs/bin/

  • executables: cfs_ocean_mom4ice, global_fcst, cfs_mlc_coupler, global_sfchdr, global_sighdr, global_cycle, global_chgres

/util/bin

  • executables: grd2ss, grdctl,ss2grd,ss2grdp,sscycle,sscycle2

/letkf-gfs:

  • files in /util: dec_prepbufr, grabbufr, superob
  • files in /letkf: letkf, mean, obsop

/letkf-mom:

  • files in /obs: obsop
  • files in /letkf: letkf

NOTE: using make in parallel build mode (i.e. make -j n) should work for most of the components. However, the original makefiles for the GFS do not have the dependencies defined correctly, so if there are build errors try rerunning make without parallel mode.

Next step in Getting Started: Downloading CFSR Data

Clone this wiki locally