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
vk83project
The shared Spack instance is distributed through/g/data/vk83. Request membership through my.nci.org.au. -
A project with writable
/g/dataand/scratchspace
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 withlquotabefore starting.
Enable spack¶
To make Spack available run:
module use /g/data/vk83/modules
module load spack
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 ./
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
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
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
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.
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:
-
OpenMPI version 4 should be used.
openmpi@4.1.3andopenmpi@4.1.7have been tested. -
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
requiresection 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'
...
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:
- Locate the paths to the executables generated by the Spack build by running:
This command lists the installation directories for each package in the environment. The generated executables will be located in the installation directories at
spack find --pathsbin/<executable_name>. Be careful to retrieve the correct executable for packages which build multiple executables (e.g., CICE5). - Within the
submodelssection of the model configuration'sconfig.yamlfile, in theexefield, specify the path to its executable. - In the
config.yamlfile, addlinaro-forge/<version>to themodules: loadsection, by substituting<version>with the correctlinaro-forgeversion. - In the
config.yaml, turn off executable reproducibility, since adding debugging options modifies the executable, by settingmanifest: reproduce: exe: False. -
Tell payu to pipe the run through Linaro DDT by adding the following to the configuration
config.yaml:6. Run the model withmpi: runcmd: ddt --connect mpirunpayu 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, changeUM_ATM_NPROCXandUM_ATM_NPROCY, which describe the number of chunks in the x and y directions, as well asUM_NPESto the product ofUM_ATM_NPROCXandUM_ATM_NPROCY. Inconfig.yaml, change theatmosphere: ncpusto be the same asUM_NPES. - MOM5: In
ocean/input.nml, changelayoutin the&ocean_model_nmlnamelist, which describes the number of chunks in the x and y directions innx,nyformat. Inconfig.yaml, change theocean: ncpusto the product ofnxandny. - 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__targetsdictionary to the desired number of processes and blocks (the product of the blocks must be the same as the processes). The resulting executable name iscice_<driver>_<grid>_<blocks>_<nprocs>p.exe, which must be specified in theconfig.yaml. In the configuration'sice/cice_in.nml, changenprocsin the&domain_nmlnamelist to the desired number of processes. Finally, in theconfig.yaml, change theice: ncpusto 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'sice/cice_in.nml, changenprocsin the&domain_nmlnamelist to the desired number of processes. Finally, in theconfig.yaml, change the executable name to the new build and changeice: ncpusto the desired number of processes. - ACCESS-OM3: In
nuopc.runconfigchange_ntasksfor each model component to be less than or equal to 256. Change_rootpefor every component to 0 (or such that_rootpe+_ntasksis less than 256). InMOM_Input, addAUTO_MASKTABLE = True, and remove entries forMASKTABLE,LAYOUTandIO_LAYOUT. Finally inconfig.yaml, changencpusto 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
...
/
...