Skip to content

Documentation: multi repo ocean checkout example #934

Description

@thomas-robinson

The documentation needs an example of how to convert the way the ocean checkout is handled in the XML to the new, cleaner, modern version in fre-cli. This modern version calls the componenet "ocean" and uses an array to clone the two repos instead of the single clone and then csh block. However, this example uses $(MOM6_GIT_TAG) which is not a tag, but a git commit hash. Because it's a commit hash, the additionalInstructions are necessary because you can't clone to a git hash, only a branch or tag. Additionally, the includes for FMS and MOM6 need to be added because fre-cli does not just assume you need them like bronx does. Those instructions are passed to mkmf using the otherFlags tag in the yaml and are set in the model yaml:

fre_properties:
  - &INTEL             "intel-classic"
  - &FMSIncludes "-IFMS/fms2_io/include -IFMS/include -IFMS/mpp/include"
  - &MOMIncludes "-Iocean/MOM6-examples/src/MOM6/pkg/CVMix-src/include -Iocean/MOM6-examples/src/MOM6/src -Iocean/MOM6-examples/src/MOM6/src/framework"

The includes will always be needed with GFDL models.

Here is an example of the XML and the YAML used:

   <component name="mom6" requires="fms" paths="mom6/src/MOM6/config_src/{infra/FMS2,memory/dynamic_nonsymmetric,drivers/FMS_cap} mom6/src/MOM6/src/{*,*/*} mom6/src/MOM6/config_src/external/{ODA_hooks,database_comms,drifters,stochastic_physics,MARBL} ocean_BGC/generic_tracers ocean_BGC/mocsy/src ">
       <source versionControl="git" root="https://github.com/NOAA-GFDL">
        <codeBase version="main"> ocean_BGC.git </codeBase>
        <csh><![CDATA[
          ( cd ocean_BGC && git checkout $(OCEAN_BGC_GIT_TAG) )
	  git clone -b dev/gfdl https://github.com/NOAA-GFDL/MOM6-examples.git mom6
	  pushd mom6
	  git checkout $(MOM6_GIT_TAG)
	  git submodule update --recursive --init src/MOM6 src/SIS2 src/icebergs
  <property name="LIBS_ROOT"      value="cm4_compile$(MODIFIER)"/> <!--name of libs compile experiment-->
  <property name="MOM6_EXAMPLES"  value="$root/$(LIBS_ROOT)/src/mom6"/>
  <property name="FMS_LIB_DIR"    value="./$(LIBS_ROOT)/$(platform)-$(target)/exec"/>
  <property name="MY_LIBS"        value="$(EXEC_ROOT)/$(FMS_LIB_DIR)"/>

  <experiment name="cm4_compile">
    <description>
Experiment to build executable.
    </description>

    <component name="fms" paths="FMS">  
     <source versionControl="git" root="https://github.com/NOAA-GFDL">
            <codeBase version="$(FMS_GIT_TAG)"> FMS.git </codeBase>
     </source>
     <compile>
        <cppDefs>$(F2003_FLAGS) -Duse_yaml -Duse_libMPI -Duse_netCDF -DMAXFIELDMETHODS_=500</cppDefs>
      </compile>
    </component>

    <component name="atmos_phys" requires="fms" paths="atmos_phys">
      <source versionControl="git" root="http://gitlab.gfdl.noaa.gov/fms">
        <codeBase version="main"> atmos_phys.git </codeBase>
          <csh><![CDATA[( cd atmos_phys && git checkout $(ATM_PHYS_GIT_TAG) )]]></csh>
      </source>
      <compile>
        <cppDefs>$(F2003_FLAGS)</cppDefs>
      </compile>
   </component>

   <component name="atmos_dyn" paths="GFDL_atmos_cubed_sphere/driver/GFDL
                                      GFDL_atmos_cubed_sphere/model
                                      GFDL_atmos_cubed_sphere/model_nh_null
                                      GFDL_atmos_cubed_sphere/GFDL_tools
				      GFDL_atmos_cubed_sphere/driver/SHiELD/cloud_diagnosis.F90 GFDL_atmos_cubed_sphere/driver/SHiELD/gfdl_cloud_microphys.F90
                                      GFDL_atmos_cubed_sphere/tools" requires="fms atmos_phys">
      <source versionControl="git" root="https://github.com/NOAA-GFDL">
        <codeBase version="$(ATM_FV3_GIT_TAG)">GFDL_atmos_cubed_sphere.git</codeBase>
      </source>
      <compile>
        <cppDefs>$(F2003_FLAGS) -DCLIMATE_NUDGE -DSPMD -DINTERNAL_FILE_NML</cppDefs>
      </compile>
    </component>
   <component name="atmos_drv" paths="atmos_drivers/coupled" requires="fms atmos_phys atmos_dyn">
      <source versionControl="git" root="https://github.com/NOAA-GFDL">
        <codeBase version="$(ATM_DRV_GIT_TAG)">atmos_drivers.git</codeBase>
      </source>
      <compile>
        <cppDefs>$(F2003_FLAGS) -DCLIMATE_NUDGE -DSPMD</cppDefs>
      </compile>
    </component>


    <component name="land_lad2" requires="fms" paths="land_lad2">
      <source versionControl="git" root="http://gitlab.gfdl.noaa.gov/fms">
        <codeBase version="$(LAND_GIT_TAG)">land_lad2.git</codeBase>
      </source>
      <compile doF90Cpp="yes">
       <cppDefs>$(F2003_FLAGS) -nostdinc -DINTERNAL_FILE_NML </cppDefs>
      </compile>
    </component>

    <component name="mom6" requires="fms" paths="mom6/src/MOM6/config_src/{infra/FMS2,memory/dynamic_nonsymmetric,drivers/FMS_cap} mom6/src/MOM6/src/{*,*/*} mom6/src/MOM6/config_src/external/{ODA_hooks,database_comms,drifters,stochastic_physics,MARBL} ocean_BGC/generic_tracers ocean_BGC/mocsy/src ">
       <source versionControl="git" root="https://github.com/NOAA-GFDL">
        <codeBase version="main"> ocean_BGC.git </codeBase>
        <csh><![CDATA[
          ( cd ocean_BGC && git checkout $(OCEAN_BGC_GIT_TAG) )
	  git clone -b dev/gfdl https://github.com/NOAA-GFDL/MOM6-examples.git mom6
	  pushd mom6
	  git checkout $(MOM6_GIT_TAG)
	  git submodule update --recursive --init src/MOM6 src/SIS2 src/icebergs

          (cd src/icebergs && git checkout dev/gfdl)
          popd

          pushd mom6
          set platform_domain = `perl -T -e "use Net::Domain(hostdomain) ; print hostdomain"`
          if ("${platform_domain}" =~ *"MsState"* ) then
            ln -s /work/noaa/gfdlscr/pdata/gfdl/gfdl_O/datasets/ .datasets
          else
            ln -s /gpfs/f5/gfdl_o/world-shared/datasets .datasets
          endif
          popd

          test -e mom6/.datasets
          if ($status != 0) then
            echo ""; echo "" ; echo "   WARNING:  .datasets link in MOM6 examples directory is invalid"; echo ""; echo ""
          endif


        ]]></csh>
      </source>
      <compile>
        <cppDefs><![CDATA[ $(F2003_FLAGS) -DMAX_FIELDS_=100 -DNOT_SET_AFFINITY -D_USE_MOM6_DIAG -D_USE_GENERIC_TRACER -DUSE_PRECISION=2 ]]></cppDefs>
        <makeOverrides>OPENMP=""</makeOverrides> <!-- openmp switch for MOM6 may cause crash -->
      </compile>
    </component>
    <component name="sis2" paths="mom6/src/SIS2/config_src/dynamic_symmetric mom6/src/SIS2/config_src/external/Icepack_interfaces mom6/src/SIS2/src mom6/src/icebergs/src ice_param" requires="fms mom6" includeDir="$root/$(LIBS_ROOT)/src/mom6/src/MOM6/src/framework" > 
       <source versionControl="git" root="https://github.com/NOAA-GFDL">
           <codeBase version="$(ICE_PARAM_GIT_TAG)"> ice_param.git </codeBase>
       </source>
       <compile>
            <cppDefs><![CDATA[$(F2003_FLAGS)  -DUSE_FMS2_IO ]]></cppDefs>
       </compile>
    </component>
      <component name="coupler" paths="coupler/shared coupler/full" requires="fms atmos_dyn atmos_drv atmos_phys land_lad2 sis2 mom6">
        <source versionControl="git" root="https://github.com/NOAA-GFDL">
          <codeBase version="main"> coupler.git </codeBase>
      	    <csh><![CDATA[( cd coupler && git checkout $(COUPLER_GIT_TAG) )]]>
            </csh>
        </source>
        <compile>
          <cppDefs><![CDATA[$(F2003_FLAGS)]]></cppDefs>
         </compile>
      </component>

to

    - component: "ocean"
      requires: ["FMS"]
      repo: ["https://github.com/NOAA-GFDL/ocean_BGC.git","https://github.com/NOAA-GFDL/MOM6-examples.git"]
      branch: [*OCEAN_BGC_GIT_TAG,"dev/gfdl"]
      paths:
        - "ocean/MOM6-examples/src/MOM6/config_src/infra/FMS2"
        - "ocean/MOM6-examples/src/MOM6/config_src/memory/dynamic_nonsymmetric"
        - "ocean/MOM6-examples/src/MOM6/config_src/drivers/FMS_cap"
        - "ocean/MOM6-examples/src/MOM6/src/*"
        - "ocean/MOM6-examples/src/MOM6/src/*/*"
        - "ocean/MOM6-examples/src/MOM6/config_src/external/ODA_hooks"
        - "ocean/MOM6-examples/src/MOM6/config_src/external/database_comms"
        - "ocean/MOM6-examples/src/MOM6/config_src/external/drifters"
        - "ocean/MOM6-examples/src/MOM6/config_src/external/stochastic_physics"
        - "ocean/MOM6-examples/src/MOM6/config_src/external/MARBL"
        - "ocean/ocean_BGC/generic_tracers"
        - "ocean/ocean_BGC/mocsy/src"
      additionalInstructions: !join [
        "\n",
        " cd ocean/MOM6-examples \n",
        " git checkout ",*MOM6_GIT_TAG,"\n",
        " git submodule update --recursive --init src/MOM6 src/SIS2 src/icebergs \n",
        " cd src/icebergs \n",
        " git checkout dev/gfdl \n",
        " cd ../../../ \n",
        "            ln -s /gpfs/f5/gfdl_o/world-shared/datasets .datasets\n",
        "            echo \"\"; echo \"\" ; echo \"    WARNING:  .datasets link in MOM6 examples directory is invalid\"; echo \"\"; echo \"\"\n"
      ]
      cppdefs: !join [*F2003_FLAGS, " -DMAX_FIELDS_=100 -DNOT_SET_AFFINITY -D_USE_MOM6_DIAG -D_USE_GENERIC_TRACER -DUSE_PRECISION=2 "]
      makeOverrides: 'OPENMP=""'
      otherFlags: !join [*FMSIncludes," ", *MOMIncludes]

    - component: "ice_param"
      requires: ["FMS", "ocean"]
      repo: "https://github.com/NOAA-GFDL/ice_param.git"
      branch: *ICE_PARAM_GIT_TAG
      paths:
        - "ocean/MOM6-examples/src/SIS2/config_src/dynamic_symmetric"
        - "ocean/MOM6-examples/src/SIS2/config_src/external/Icepack_interfaces"
        - "ocean/MOM6-examples/src/SIS2/src"
        - "ocean/MOM6-examples/src/icebergs/src"
        - "ice_param"
      cppdefs: !join [*F2003_FLAGS, "  -DUSE_FMS2_IO "]
      otherFlags: !join [*FMSIncludes," ", *MOMIncludes]

    - component: "FMScoupler"
      requires: ["FMS", "atmos_phys", "GFDL_atmos_cubed_sphere", "atmos_drivers", "land_lad2", "ice_param", "ocean"]
      repo: "https://github.com/NOAA-GFDL/FMScoupler.git"
      branch: *COUPLER_GIT_TAG
      paths:
        - "FMScoupler/shared"
        - "FMScoupler/full"
      otherFlags: !join [*FMSIncludes," ", *MOMIncludes]
      cppdefs: *F2003_FLAGS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions