Skip to content

Warning

This step is not required if you only want to run an ACCESS released model configuration. If you are looking for information on how to run a model, refer to the Run a Model section.

Modify and build an ACCESS model's source code on Gadi

The instructions below cover the Spack develop workflow, designed for iterative model development, where you repeatedly modify the source code, recompile, and test the model. They demonstrate how to modify the model component for ACCESS-OM3 and re-compile the relevant ACCESS-OM3 dependencies on NCI's supercomputer Gadi using the Spack software manager.

Tip

The following instructions are valid (with simple tweaks) for all ACCESS models.

Prerequisites

  • NCI Account
    These instructions are tailored specifically for Gadi. To use Spack on Gadi, you need to Set Up your NCI Account.

  • Membership of the vk83 project
    The shared Spack instance is distributed through /g/data/vk83. Request membership through my.nci.org.au.

  • A project with writable /g/data and /scratch space
    Spack installs your builds under /g/data/$PROJECT/$USER/spack/ and stages source code under /scratch/$PROJECT/$USER/. Building a full model can consume a lot of storage, so check your quota with lquota before starting.

Enable spack

To make Spack available run:

module use /g/data/vk83/modules
module load spack

module use /g/data/vk83/modules module load spack Spack environment set up using /g/data/vk83/apps/spack-shared/1.1/spack/share/spack/setup-env.sh Spack user cache set to /g/data/$PROJECT/$USER/spack/1.1/spack-user-cache

Choose the ACCESS model and model component to develop

We begin by choosing the ACCESS model we'd like to develop, for example, ACCESS-OM3:

git clone https://github.com/ACCESS-NRI/ACCESS-OM3.git
cd ACCESS-OM3
spack env activate -p ./

git clone https://github.com/ACCESS-NRI/ACCESS-OM3.git Cloning into 'ACCESS-OM3'... remote: Enumerating objects: 2161, done. remote: Counting objects: 100% (1086/1086), done. remote: Compressing objects: 100% (332/332), done. remote: Total 2161 (delta 963), reused 767 (delta 753), pack-reused 1075 (from 1) Receiving objects: 100% (2161/2161), 537.50 KiB | 4.13 MiB/s, done. Resolving deltas: 100% (1483/1483), done. cd ACCESS-OM3 spack env activate -p ./ remote: Enumerating objects: 3205, done. remote: Counting objects: 100% (3205/3205), done. remote: Compressing objects: 100% (1347/1347), done. remote: Total 3205 (delta 1480), reused 2635 (delta 1038), pack-reused 0 (from 0) Note: switching to '2026.09.005'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at b6fc4a4 ACCESS-OM3 versions for next release (#500)

The spack.yaml file inside the ACCESS-OM3 directory specifies the component packages and their versions that constitute the coupled model. By inspecting the spack.yaml you can identify the correct Spack package name of a component package. For example, access-mom6 is the Spack package name of MOM6.

Next, in the spack.yaml, identify the version of the component Spack package that you want to develop. The version is prefixed by @. The snippet below is from the ACCESS-OM3 component access-mom6, where the version is 2026.05.003:

spack:
...
  packages:
...
    access-mom6:
      require:
      - '@2026.05.003'
      - +mom6_solo
      - fflags="-march=sapphirerapids -mtune=sapphirerapids -unroll"
      - cflags="-march=sapphirerapids -mtune=sapphirerapids -unroll"

Spack develop the package

When you develop a package within a Spack environment, Spack needs to know that the desired package is "in development", and be able to access its source code. This is done through the spack develop command with the previously identified Spack package name and version:

spack develop access-mom6@2026.05.003

spack develop access-mom6@2026.05.003 ==> Cloning source code for access-mom6@=2026.05.003

This clones the MOM6 repository at the Git commit reference that maps to the Spack version 2026.05.003 into the directory access-mom6. Then, it inserts the following new section in the spack.yaml:

spack:
...
  develop:
    access-mom6:
      spec: access-mom6@=2026.05.003
This section tells Spack that it should build from the local clone of MOM6, rather than fetching from GitHub. As a consequence, any code modification to test should be made in the local clone directory.

Build the model

The next step of the process is called concretization. It determines the precise details of all the dependencies that are needed to build the model:

spack concretize -f

Tip

Estimated time to complete: 1-10 minutes

spack concretize -f ==> Concretized 1 spec: - so4gprs access-om3@latest build_system=bundle platform=linux os=rocky8 target=x86_64_v4 - eogf43h ^access-3@2026.03.002 cflags='-march=sapphirerapids -mtune=sapphirerapids -unroll' fflags='-march=sapphirerapids -mtune=sapphirerapids -unroll' /~ipo build_system=cmake build_type=Release commit=5eaac41f7cd4ea5f6a2aa9c5639da9a490f309ce configurations:=MOM6,MOM6-CICE6,MOM6-CICE6-WW3 generator=make platform=linux os=rocky8 target=x86_64_v4 %c,fortran=oneapi@2025.2.0 ... ... ... Output truncated for brevity ... ==> Updating view at /$HOME/ACCESS-OM3/.spack-env/view

This must be repeated every time the spack.yaml is modified.

Now the model is ready to be compiled and installed, including any local source code modifications in the access-mom6 sub-directory:

spack install

Tip

Estimated time to complete: 1-45+ minutes.

spack install [+] /usr (external glibc-2.28-vuczjrbyzfif5nzgt5gqbrdrzaioihy6) [+] /g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/compiler-wrapper-1.1.0-4vm57ydwr3x5uq2jhwsv7ltk6az3hxxs ==> intel-oneapi-compilers@2025.2.0 : has external module in ['intel-compiler-llvm/2025.2.0'] ... ==> Installing python-venv-1.0-qlaqm76cempvsddzqvebwz6ye52iebfn [7/43] ... ==> Installing py-setuptools-82.0.1-4gcy3ox37n3fv57iafegbxy6xgtrvp2i [21/43] ... ... ... Output truncated for brevity ... ==> Updating view at /$HOME/ACCESS-OM3/.spack-env/view

The modification of source code followed by spack install can be done iteratively.

Use the generated executable

To use the generated executable, use Spack to find the full path to the new executable:

spack location -i access3

Take the displayed path, with /bin/ appended, and then prepend it to the existing exe: entry in the payu config.yaml. When running payu, add -r false to the run command to turn off manifest checking, as the executable has changed.

Tip

In this case, we located access3 because that is the ACCESS-OM3 dependency that builds the executables. The specific dependecy that builds the model executable varies for each specific model. If you are unsure which dependency to locate to find the executables for your model, consider asking a question on the Hive Forum.

Troubleshooting build errors

Sometimes you might encounter errors while compiling the packages. Spack prints out the error message and generates a full build log that can be viewed by the user. The location of the build log is shown at the end of the error message.

Click to see the error log example
$ spack install
...
==> No binary for access-mom6-stable-7p2x5g7p72kjliot4rnvqaxk7eh2mpda found: installing from source
==> Installing access-mom6-stable-7p2x5g7p72kjliot4rnvqaxk7eh2mpda [35/39]
==> No patches needed for access-mom6
==> access-mom6: Executing phase: 'cmake'
==> Error: ProcessError: Command exited with status 1:
    '/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/cmake-3.31.11-4xpsc6gicgmaz3onofzohjaau76odzd3/bin/cmake' '-G' 'Unix Makefiles' '-DCMAKE_INSTALL_PREFIX:STRING=/g/data/tm70/$USER/spack/1.1/release/linux-x86_64_v4/access-mom6-stable-7p2x5g7p72kjliot4rnvqaxk7eh2mpda' '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON' '-DCMAKE_INSTALL_RPATH:STRING=/g/data/tm70/$USER/spack/1.1/release/linux-x86_64_v4/access-mom6-stable-7p2x5g7p72kjliot4rnvqaxk7eh2mpda/lib;/g/data/tm70/$USER/spack/1.1/release/linux-x86_64_v4/access-mom6-stable-7p2x5g7p72kjliot4rnvqaxk7eh2mpda/lib64' '-DCMAKE_PREFIX_PATH:STRING=/g/data/tm70/$USER/spack/1.1/release/linux-x86_64_v4/access-generic-tracers-2026.09.000-2y3j5xtacj46gevx23vm6pmdd2uavhhz;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/access3-share-2026.03.002-m65pkhfhdcfromtvp3z5pwkejlcq6pp4;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/cmake-3.31.11-4xpsc6gicgmaz3onofzohjaau76odzd3;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/compiler-wrapper-1.1.0-4vm57ydwr3x5uq2jhwsv7ltk6az3hxxs;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/gmake-4.4.1-3sr5xy6gpvmfkr4ecptiqtbmcrqnczuk;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/access-mocsy-2025.07.002-5awgzcl5rbvkk4ei62uyk66hsp3avkr7;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/fms-2025.03-zw6tzbdvqmqkrkizhqisi3kvstrc2vjm;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/esmf-8.9.1-u56mitgtfbi2qlj3x7lw7ofxj7lw4b2l;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/fortranxml-4.1.2-l2i2droyqjjgnrsb6ort3no7hz5cpvnk;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/parallelio-2.6.8-a5un5qjas4eju5dpyhobdph5lwqgx4mv;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/netcdf-fortran-4.6.2-yze65gmryo5aren72ydkw742yerv2ag6;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/netcdf-c-4.9.3-i2yg6wiht4vl5slywg25qpd3avh6mh2y;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/bzip2-1.0.8-5umnxzum3fjmzr56pxz7rhpwx4hv6khk;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/c-blosc-1.21.6-ntor6vmuxx4jp7dejzypvuctslne5pw6;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/hdf5-1.14.6-ustivdivi5brfjuhd7wt525vxrd6rddw;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/libaec-1.1.4-patvd3yohb3sqh2m63t2e56o3q6p6hz3;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/lz4-1.10.0-pzf2vwga4yxnkxpp76uqzbzxxcpuslx4;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/snappy-1.2.1-qwtkwcddpmcko7vxptrwj7pavpijc6yo;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/zstd-1.5.7-fd6ey726t34uco4rkzrgcwoluryimrp7;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/zlib-ng-2.3.3-p2ctudzwaiqp6acuskgmu2h6kgvjfh6w;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/intel-oneapi-runtime-2025.2.0-hyun3ledkfevkt6ezyotlc45wzufscep;/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/gcc-runtime-15.1.0-r3jhjvxq3s4lt5fidxafye5utgjkvs6g;/apps/intel-tools/.packages/2025.2.0.575;/apps/openmpi/4.1.7' '-DCMAKE_BUILD_TYPE:STRING=Release' '-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON' '-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF' '-DCMAKE_POLICY_DEFAULT_CMP0090:STRING=NEW' '-DCMAKE_FIND_USE_PACKAGE_REGISTRY:BOOL=OFF' '-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON' '-DMOM6_OPENMP:BOOL=OFF' '-DMOM6_ASYMMETRIC:BOOL=OFF' '-DMOM6_ACCESS3:BOOL=ON' '-DMOM6_SOLO:BOOL=ON' '' '' '/g/data/tm70/$USER/harshula/ACCESS-OM3/MOM6'

2 errors found in build log:
    52    -- Found PIO: /g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/parallelio-2.6.8-a5un5qjas4eju5dpyhobdph5lwqgx4mv (Required is at least version "2.5.3") found components: C For
        tran
    53    -- FindPIO:
    54    --   - PIO_PREFIX [/g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/parallelio-2.6.8-a5un5qjas4eju5dpyhobdph5lwqgx4mv]
    55    --   - PIO Components Found: C;Fortran
    56    -- Found ESMF: /g/data/vk83/apps/spack/1.1/release/linux-x86_64_v4/esmf-8.9.1-u56mitgtfbi2qlj3x7lw7ofxj7lw4b2l/lib/libesmf.so (found suitable version "8.9.1", minimum required is
            "8.3.0")
    57    -- Configuring done (22.8s)
>> 58    CMake Error at src/CMakeLists.txt:21 (target_sources):
    59      Cannot find source file:
    60
    61        equation_of_state/TEOS10/gsw_chem_potential_water_t_exact.f90
    62
    63      Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm
    64      .ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90
    65      .f95 .f03 .hip .ispc
    66
    67
