CESM

From Alliance Doc
Revision as of 22:51, 25 June 2024 by Shuber (talk | contribs) (change instructions to indicate local installation of CESM 2.1.5)
Jump to navigation Jump to search


This article is a draft

This is not a complete article: This is a draft, a work in progress that is intended to be published into an article, which may or may not be ready for inclusion in the main wiki. It should not necessarily be considered factual or authoritative.




Porting and Validating

The below configuration files and commands are designed for a local installation of CESM 2.1.5:

Before making the adaptations as described below, please download CESM 2.1.5 from the CESM developers.

Local machine file

  • Create and edit the file ~/.cime/config_machines.xml from the following minimal content per cluster:
    File : ~/.cime/config_machines.xml

    <?xml version="1.0"?>
    
    <config_machines version="2.0">
      <machine MACH="beluga">
        <DESC>https://docs.alliancecan.ca/wiki/Béluga/en</DESC>
        <NODENAME_REGEX>b[cegl].*.int.ets1.calculquebec.ca</NODENAME_REGEX>
    
        <OS>LINUX</OS>
        <COMPILERS>intel,gnu</COMPILERS>
        <MPILIBS>openmpi,intelmpi</MPILIBS>
    
        <PROJECT>def-EDIT_THIS</PROJECT>
        <CHARGE_ACCOUNT>def-EDIT_THIS</CHARGE_ACCOUNT>
    
        <CIME_OUTPUT_ROOT>/scratch/$USER</CIME_OUTPUT_ROOT>
        <DIN_LOC_ROOT>$ENV{CESMDATAROOT}/inputdata</DIN_LOC_ROOT>
        <DOUT_S_ROOT>$CIME_OUTPUT_ROOT/archive/$CASE</DOUT_S_ROOT>
    
        <BATCH_SYSTEM>slurm</BATCH_SYSTEM>
        <SUPPORTED_BY>support@tech.alliancecan.ca</SUPPORTED_BY>
        <MAX_TASKS_PER_NODE>40</MAX_TASKS_PER_NODE>
        <MAX_MPITASKS_PER_NODE>40</MAX_MPITASKS_PER_NODE>
        <PROJECT_REQUIRED>TRUE</PROJECT_REQUIRED>
    
        <mpirun mpilib="default">
          <executable>srun</executable>
        </mpirun>
      </machine>
    
      <default_run_suffix>
        <default_run_exe>${EXEROOT}/cesm.exe </default_run_exe>
        <default_run_misc_suffix> >> cesm.log.$LID 2>&amp;1 </default_run_misc_suffix>
      </default_run_suffix>
    </config_machines>
    


    File : ~/.cime/config_machines.xml

    <?xml version="1.0"?>
    
    <config_machines version="2.0">
      <machine MACH="cedar">
        <DESC>https://docs.alliancecan.ca/wiki/Cedar</DESC>
        <NODENAME_REGEX>c[de].*.computecanada.ca</NODENAME_REGEX>
    
        <OS>LINUX</OS>
        <COMPILERS>intel,gnu</COMPILERS>
        <MPILIBS>openmpi,intelmpi</MPILIBS>
    
        <PROJECT>def-EDIT_THIS</PROJECT>
        <CHARGE_ACCOUNT>def-EDIT_THIS</CHARGE_ACCOUNT>
    
        <CIME_OUTPUT_ROOT>/scratch/$USER</CIME_OUTPUT_ROOT>
        <DIN_LOC_ROOT>$ENV{CESMDATAROOT}/inputdata</DIN_LOC_ROOT>
        <DOUT_S_ROOT>$CIME_OUTPUT_ROOT/archive/$CASE</DOUT_S_ROOT>
    
        <BATCH_SYSTEM>slurm</BATCH_SYSTEM>
        <SUPPORTED_BY>support@tech.alliancecan.ca</SUPPORTED_BY>
        <MAX_TASKS_PER_NODE>48</MAX_TASKS_PER_NODE>
        <MAX_MPITASKS_PER_NODE>48</MAX_MPITASKS_PER_NODE>
        <PROJECT_REQUIRED>TRUE</PROJECT_REQUIRED>
    
        <mpirun mpilib="default">
          <executable>srun</executable>
        </mpirun>
      </machine>
    
      <default_run_suffix>
        <default_run_exe>${EXEROOT}/cesm.exe </default_run_exe>
        <default_run_misc_suffix> >> cesm.log.$LID 2>&amp;1 </default_run_misc_suffix>
      </default_run_suffix>
    </config_machines>
    


    File : ~/.cime/config_machines.xml

    <?xml version="1.0"?>
    
    <config_machines version="2.0">
      <machine MACH="graham">
        <DESC>https://docs.alliancecan.ca/wiki/Graham</DESC>
        <NODENAME_REGEX>gra.*</NODENAME_REGEX>
    
        <OS>LINUX</OS>
        <COMPILERS>intel,gnu</COMPILERS>
        <MPILIBS>openmpi,intelmpi</MPILIBS>
    
        <PROJECT>def-EDIT_THIS</PROJECT>
        <CHARGE_ACCOUNT>def-EDIT_THIS</CHARGE_ACCOUNT>
    
        <CIME_OUTPUT_ROOT>/scratch/$USER</CIME_OUTPUT_ROOT>
        <DIN_LOC_ROOT>$ENV{CESMDATAROOT}/inputdata</DIN_LOC_ROOT>
        <DOUT_S_ROOT>$CIME_OUTPUT_ROOT/archive/$CASE</DOUT_S_ROOT>
    
        <BATCH_SYSTEM>slurm</BATCH_SYSTEM>
        <SUPPORTED_BY>support@tech.alliancecan.ca</SUPPORTED_BY>
        <MAX_TASKS_PER_NODE>44</MAX_TASKS_PER_NODE>
        <MAX_MPITASKS_PER_NODE>44</MAX_MPITASKS_PER_NODE>
        <PROJECT_REQUIRED>TRUE</PROJECT_REQUIRED>
    
        <mpirun mpilib="default">
          <executable>srun</executable>
        </mpirun>
      </machine>
    
      <default_run_suffix>
        <default_run_exe>${EXEROOT}/cesm.exe </default_run_exe>
        <default_run_misc_suffix> >> cesm.log.$LID 2>&amp;1 </default_run_misc_suffix>
      </default_run_suffix>
    </config_machines>
    


    File : ~/.cime/config_machines.xml

    <?xml version="1.0"?>
    
    <config_machines version="2.0">
      <machine MACH="narval">
        <DESC>https://docs.alliancecan.ca/wiki/Narval/en</DESC>
        <NODENAME_REGEX>n[acgl].*.narval.calcul.quebec</NODENAME_REGEX>
    
        <OS>LINUX</OS>
        <COMPILERS>intel,gnu</COMPILERS>
        <MPILIBS>openmpi,intelmpi</MPILIBS>
    
        <PROJECT>def-EDIT_THIS</PROJECT>
        <CHARGE_ACCOUNT>def-EDIT_THIS</CHARGE_ACCOUNT>
    
        <CIME_OUTPUT_ROOT>/scratch/$USER</CIME_OUTPUT_ROOT>
        <DIN_LOC_ROOT>$ENV{CESMDATAROOT}/inputdata</DIN_LOC_ROOT>
        <DOUT_S_ROOT>$CIME_OUTPUT_ROOT/archive/$CASE</DOUT_S_ROOT>
    
        <BATCH_SYSTEM>slurm</BATCH_SYSTEM>
        <SUPPORTED_BY>support@tech.alliancecan.ca</SUPPORTED_BY>
        <MAX_TASKS_PER_NODE>64</MAX_TASKS_PER_NODE>
        <MAX_MPITASKS_PER_NODE>64</MAX_MPITASKS_PER_NODE>
        <PROJECT_REQUIRED>TRUE</PROJECT_REQUIRED>
    
        <mpirun mpilib="default">
          <executable>srun</executable>
        </mpirun>
      </machine>
    
      <default_run_suffix>
        <default_run_exe>${EXEROOT}/cesm.exe </default_run_exe>
        <default_run_misc_suffix> >> cesm.log.$LID 2>&amp;1 </default_run_misc_suffix>
      </default_run_suffix>
    </config_machines>
    


    File : ~/.cime/config_machines.xml

    <?xml version="1.0"?>
    
    <config_machines version="2.0">
      <machine MACH="niagara">
        <DESC>https://docs.alliancecan.ca/wiki/Niagara</DESC>
        <NODENAME_REGEX>nia.*.scinet.local</NODENAME_REGEX>
    
        <OS>LINUX</OS>
        <COMPILERS>intel,gnu</COMPILERS>
        <MPILIBS>openmpi,intelmpi</MPILIBS>
    
        <PROJECT>def-EDIT_THIS</PROJECT>
        <CHARGE_ACCOUNT>def-EDIT_THIS</CHARGE_ACCOUNT>
    
        <CIME_OUTPUT_ROOT>/scratch/$USER</CIME_OUTPUT_ROOT>
        <DIN_LOC_ROOT>$ENV{CESMDATAROOT}/inputdata</DIN_LOC_ROOT>
        <DOUT_S_ROOT>$CIME_OUTPUT_ROOT/archive/$CASE</DOUT_S_ROOT>
    
        <BATCH_SYSTEM>slurm</BATCH_SYSTEM>
        <SUPPORTED_BY>support@tech.alliancecan.ca</SUPPORTED_BY>
        <MAX_TASKS_PER_NODE>40</MAX_TASKS_PER_NODE>
        <MAX_MPITASKS_PER_NODE>40</MAX_MPITASKS_PER_NODE>
        <PROJECT_REQUIRED>TRUE</PROJECT_REQUIRED>
    
        <mpirun mpilib="default">
          <executable>srun</executable>
        </mpirun>
      </machine>
    
      <default_run_suffix>
        <default_run_exe>${EXEROOT}/cesm.exe </default_run_exe>
        <default_run_misc_suffix> >> cesm.log.$LID 2>&amp;1 </default_run_misc_suffix>
      </default_run_suffix>
    </config_machines>
    


  • Validate your XML machine file with the following commands:
    [name@server ~]$ xmllint --noout --schema $EBROOTCESM/cime/config/xml_schemas/config_machines.xsd ~/.cime/config_machines.xml
    /home/name/.cime/config_machines.xml validates
    
    [name@beluga ~]$ query_config --machines current
    beluga (current) : https://docs.alliancecan.ca/wiki/Béluga/en
          os              LINUX
          compilers       intel,gnu
          pes/node        40
          max_tasks/node  40
    
  • Check the official template for additional parameters:
    [name@server ~]$ less $EBROOTCESM/cime/config/xml_schemas/config_machines_template.xml
    

Local batch file

  • Create and edit the file ~/.cime/config_batch.xml from the following minimal content:
    File : ~/.cime/config_batch.xml

    <?xml version="1.0"?>
    
    <config_batch version="2.1">
      <batch_system type="slurm">
        <batch_submit>sbatch</batch_submit>
        <submit_args>
          <arg flag="--time" name="$JOB_WALLCLOCK_TIME"/>
          <arg flag="--account" name="$PROJECT"/>
        </submit_args>
        <directives>
          <directive>--mem=0</directive>
        </directives>
        <queues>
          <queue default="true">default</queue>
        </queues>
      </batch_system>
    </config_batch>
    


  • Validate your XML machine file with the following commands:
    [name@server ~]$ xmllint --noout --schema $EBROOTCESM/cime/config/xml_schemas/config_batch.xsd ~/.cime/config_batch.xml
    /home/name/.cime/config_batch.xml validates
    
  • Check the documentation for additional configuration parameters and examples.

Creating a test case

The following command assumes the default model cesm and the current machine:

[name@server ~]$ create_newcase --case test_case --compset IHistClm50Bgc --res f19_g17


Reference