Skip to content

Warning

20/05/2026: If you previously set up a personal Spack instance by following the instructions on this page, note that the recommended method for enabling Spack on Gadi has changed. Please review the updated instructions below.

How to use Spack on Gadi for building ACCESS models

Spack is a build-from-source package manager, specifically designed to simplify the installation of scientific software on supercomputers. Spack allows users to build ACCESS models directly from the source code, swap model components, and carry out development testing that involves modifying the source code.

ACCESS-NRI has installed and configured a shared Spack instance on Gadi so that users do not need to create and maintain their own Spack instance.

To use Spack, please familiarise yourself with the essential Spack commands used for Listing Available Packages and Seeing Installed Packages. Alternatively, follow the instructions in the Test Spack section below.

Prerequisites

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

Enable Spack

Estimated time to complete: 1 minute

Warning

The ACCESS-NRI shared Spack instance is configured to use /g/data/$PROJECT/$USER/spack/$SPACK_VERSION for temporary and permanent files. If your default project ID changes, then Spack will not be using the temporary and permanent files created with your previous project ID. This is particularly relevant for Spack workflows run through PBS jobs using multiple projects.

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

Tip

Please refer to the ACCESS-NRI Spack Cheat Sheet for further help on Spack.

Test Spack (OPTIONAL)

Estimated time to complete: 40 minutes

To test that Spack works as expected, clone the ACCESS-TEST repository and use it as a Spack independent environment to install the relevant packages. The Spack environment rules are defined in the ACCESS-TEST/spack.yaml file. If the packages are already installed in an upstream they will not be rebuilt.

Find all installed Spack packages

spack find

Find all local Spack packages

spack find --install-tree local

Find all upstream Spack packages

spack find --install-tree upstream

Clone a Spack environment

Change directory (cd) to the location where you want the ACCESS-TEST repository to reside. For example, /g/data/$PROJECT/$USER/

git clone https://github.com/ACCESS-NRI/ACCESS-TEST.git

Activate the environment

Activate the Spack environment inside the ACCESS-TEST directory by running:

spack env activate -p ./ACCESS-TEST
spack env activate -p ./ACCESS-TEST

Compile packages

Warning

Some of the commands below might take several minutes to complete.

spack concretize -f
spack install

Tip

To understand the Spack concretization output, refer to: What do the symbols at the start of spack concretize output mean?

spack concretize -f ... ==> Concretized 1 spec: - <spec-id> access-test@<version-info><build-info> <architecture-info> - <spec-id> ^<spack-package>@<version-info><build-info> <architecture-info> ... - <spec-id> ^<spack-package>@<version-info><build-info> <architecture-info> spack install ... ==> Installing <spack-package><hash> [1/<N>] ... ==> Installing <spack-package><hash> [2/<N>] ... ==> Installing access-test-<version-info><hash> [<N>/<N>] ... ==> access-test: Successfully installed access-test-<version-info><hash> ... ==> Updating view at </path/to/ACCESS-TEST/.spack-env/view>

Info

The animation above is a generalised example of the expected output, shortened and modified for clarity. Your actual output might vary.

Check installed packages

spack find --install-tree local

spack find --install-tree local ==> In environment </path/to/environment/ACCESS-TEST> ==> 1 root specs -- no arch / no compilers --------------------------------------- [+] access-test -- <architecture-info> / <compilers-info> ----------------------- <spack-package>@<version-info> <spack-package>@<version-info> -- <architecture-info> / <compilers-info> ----------------------- <spack-package>@<version-info> <spack-package>@<version-info> <spack-package>@<version-info> ... ==> <N> installed packages ==> 0 concretized packages to be installed (show with `spack find -c`)

Info

The animation above is a generalised example of the expected output, shortened and modified for clarity. Your actual output might vary.

Cleanup

spack uninstall --remove --all
spack env deactivate
rm -rf ACCESS-TEST

Develop a Model

For instructions on how to build an ACCESS model using Spack, refer to Modify and build an ACCESS model's source code.

Advanced users

Please refer to ACCESS-NRI's Spack configuration for details on how the release and shared Spack instances are installed and configured.

To use Spack outside of Gadi, please refer to the Spack 101 Tutorial.

- https://spack.readthedocs.io/en/latest/