>> 68    CMake Error at cmake/FortranLib.cmake:5 (add_library):
    69      No SOURCES given to target: mom6shared
    70    Call Stack (most recent call first):
    71      src/CMakeLists.txt:3 (add_fortran_target)
    72
    73
    74    CMake Generate step failed.  Build files cannot be regenerated correctly.

See build log for details:
/scratch/tm70/$USER/tmp/spack-stage/spack-stage-access-mom6-stable-7p2x5g7p72kjliot4rnvqaxk7eh2mpda/spack-build-out.txt

...

If the error is not obvious from the error message, see the build log for more information.

Debugging a Model

Debugging is an important part of the development process. Using a debugger can make this process significantly easier, allowing detailed inspection of the state of the code as it is running. The debugger used in this guide is Linaro DDT from Linaro Forge.

Setting up the debugger

To connect to the debugger remotely from your workstation, you will need to set up the Linaro Forge client locally. Download the client from the Linaro Forge download page, ensuring to match the version of the client with the most up-to-date version on the compute cluster (to get older versions of the client, follow the older versions link). Once installed, launch the client and follow the connecting remotely instructions.

Tip

To check which versions of Linaro Forge are available on your compute cluster, use module avail linaro-forge.

For Gadi, the Linaro Forge Remote Launch Settings are:

  • Host Name: <username>@nci.org.au
  • Remote Installation Directory: /apps/linaro-forge/<version>

Setting up the build

To debug a model through the Linaro debugger, the following settings in the build's spack.yaml are required:

  1. OpenMPI version 4 should be used. openmpi@4.1.3 and openmpi@4.1.7 have been tested.

  2. Modify the compilation options to include debug information and prevent the compiler from re-ordering the code for the purpose of optimisation. Add the following entries to the require section of the components you want to debug:

    • 'fflags="-O0 -g -traceback"'
    • 'cflags="-O0 -g -fno-omit-frame-pointer"'

Using the mom5_dev example above in the context of the ACCESS-ESM1.5 model to debug the MOM5 component, the updated spack.yaml would be:

spack:
  specs:
    - access-esm1p5@git.2024.12.0
packages:
  ...
  mom5:
    require:
      - '@git.access-esm1.5_2024.08.23=access-esm1.5'
      - 'fflags="-O0 -g -traceback"'
      - 'cflags="-O0 -g -fno-omit-frame-pointer"'
  ...
  openmpi:
    require:
      - '@4.1.3'
  ...
Once these changes have been made, concretize the environment by running:

spack concretize -f

Then install the environment by running:

spack install --keep-stage

Tip

The --keep-stage option prevents Spack from cleaning up the source code used to compile the executables, so it can be accessed by the debugger. Note that if you are iterating on a build, you may build up a large number of source files from successive building. These files are typically located at /scratch/$PROJECT/$USER/tmp/spack-stage, and should be cleaned up periodically.

Warning

If you have an existing build that was built without the --keep-stage option, the model will need to be uninstalled and re-installed again with this option for the debugger to work properly.

This will build executables compatible with the Linaro debugger.

Running the model with the debugger enabled

The recommended way to execute a debugging run is by using payu as follows:

  1. Locate the paths to the executables generated by the Spack build by running:
    spack find --paths
    
    This command lists the installation directories for each package in the environment. The generated executables will be located in the installation directories at bin/<executable_name>. Be careful to retrieve the correct executable for packages which build multiple executables (e.g., CICE5).
  2. Within the submodels section of the model configuration's config.yaml file, in the exe field, specify the path to its executable.
  3. In the config.yaml file, add linaro-forge/<version> to the modules: load section, by substituting <version> with the correct linaro-forge version.
  4. In the config.yaml, turn off executable reproducibility, since adding debugging options modifies the executable, by setting manifest: reproduce: exe: False.
  5. Tell payu to pipe the run through Linaro DDT by adding the following to the configuration config.yaml:

    mpi:
      runcmd: ddt --connect mpirun
    
    6. Run the model with payu run.

Tip

Alternatively, it is possible to debug from an interactive job following the instructions from NCI. While in an interactive job, call payu-run instead of payu run. If you choose this method, in the config.yaml set mpi: runcmd: ddt mpirun instead of mpi: runcmd: ddt --connect mpirun.

