Skip to content

Building model

Denise Worthen edited this page May 24, 2022 · 16 revisions

This page is under construction

How to build using build.sh from the top-level directory (ie, ufs-weather-model)

  • build.sh is a simple wrapper that calls CMake build system

1) load the required modules

  module use modulefiles
  module load ufs_${platform}.${compiler}
  • NOTE: On platform GAEA, you must first set up the lmod environment:
   source /lustre/f2/pdata/esrl/gsd/contrib/lua-5.1.4.9/init/init_lmod.sh

2) Build command, one line or multi-line

  • export before the call to build.sh, for example:
  export CMAKE_FLAGS="-DAPP=S2S -DCCPP_SUITES=FV3_GFS_2017_coupled,FV3_GFS_v16_coupled"
  ./build.sh
  • build using one-line command, several examples:

Build the ufs-weather-model ATM app (standalone ATM):

    CMAKE_FLAGS="-DAPP=ATM -DCCPP_SUITES=FV3_GFS_v16" ./build.sh > output 2>&1 &

Build the ufs-weather-model ATMW app (standalone ATM with waves):

    CMAKE_FLAGS="-DAPP=ATMW -DCCPP_SUITES=FV3_GFS_2017_coupled,FV3_GFS_v16_coupled" ./build.sh > output 2>&1 &

Build the ufs-weather-model S2S app (atm/ice/ocean):

    CMAKE_FLAGS="-DAPP=S2S -DCCPP_SUITES=FV3_GFS_2017_coupled,FV3_GFS_v16_coupled" ./build.sh > output 2>&1 &

Build the ufs-weather-model S2S app (coupled atm/ice/ocean) with debugging flags turned on, with verbose build messages, using a single build job and a specified build directory:

   CMAKE_FLAGS="-DAPP=S2S -DDEBUG=ON -DCCPP_SUITES=FV3_GFS_2017_coupled,FV3_GFS_2017_satmedmf_coupled,FV3_GFS_v15p2_coupled" BUILD_VERBOSE=1 BUILD_JOBS=1 
   BUILD_DIR=test_cpld ./build.sh > output 2>&1 &

Build the ufs-weather-model S2SW app (coupled atm/ice/ocean/waves):

   CMAKE_FLAGS="-DAPP=S2SW -DCCPP_SUITES=FV3_GFS_2017_coupled,FV3_GFS_2017_satmedmf_coupled,FV3_GFS_v15p2_coupled,FV3_GFS_v16beta_coupled" ./build.sh >output 2>&1 &

Build the ufs-weather-model NemsDATM app (NemsDATM/ocean/ice):

   CMAKE_FLAGS="-DAPP=DATM_NEMS" ./build.sh >output 2>&1 &

In each case, the executable will be build/ufs_model. The CCPP_SUITES file used must be an existing SDF. To be sure you are using a current SDF, reference the available options in tests/rt.conf or check the files located in FV3/ccpp/suites.

If you edit source code files, just run the same command again. CMake does not need to be cleaned (as much).

compile.sh

  • File location is ufs-weather-model/tests
  • Sets up environment variables and calls build.sh
  • Used by ufs-weather-model/tests/rt.sh
  • Most useful for debugging purposes, when repetitive compilation is desired for use within a sandbox (run directory).

How to feed build options to compile.sh

  • For examples, see the second column of rows that start with COMPILE in ufs-weather-model/tests/rt.conf
  • Specify components to build, e.g.,
    • -DAPP=ATM (include ATM)
    • -DAPP=ATMW (include ATM, WAVES)
    • -DAPP=ATMAERO (include ATM, GOCART)
    • -DAPP=S2S (include ATM, MOM6, CICE, CMEPS)
    • -DAPP=S2SW (include ATM, MOM6, CICE6, WAVES, CMEPS)
    • -DAPP=S2SWA (include ATM, MOM6, CICE6, WAVES, GOCART, CMEPS)
  • Specify CCPP suite name, e.g.,
    • -DCCPP_SUITES=FV3_GFS_v16
    • -DCCPP_SUITES=FV3_GFS_v16_coupled_p8
  • Build in debug mode
    • DDEBUG=ON
  • Putting build options together, e.g.,
    • -DCCPP_SUITES=FV3_GFS_v16_coupled_p8 -DAPP=S2SWA

Example:

./compile.sh hera.intel '-DAPP=S2SWA -DCCPP_SUITES=FV3_GFS_v16_coupled_nsstNoahmpUGWPv1,FV3_GFS_v17_coupled_p8' '' YES NO 2>&1 | tee compile.log

This will compile the S2SWA application on Hera using the Intel compiler and two SDFs. It will clean the entire build directory prior to starting compilation, but will not clean the build directory afterwards.

Clone this wiki locally