Building Met Office models from Github

The new Github repositories for Met Office models require a bit of setup to be usable in a workflow. You’ll need to add a new ‘extract_source’ app to download the source code and merge any branches, then point your fcm configuration to the downloaded repositories.

Below is a demo of how to set up a workflow to build Jules that you can use as a starting point for other models. This will work at NCI and Sentinel, for Sentinel you should first set up the local mirror in your ~/.gitconfig file:

[url "XXX/external-sources/github.com"]
       insteadOf = https://github.com/MetOffice
       insteadOf = git@github.com:MetOffice

extract_source

The extract_source app downloads source code from github and merges any branches. It uses a file ‘dependencies.yaml’ to control which branches to merge (check the ‘dependencies.yaml’ in the model’s repository for examples):

# app/extract_source/file/dependencies.yaml
jules:
   - source: git@github.com:MetOffice/jules.git
     ref: vn8.2

[!] Make sure all source names have a ‘.git’ extension, otherwise the script will think you want to scp from a remote server.

Each top-level section is a directory to build, under the section is a list of source repositories and refs (branches or tags).

The rose-app downloads extract scripts from the Met Office and then runs them on the dependencies.yaml file:

# app/extract_source/rose-app.conf
[command]
default = python3 merge_sources.py
[file:get_git_sources.py]
source=git:https://github.com/MetOffice/SimSys_Scripts.git::github_scripts/get_git_sources.py::main
[file:merge_sources.py]
source=git:https://github.com/MetOffice/SimSys_Scripts.git::github_scripts/merge_sources.py::main

Source code gets downloaded into $CYLC_WORKFLOW_SHARE_DIR/source.

fcm_make

The fcm_make task runs the actual build. You can adapt an existing fcm_make task, but it may be simpler to download the fcm_make app from the model’s rose stem to ensure you have an up-to-date version that works with Github repositories. You can get Cylc to download an app from an external repository by adding to your rose-suite.conf:

# rose-suite.conf
[file:app/fcm_make_jules]
source = git:https://github.com/MetOffice/jules::rose-stem/app/fcm_make_jules/::main

flow.cylc

The basic Cylc configuration for this workflow is:

#!Jinja2

{% set nci_storage = [
    'gdata/hr22',
    'gdata/xp65',
] %}

[scheduling]
    [[graph]]
        R1 = """
            extract_source => fcm_make_jules
        """

[runtime]
    [[root]]
        execution time limit = PT10M
        platform = pbs
        script = rose task-run
        [[[directives]]]
            -l ncpus = 1
            -l mem = 4gb
            -l storage = {{ nci_storage | join("+") }}
        [[[environment]]]
            ROSE_TASK_N_JOBS = $PBS_NCPUS # make rose use all cpus

    [[extract_source]]
        init-script = """
            module use /g/data/xp65/public/modules # get python from xp65
            module load conda/analysis3
        """
        [[[directives]]]
            -q = copyq # copyq for network access

    [[fcm_make_jules]]
        init-script = """
            module load intel-compiler-llvm
            module load openmpi
            module load netcdf
        """
        [[[environment]]]
            JULES_SOURCE = $CYLC_WORKFLOW_SHARE_DIR/source/jules # output from extract_source
            JULES_BUILD = "normal"
            JULES_OMP = "omp"
            JULES_PLATFORM = "nci-intel"
            JULES_FFLAGS_EXTRA = ""
            JULES_LDFLAGS_EXTRA = ""
3 Likes