Rate This Document
Findability
Accuracy
Completeness
Readability

Running and Verification

Single Node

  1. Use PuTTY to log in to the server as the root user.
  2. Modify the config_machines.xml file.
    1. Open the config_machines.xml file.
      vi /path/to/CESM/CESM-release-cesm2.1.3/cime/config/cesm/machines/config_machines.xml
    2. Press i to enter the edit mode and modify the following information in bold:
      <machine MACH="centos7-linux">
      <DESC>
      Example port to centos7 linux system with gcc, netcdf, pnetcdf and mpich
      using modules from http://www.admin-magazine.com/HPC/Articles/Environment-Modules
      </DESC>
      <NODENAME_REGEX>n2</NODENAME_REGEX>
      <OS>LINUX</OS>
      <PROXY> https://howto.get.out </PROXY>
      <COMPILERS>gnu</COMPILERS>
      <MPILIBS>openmpi</MPILIBS>
      <PROJECT>none</PROJECT>
      <SAVE_TIMING_DIR> </SAVE_TIMING_DIR>
      <CIME_OUTPUT_ROOT>/CESMroot/cesm/scratch</CIME_OUTPUT_ROOT>
      <DIN_LOC_ROOT>/CESMroot/cesm/inputdata</DIN_LOC_ROOT>
      <DIN_LOC_ROOT_CLMFORC>/CESMroot/cesm/inputdata/lmwg</DIN_LOC_ROOT_CLMFORC>
      <DOUT_S_ROOT>/CESMroot/cesm/archive/$CASE</DOUT_S_ROOT>
      <BASELINE_ROOT>/CESMroot/cesm/cesm_baselines</BASELINE_ROOT>
      <CCSM_CPRNC>/CESMroot/cesm/tools/cime/tools/cprnc/cprnc</CCSM_CPRNC>
      <GMAKE>make</GMAKE>
      <GMAKE_J>8</GMAKE_J>
      <BATCH_SYSTEM>none</BATCH_SYSTEM>
      <SUPPORTED_BY>me@my.address</SUPPORTED_BY>
      <MAX_TASKS_PER_NODE>96</MAX_TASKS_PER_NODE>
      <MAX_MPITASKS_PER_NODE>96</MAX_MPITASKS_PER_NODE>
      <PROJECT_REQUIRED>FALSE</PROJECT_REQUIRED>
      <mpirun mpilib="default">
      <executable>mpirun</executable>
      <arguments>
      <arg name="ntasks">--allow-run-as-root --mca btl ^openib -np {{ total_tasks }} </arg>
      </arguments>
      </mpirun>
      <module_system type="module" allow_error="true">
      <init_path lang="perl">/usr/share/Modules/init/perl.pm</init_path>
      <init_path lang="python">/usr/share/Modules/init/python.py</init_path>
      <init_path lang="csh">/usr/share/Modules/init/csh</init_path>
      <init_path lang="sh">/usr/share/Modules/init/sh</init_path>
      <cmd_path lang="perl">/usr/bin/modulecmd perl</cmd_path>
      <cmd_path lang="python">/usr/bin/modulecmd python</cmd_path>
      <cmd_path lang="sh">module</cmd_path>
      <cmd_path lang="csh">module</cmd_path>
      <modules>
      <command name="purge"/>
      </modules>
      </module_system>
      <environment_variables>
      <env name="NETCDF_PATH">/path/to/NETCDF</env>
      <env name="NETCDF_FORTRAN_PATH">/path/to/NETCDF</env>
      <env name="NETCDF_C_PATH">/path/to/NETCDF</env>
      <env name="MPI_PATH">/path/to/HMPI</env>
      <env name="OMP_STACKSIZE">256M</env>
      </environment_variables>
      <resource_limits>
      <resource name="RLIMIT_STACK">-1</resource>
      </resource_limits>
      </machine>
      Table 1 Parameters in the config_machines.xml file

      Parameter

      Description

      <NODENAME_REGEX>

      Set this parameter based on the actual node names.

      <COMPILERS>

      Set it to GNU.

      <MPILIBS>

      Set it to OpenMPI.

      <MAX_TASKS_PER_NODE>

      The maximum value is the total number of CPU cores on the node.

      <MAX_MPITASKS_PER_NODE>

      The maximum value is the total number of CPU cores on the node.

      <executable>

      The default value is mpiexec. You need to change it to mpirun.

      <arguments>

      Set it to --allow-run-as-root --mca btl ^openib -np {{ total_tasks }}. The system automatically generates the total number of threads.

      <environment_variables>

      Set the dependency function path based on the installation location.

      <CIME_OUTPUT_ROOT>

      <DIN_LOC_ROOT>

      <DIN_LOC_ROOT_CLMFORC>

      <DOUT_S_ROOT>

      <BASELINE_ROOT>

      <CCSM_CPRNC>

      The default value is $ENV{HOME}, which indicates the actual CESM data directory.

      Change the paths based on Table 1.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  3. Modify the config_compilers.xml file.
    1. Open the config_compilers.xml file.
      vi /path/to/CESM/CESM-cesm2.1.3/cime/config/cesm/machines/config_compilers.xml
    2. Press i to enter the edit mode and modify the following information in bold:
      <compiler COMPILER="gnu">
      <CFLAGS>
      <base>  -O3 -mcpu=tsv110 -Hx,54,0x08 </base>
      <append compile_threaded="true"> -fopenmp </append>
      <append DEBUG="TRUE"> -g -Wall -Og -fbacktrace -ffpe-trap=invalid,zero,overflow -fcheck=bounds </append>
      <append DEBUG="FALSE"> -O </append>
      </CFLAGS>
      <CPPDEFS>
      <!-- http://gcc.gnu.org/onlinedocs/gfortran/ -->
      <append> -DFORTRANUNDERSCORE -DNO_R16 -DCPRGNU</append>
      </CPPDEFS>
      <CXX_LINKER>FORTRAN</CXX_LINKER>
      <FC_AUTO_R8>
      <base> -fdefault-real-8 </base>
      </FC_AUTO_R8>
      <FFLAGS>
      <!-- -ffree-line-length-none and -ffixed-line-length-none need to be in FFLAGS rather than in FIXEDFLAGS/FREEFLAGS
      so that these are passed to cmake builds (cmake builds don't use FIXEDFLAGS and FREEFLAGS). -->
      <base>  -fconvert=big-endian -O3 -mcpu=tsv110 -Hx,54,0x08 -I/path/to/NETCDF/include -I/path/to/HDF5/include -I/path/to/OPENBLAS/include </base>
      <append compile_threaded="true"> -fopenmp </append>
      <!-- Ideally, we would also have 'invalid' in the ffpe-trap list. But at
      least with some versions of gfortran (confirmed with 5.4.0, 6.3.0 and
      7.1.0), gfortran's isnan (which is called in cime via the
      CPRGNU-specific shr_infnan_isnan) causes a floating point exception
      when called on a signaling NaN. -->
      <append DEBUG="TRUE"> -g -Wall -Og -fbacktrace -ffpe-trap=zero,overflow -fcheck=bounds </append>
      <append DEBUG="FALSE"> -O </append>
      </FFLAGS>
      <FFLAGS_NOOPT>
      <base> -O0 </base>
      </FFLAGS_NOOPT>
      <FIXEDFLAGS>
      <base>  -ffixed-form </base>
      </FIXEDFLAGS>
      <FREEFLAGS>
      <base> -ffree-form </base>
      </FREEFLAGS>
      <HAS_F2008_CONTIGUOUS>FALSE</HAS_F2008_CONTIGUOUS>
      <LDFLAGS>
      <append compile_threaded="true"> -fopenmp -L/path/to/NETCDF/lib  -L/path/to/HDF5/lib -L/path/to/OPENBLAS/lib -lopenblas -lnetcdff -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -lm –lz </append>
      </LDFLAGS>
      <MPICC> /path/to/HMPI/bin/mpicc  </MPICC>
      <MPICXX> /path/to/HMPI/bin/mpicxx </MPICXX>
      <MPIFC> /path/to/HMPI/bin/mpifort </MPIFC>
      <SCC> /path/to/bisheng/bin/clang </SCC>
      <SCXX> /path/to/bisheng/bin/clang++ </SCXX>
      <SFC> /path/to/bisheng/bin/flang </SFC>
      <SUPPORTS_CXX>TRUE</SUPPORTS_CXX>
      <SLIBS>
      <append> -L/path/to/NETCDF/lib -L/path/to/HDF5/lib -L/path/to/OPENBLAS/lib -lopenblas -lnetcdff -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -lm –lz </append>
      </SLIBS>
      Table 2 Parameters in the config_compilers.xml file

      Parameter

      Description

      <CFLAGS>

      Add the -mcpu=tsv110 parameter.

      <FFLAGS>

      Add the -mcpu=tsv110 parameter and link the include paths of all dependency libraries.

      <MPICC>

      Specifies the mpicc path of Hyper MPI.

      <MPICXX>

      Specifies the mpicxx location of Hyper MPI.

      <MPIFC>

      Specifies the mpifort location of Hyper MPI.

      <SCC>

      Specifies the clang path of the BiSheng Compiler.

      <SCXX>

      Specifies the clang++ path of the BiSheng Compiler.

      <SFC>

      Specifies the flang path of the BiSheng Compiler.

      <LDFLAGS>

      Use the -L parameter to link all dependency libraries.

      <SLIBS>

      Use the -L parameter to link all dependency libraries.

      Change the paths based on Table 2.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Go to the working directory.
    cd /path/to/CESM/CESM-cesm2.1.3/cime/scripts
  5. Create a test case.
    ./create_newcase --case mycase --compset X --res f19_g16 --mach=centos7-linux

    The operation is successful if the following information in is displayed:

  6. Download the input data. No offline test case packages are involved. All components are automatically downloaded based on the command line.
    cd mycase
    ./check_case
    ./check_input_data --download

    After a module is successfully downloaded, SUCCESS is displayed. You do not need to perform any operations before the whole download process automatically completes.

  7. Start the CESM program.
    ./case.setup

    The operation is successful if the following information in is displayed:

  8. Check the compilation options in the Macro.make file. The compilation options in the Macro.make file must be the same as those in the config_compilers.xml file. The options are <CFLAGS>, <FFLAGS>, <MPICC>, <MPICXX>, <MPIFC>, <SCC>, <SCXX>, <SFC>, <LDFLAGS>, and <SLIBS>.
    SUPPORTS_CXX := FALSE
    ifeq ($(COMPILER),gnu)
    FC_AUTO_R8 :=  -fdefault-real-8
    HAS_F2008_CONTIGUOUS := FALSE
    FFLAGS_NOOPT :=  -O0
    SUPPORTS_CXX := TRUE
    FFLAGS :=   -fconvert=big-endian -O3 -mcpu=tsv110 -Hx,54,0x08 -I/path/to/NETCDF/include -I/path/to/HDF5/include -I/path/to/OPENBLAS/include
    FIXEDFLAGS :=   -ffixed-form
    SCC :=  /path/to/bisheng/bin/clang
    SFC :=  /path/to/bisheng/bin/flang
    MPICC :=  /path/to/HMPI/bin/mpicc
    CFLAGS :=   -O3 -mcpu=tsv110 -Hx,54,0x08
    MPIFC :=  /path/to/HMPI/bin/mpifort
    MPICXX :=  /path/to/HMPI/bin/mpicxx
    FREEFLAGS :=  -ffree-form
    CXX_LINKER := FORTRAN
    SCXX :=  /path/to/bisheng/bin/clang++
    endif
    ifeq ($(MODEL),pop)
    CPPDEFS := $(CPPDEFS)  -D_USE_FLOW_CONTROL
    endif
    ifeq ($(COMPILER),gnu)
    CPPDEFS := $(CPPDEFS)  -DFORTRANUNDERSCORE -DNO_R16 -DCPRGNU
    SLIBS := $(SLIBS)  -L/path/to/NETCDF/lib -L/path/to/HDF5/lib -L/path/to/OPENBLAS/lib -lopenblas -lnetcdff -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -lm -lz
    ifeq ($(compile_threaded),true)
    FFLAGS := $(FFLAGS)  -fopenmp
    CFLAGS := $(CFLAGS)  -fopenmp
    endif
    ifeq ($(DEBUG),TRUE)
    FFLAGS := $(FFLAGS)  -g -Wall -Og -fbacktrace -ffpe-trap=zero,overflow -fcheck=bounds
    CFLAGS := $(CFLAGS)  -g -Wall -Og -fbacktrace -ffpe-trap=invalid,zero,overflow -fcheck=bounds
    endif
    ifeq ($(DEBUG),FALSE)
    FFLAGS := $(FFLAGS)  -O
    CFLAGS := $(CFLAGS)  -O
    endif
    ifeq ($(compile_threaded),true)
    LDFLAGS := $(LDFLAGS)  -L/path/to/NETCDF/lib -L/path/to/HDF5/lib -L/path/to/OPENBLAS/lib -lopenblas -lnetcdff -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -lm -lz
    endif
    endif
  9. Modify the CESM-cesm2.1.3/cime/src/share/util/shr_infnan_mod.F90.in file.
    1. Open the CESM-cesm2.1.3/cime/src/share/util/shr_infnan_mod.F90.in file.
      vi /path/to/CESM/CESM-cesm2.1.3/cime/src/share/util/shr_infnan_mod.F90.in
    2. Press i to enter the edit mode and modify the content in line 227, as shown by the cursor in the following figure:

      After performing 9.a, press Esc, type :set nu, and press Enter to display the line number.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  10. Modify the CESM-release-cesm2.1.3/cime/src/share/util/shr_sys_mod.F90 file.
    1. Open the CESM-release-cesm2.1.3/cime/src/share/util/shr_sys_mod.F90 file.
      vi /path/to/CESM/CESM-cesm2.1.3/cime/src/share/util/shr_sys_mod.F90
    2. Press i to enter the edit mode and modify the file as follows:

      Delete the exclamation mark (!) before defined CPRGNU in line 70.

      Delete the exclamation mark (!) before defined CPRGNU in line 115.

      After performing 10.a, press Esc, type :set nu, and press Enter to display the line number.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  11. Build the cesm.exe file.
    • Method 1:
      ./case.build --skip-provenance-check
    • Method 2:
      ./case.build

      The operation is successful if the following information in is displayed:

      You need to soft link CMake3 in the system to CMake and specify the CMake path. If you are the root user and the CMake version is 3.0 or later, ignore ln -sf /usr/bin/cmake3 /usr/bin/cmake.

      ln -sf /usr/bin/cmake3 /usr/bin/cmake
  12. Execute cesm.exe.
    ./case.submit

    If the information shown in the following figure is displayed when the CESM program is complete, the CESM program completes properly.

    View the logs displayed on the screen and manually calculate the time difference. A smaller value indicates higher performance. As shown in the following figure, the start time is 2021-10-20 16:19:28 and the end time is 2021-10-20 16:20:02. Therefore, the execution duration of the test case is 34s.