Changing number of processes for Linaro DDT

A limitation of the NCI's Linaro Forge license is that the maximum number of processes permitted for a DDT (or Map for profiling) run is 256. For some models (e.g., ACCESS-ESM1.5) this is not sufficient to run with the default configuration. This means the MPI configuration of the components must be changed. This process is outlined below for some of the model components used in ACCESS models:

  • UM7: In atmosphere/um_env.yaml, change UM_ATM_NPROCX and UM_ATM_NPROCY, which describe the number of chunks in the x and y directions, as well as UM_NPES to the product of UM_ATM_NPROCX and UM_ATM_NPROCY. In config.yaml, change the atmosphere: ncpus to be the same as UM_NPES.
  • MOM5: In ocean/input.nml, change layout in the &ocean_model_nml namelist, which describes the number of chunks in the x and y directions in nx,ny format. In config.yaml, change the ocean: ncpus to the product of nx and ny.
  • CICE4: To change the number of processes used by CICE4, the CICE4 executable needs to be recompiled. This requires the user to modify their own Spack installation. In the user's Spack installation, in access-spack-packages/spack_repo/access/nri/packages/cice4/package.py, modify the entries in the __targets dictionary to the desired number of processes and blocks (the product of the blocks must be the same as the processes). The resulting executable name is cice_<driver>_<grid>_<blocks>_<nprocs>p.exe, which must be specified in the config.yaml. In the configuration's ice/cice_in.nml, change nprocs in the &domain_nml namelist to the desired number of processes. Finally, in the config.yaml, change the ice: ncpus to the desired number of processes.
  • CICE5: To change the number of processes used by CICE5, the CICE5 executable needs to be recompiled, and the new blocksizes need to be specified. In spack.yaml, modify or add the five variants nxglob, nyglob, blckx, blcky, mxblcks to the desired number of processes and blocks. For ACCESS-ESM1.6, nprocs must be a divisor of nxglob(=360), therefore set blckx = 360/nprocs and mxblcks=1. For ACCESS-OM2, there are more options (see Section 4.7 of the CICE5 documentation). In the configuration's ice/cice_in.nml, change nprocs in the &domain_nml namelist to the desired number of processes. Finally, in the config.yaml, change the executable name to the new build and change ice: ncpus to the desired number of processes.
  • ACCESS-OM3: In nuopc.runconfig change _ntasks for each model component to be less than or equal to 256. Change _rootpe for every component to 0 (or such that _rootpe + _ntasks is less than 256). In MOM_Input, add AUTO_MASKTABLE = True, and remove entries for MASKTABLE, LAYOUT and IO_LAYOUT. Finally in config.yaml, change ncpus to the desired number of processes.

For the example above, the number of processes requested is larger than the number allowed by Linaro Forge. Therefore, changes to the atmosphere (UM) and ocean (MOM5) decompositions are required. For this reason, we will reduce the number of processes to 16 for UM and to 12 for MOM5. As CICE4 only requests 12 processes, this can be kept as is. The updated configuration would look like the following:

In config.yaml:

submodels:
    name: atmosphere
    model: um
    ncpus: 16
    exe: <path_to_UM7_install>/bin/um_hg3.exe
...
    name: ocean
    model: mom
    ncpus: 12
    exe: <path_to_MOM_install>/bin/fms_ACCESS-CM.x
...
    name: ice
    model: cice
    ncpus: 12
    exe: <path_to_CICE_install>/bin/cice_access_360x300_12x1_12p.exe
...
manifest:
  reproduce:
    exe: False

mpi:
  runcmd: ddt --connect mpirun

In atmosphere/um_env.yaml:

...
UM_ATM_NPROCX: '4'  # Decomposition that multiplies to 16
UM_ATM_NPROCY: '4'
UM_NPES: '16'
...

In ocean/input.nml:

...
&ocean_model_nml
    layout = 4,3    # Decomposition that multiplies to 12
    ...
/
...

- https://spack.readthedocs.io/en/latest/ - https://spack-tutorial.readthedocs.io/en/latest/tutorial_developer_workflows.html