Multiple Nodes

  1. Use PuTTY to log in to the server as the root user.
  2. Modify the config_machines.xml file.
    1. Open the config_machines.xml file.
      vi /path/to/CESM/CESM-cesm2.1.3/cime/config/cesm/machines/config_machines.xml
    2. Press i to enter the edit mode and modify the following information in bold:
      <machine MACH="centos7-linux">
      <DESC>
      Example port to centos7 linux system with gcc, netcdf, pnetcdf and mpich
      using modules from http://www.admin-magazine.com/HPC/Articles/Environment-Modules
      </DESC>
      <NODENAME_REGEX>n2</NODENAME_REGEX>
      <OS>LINUX</OS>
      <PROXY> https://howto.get.out </PROXY>
      <COMPILERS>gnu</COMPILERS>
      <MPILIBS>openmpi</MPILIBS>
      <PROJECT>none</PROJECT>
      <SAVE_TIMING_DIR> </SAVE_TIMING_DIR>
      <CIME_OUTPUT_ROOT>/CESMroot/cesm/scratch</CIME_OUTPUT_ROOT>
      <DIN_LOC_ROOT>/CESMroot/cesm/inputdata</DIN_LOC_ROOT>
      <DIN_LOC_ROOT_CLMFORC>/CESMroot/cesm/inputdata/lmwg</DIN_LOC_ROOT_CLMFORC>
      <DOUT_S_ROOT>/CESMroot/cesm/archive/$CASE</DOUT_S_ROOT>
      <BASELINE_ROOT>/CESMroot/cesm/cesm_baselines</BASELINE_ROOT>
      <CCSM_CPRNC>/CESMroot/cesm/tools/cime/tools/cprnc/cprnc</CCSM_CPRNC>
      <GMAKE>make</GMAKE>
      <GMAKE_J>8</GMAKE_J>
      <BATCH_SYSTEM>none</BATCH_SYSTEM>
      <SUPPORTED_BY>me@my.address</SUPPORTED_BY>
      <MAX_TASKS_PER_NODE>96</MAX_TASKS_PER_NODE>
      <MAX_MPITASKS_PER_NODE>96</MAX_MPITASKS_PER_NODE>
      <PROJECT_REQUIRED>FALSE</PROJECT_REQUIRED>
      <mpirun mpilib="default">
      <executable>mpirun</executable>
      <arguments>
      <arg name="ntasks">--allow-run-as-root --mca btl ^openib --machinefile path/to/machinefile -np 192 -N 96 -x PATH=/path/to/bisheng/bin:/path/to/HMPI/bin:/path/to/NETCDF/bin:$PATH -x LD_LIBRARY_PATH=/path/to/bisheng/lib:/path/to/HMPI/lib:/path/to/NETCDF/lib:$LD_LIBRARY_PATH </arg>
      </arguments>
      </mpirun>
      <module_system type="module" allow_error="true">
      <init_path lang="perl">/usr/share/Modules/init/perl.pm</init_path>
      <init_path lang="python">/usr/share/Modules/init/python.py</init_path>
      <init_path lang="csh">/usr/share/Modules/init/csh</init_path>
      <init_path lang="sh">/usr/share/Modules/init/sh</init_path>
      <cmd_path lang="perl">/usr/bin/modulecmd perl</cmd_path>
      <cmd_path lang="python">/usr/bin/modulecmd python</cmd_path>
      <cmd_path lang="sh">module</cmd_path>
      <cmd_path lang="csh">module</cmd_path>
      <modules>
      <command name="purge"/>
      </modules>
      </module_system>
      <environment_variables>
      <env name="NETCDF_PATH">/path/to/NETCDF </env>
      <env name="NETCDF_FORTRAN_PATH">/path/to/NETCDF</env>
      <env name="NETCDF_C_PATH">/path/to/NETCDF</env>
      <env name="MPI_PATH">/path/to/HMPI/env>
      <env name="OMP_STACKSIZE">256M</env>
      </environment_variables>
      <resource_limits>
      <resource name="RLIMIT_STACK">-1</resource>
      </resource_limits>
      </machine>
      Table 3 Parameters in the config_machines.xml file

      Parameter

      Description

      <NODENAME_REGEX>

      Set this parameter based on the actual node names.

      <COMPILERS>

      Set it to GNU.

      <MPILIBS>

      Set it to OpenMPI.

      <MAX_TASKS_PER_NODE>

      The maximum value is the total number of CPU cores on the node.

      <MAX_MPITASKS_PER_NODE>

      The maximum value is the total number of CPU cores on the node.

      <executable>

      The default value is mpiexec. You need to change it to mpirun.

      <arguments>

      In a multi-node scenario, change the value of ntasks. For example, if two nodes with 96 cores each are used, set the total number of processes ntasks to 96 x 2 = 192. The value of -np is 192 and the value of -N (processes on each node) is 96. To run multiple nodes at the same time, add the compiler path and dependency library path. Separate the paths using the -x parameter.

      <environment_variables>

      Set the dependency function path based on the installation location.

      <CIME_OUTPUT_ROOT>

      <DIN_LOC_ROOT>

      <DIN_LOC_ROOT_CLMFORC>

      <DOUT_S_ROOT>

      <BASELINE_ROOT>

      <CCSM_CPRNC>

      The default value is $ENV{HOME}, which indicates the actual CESM data directory.

      Change the paths based on Table 3.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  3. Modify the config_compilers.xml file.
    1. Open the config_compilers.xml file.
      vi /path/to/CESM/CESM-cesm2.1.3/cime/config/cesm/machines/config_compiler.xml
    2. Press i to enter the edit mode and modify the following information in bold:
      <compiler COMPILER="gnu">
      <CFLAGS>
      <base>  -O3 -mcpu=tsv110 -Hx,54,0x08 </base>
      <append compile_threaded="true"> -fopenmp </append>
      <append DEBUG="TRUE"> -g -Wall -Og -fbacktrace -ffpe-trap=invalid,zero,overflow -fcheck=bounds </append>
      <append DEBUG="FALSE"> -O </append>
      </CFLAGS>
      <CPPDEFS>
      <!-- http://gcc.gnu.org/onlinedocs/gfortran/ -->
      <append> -DFORTRANUNDERSCORE -DNO_R16 -DCPRGNU</append>
      </CPPDEFS>
      <CXX_LINKER>FORTRAN</CXX_LINKER>
      <FC_AUTO_R8>
      <base> -fdefault-real-8 </base>
      </FC_AUTO_R8>
      <FFLAGS>
      <!-- -ffree-line-length-none and -ffixed-line-length-none need to be in FFLAGS rather than in FIXEDFLAGS/FREEFLAGS
      so that these are passed to cmake builds (cmake builds don't use FIXEDFLAGS and FREEFLAGS). -->
      <base>  -fconvert=big-endian -O3 -mcpu=tsv110 -Hx,54,0x08 -I/path/to/NETCDF/include -I/path/to/HDF5/include -I/path/to/OPENBLAS/include </base>
      <append compile_threaded="true"> -fopenmp </append>
      <!-- Ideally, we would also have 'invalid' in the ffpe-trap list. But at
      least with some versions of gfortran (confirmed with 5.4.0, 6.3.0 and
      7.1.0), gfortran's isnan (which is called in cime via the
      CPRGNU-specific shr_infnan_isnan) causes a floating point exception
      when called on a signaling NaN. -->
      <append DEBUG="TRUE"> -g -Wall -Og -fbacktrace -ffpe-trap=zero,overflow -fcheck=bounds </append>
      <append DEBUG="FALSE"> -O </append>
      </FFLAGS>
      <FFLAGS_NOOPT>
      <base> -O0 </base>
      </FFLAGS_NOOPT>
      <FIXEDFLAGS>
      <base>  -ffixed-form </base>
      </FIXEDFLAGS>
      <FREEFLAGS>
      <base> -ffree-form </base>
      </FREEFLAGS>
      <HAS_F2008_CONTIGUOUS>FALSE</HAS_F2008_CONTIGUOUS>
      <LDFLAGS>
      <append compile_threaded="true"> -fopenmp -L/path/to/NETCDF/lib -L/path/to/HDF5/lib -L/path/to/OPENBLAS/lib -lopenblas -lnetcdff -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -lm –lz </append>
      </LDFLAGS>
      <MPICC> /path/to/HMPI/bin/mpicc  </MPICC>
      <MPICXX> /path/to/HMPI/bin/mpicxx </MPICXX>
      <MPIFC> /path/to/HMPI/bin/mpifort </MPIFC>
      <SCC> /path/to/bisheng/bin/clang </SCC>
      <SCXX> /path/to/bisheng/bin/clang++ </SCXX>
      <SFC> /path/to/bisheng/bin/flang </SFC>
      <SUPPORTS_CXX>TRUE</SUPPORTS_CXX>
      <SLIBS>
      <append> -L/path/to/NETCDF/lib -L/path/to/HDF5/lib -L/path/to/OPENBLAS/lib -lopenblas -lnetcdff -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -lm -lz </append>
      </SLIBS>
      Table 4 Parameters in the config_compilers.xml file

      Parameter

      Description

      <CFLAGS>

      Add the -mcpu=tsv110 parameter.

      <FFLAGS>

      Add the -mcpu=tsv110 parameter and link the include paths of all dependency libraries.

      <MPICC>

      Specifies the mpicc path of Hyper MPI.

      <MPICXX>

      Specifies the mpicxx location of Hyper MPI.

      <MPIFC>

      Specifies the mpifort location of Hyper MPI.

      <SCC>

      Specifies the clang path of the BiSheng Compiler.

      <SCXX>

      Specifies the clang++ path of the BiSheng Compiler.

      <SFC>

      Specifies the flang path of the BiSheng Compiler.

      <LDFLAGS>

      Use the -L parameter to link all dependency libraries.

      <SLIBS>

      Use the -L parameter to link all dependency libraries.

      Change the paths based on Table 4.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Go to the working directory.
    cd /path/to/CESM/CESM-cesm2.1.3/cime/scripts
  5. Create a test case.
    ./create_newcase --case mycase --compset X --res f19_g16 --mach=centos7-linux

    Information similar to the following is displayed:

  6. Download the input data.
    cd mycase
    ./check_case
    ./check_input_data --download

    After a module is successfully downloaded, SUCCESS is displayed. You do not need to perform any operations before the whole download process automatically completes.

  7. Start the CESM program.
    ./case.setup
  8. Check the compilation options in the Macro.make file. The compilation options in the Macro.make file must be the same as those in the config_compilers.xml file. The options are <CFLAGS>, <FFLAGS>, <MPICC>, <MPICXX>, <MPIFC>, <SCC>, <SCXX>, <SFC>, <LDFLAGS>, and <SLIBS>.
    SUPPORTS_CXX := FALSE
    ifeq ($(COMPILER),gnu)
    FC_AUTO_R8 :=  -fdefault-real-8
    HAS_F2008_CONTIGUOUS := FALSE
    FFLAGS_NOOPT :=  -O0
    SUPPORTS_CXX := TRUE
    FFLAGS :=   -fconvert=big-endian -O3 -mcpu=tsv110 -Hx,54,0x08 -I/path/to/NETCDF/include -I/path/to/HDF5/include -I/path/to/OPENBLAS/include
    FIXEDFLAGS :=   -ffixed-form
    SCC :=  /path/to/bisheng/bin/clang
    SFC :=  /path/to/bisheng/bin/flang
    MPICC :=  /path/to/HMPI/bin/mpicc
    CFLAGS :=   -O3 -mcpu=tsv110 -Hx,54,0x08
    MPIFC :=  /path/to/HMPI/bin/mpifort
    MPICXX :=  /path/to/HMPI/bin/mpicxx
    FREEFLAGS :=  -ffree-form
    CXX_LINKER := FORTRAN
    SCXX :=  /path/to/bisheng/bin/clang++
    endif
    ifeq ($(MODEL),pop)
    CPPDEFS := $(CPPDEFS)  -D_USE_FLOW_CONTROL
    endif
    ifeq ($(COMPILER),gnu)
    CPPDEFS := $(CPPDEFS)  -DFORTRANUNDERSCORE -DNO_R16 -DCPRGNU
    SLIBS := $(SLIBS)  -L/path/to/NETCDF/lib -L/path/to/HDF5/lib -L/path/to/OPENBLAS/lib -lopenblas -lnetcdff -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -lm -lz
    ifeq ($(compile_threaded),true)
    FFLAGS := $(FFLAGS)  -fopenmp
    CFLAGS := $(CFLAGS)  -fopenmp
    endif
    ifeq ($(DEBUG),TRUE)
    FFLAGS := $(FFLAGS)  -g -Wall -Og -fbacktrace -ffpe-trap=zero,overflow -fcheck=bounds
    CFLAGS := $(CFLAGS)  -g -Wall -Og -fbacktrace -ffpe-trap=invalid,zero,overflow -fcheck=bounds
    endif
    ifeq ($(DEBUG),FALSE)
    FFLAGS := $(FFLAGS)  -O
    CFLAGS := $(CFLAGS)  -O
    endif
    ifeq ($(compile_threaded),true)
    LDFLAGS := $(LDFLAGS)  -L/path/to/NETCDF/lib -L/path/to/HDF5/lib -L/path/to/OPENBLAS/lib -lopenblas -lnetcdff -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -lm -lz
    endif
    endif
  9. Modify the CESM-cesm2.1.3/cime/src/share/util/shr_infnan_mod.F90.in file.
    1. Open the CESM-cesm2.1.3/cime/src/share/util/shr_infnan_mod.F90.in file.
      vi /path/to/CESM/CESM-cesm2.1.3/cime/src/share/util/shr_infnan_mod.F90.in
    2. Press i to enter the edit mode and modify the content in line 227, as shown by the cursor in the following figure:

      After performing 9.a, press Esc, type :set nu, and press Enter to display the line number.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  10. Modify the CESM-release-cesm2.1.3/cime/src/share/util/shr_sys_mod.F90 file.
    1. Open the CESM-release-cesm2.1.3/cime/src/share/util/shr_sys_mod.F90 file.
      vi /path/to/CESM/CESM-cesm2.1.3/cime/src/share/util/shr_sys_mod.F90
    2. Press i to enter the edit mode and modify the file as follows:

      Delete the exclamation mark (!) before defined CPRGNU in line 70.

      Delete the exclamation mark (!) before defined CPRGNU in line 115.

      After performing 10.a, press Esc, type :set nu, and press Enter to display the line number.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  11. Build the cesm.exe file.
    • Method 1:
      ./case.build --skip-provenance-check
    • Method 2:
      ./case.build

      The operation is successful if the following information in is displayed:

      You need to soft link CMake3 in the system to CMake and specify the CMake path. If you are the root user and the CMake version is 3.0 or later, ignore ln -sf /usr/bin/cmake3 /usr/bin/cmake.

      ln -sf /usr/bin/cmake3 /usr/bin/cmake
  12. Execute cesm.exe.
    ./case.submit

    If the information shown in the following figure is displayed when the CESM program is complete, the CESM program completes properly.

    View the logs displayed on the screen and manually calculate the time difference. A smaller value indicates higher performance. As shown in the following figure, in a dual-node scenario, the start time is 2021-10-22 20:27:51 and the end time is 2021-10-22 20:28:29. Therefore, the execution duration of the test case is 38s.