Skip to content

Commit

Permalink
Created 'Set up Spack for model builds' page inside 'Getting Started'
Browse files Browse the repository at this point in the history
  • Loading branch information
atteggiani committed Sep 17, 2024
1 parent 545f223 commit bf7e614
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/getting_started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,15 @@
</span>
</div>
</a>
<a href="/getting_started/spack" class="horizontal-card">
<div class="card-image-container">
<img class="img-contain white-background with-padding" src="https://cdn.jsdelivr.net/gh/spack/spack@develop/share/spack/logo/spack-logo-text.svg" alt="spack">
</div>
<div class="card-text-container">
<span class="bold">Set up Spack for model builds</span>
<span>
Spack is a flexible package manager used to build ACCESS models.
</span>
</div>
</a>
</div>
65 changes: 65 additions & 0 deletions docs/getting_started/spack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Set up Spack for model builds

[Spack](https://spack.io/about/) is a build-from-source package manager, specifically designed to simplify the installation of scientific software on supercomputers.

## Prerequisites
To use _Spack_ on _Gadi_, you must have an NCI account.<br>
For instructions on how to set up an account, refer to [Set Up your NCI Account](/getting_started/set_up_nci_account).

## Set up Spack on Gadi

### Create a directory for the Spack distribution

!!! tip
This step is optional, but it is recommended you have a selected directory where to keep your _Spack_ distribution.

The complete _Spack_ distribution is approximately 120 MB in size. For this reason, we reccommend placing its directory somewhere in `/g/data`. An example can be `/g/data/$PROJECT/$USER/spack_distribution`.

To create the directory mentioned above and navigate into it, run the following command:
```
mkdir -p /g/data/$PROJECT/$USER/spack_distribution && cd $_
```

### Get Spack executable and configuration files

To get the _Spack_ executable and configuration files, run the following commands to clone the respective GitHub repositories:

```
git clone -c feature.manyFiles=true https://github.com/ACCESS-NRI/spack.git --branch releases/v0.22 --single-branch --depth=1
git clone https://github.com/ACCESS-NRI/spack-packages.git --branch main
git clone https://github.com/ACCESS-NRI/spack-config.git --branch main
```

### Link Spack configuration files

To link the _Spack_ configuration files to the _Spack_ instance, run the following command:

```
ln -s -r -v spack-config/v0.22/gadi/* spack/etc/spack/
```

!!! success
Your _Spack_ setup is complete!

### Test Spack

To test _Spack_ we will create an environment (in this example it will be the on to build ACCESS-OM2 executables) and build the relevant packages. Then, we will uninstall all the packages and remove the environment.

All the steps listed above can be performed by running the following commands (where `<spack_distribution_directory>` is the [directory for the Spack distribution](#create-a-directory-for-the-spack-distribution)):
```
. <spack_distribution_directory>/spack-config/spack-enable.bash
curl -L https://raw.githubusercontent.com/ACCESS-NRI/ACCESS-OM2/main/spack.yaml -o access-om2-spack.yaml
spack env create access-om2 access-om2-spack.yaml
spack env activate -p access-om2
spack find
spack install --verbose
spack find
spack uninstall --remove --all -y
spack env deactivate
spack env rm access-om2 -y
rm access-om2-spack.yaml
```

### More information
To know more about _Spack_ usage, please familiarise yourself with the [Basic Usage instructions](https://spack.readthedocs.io/en/latest/basic_usage.html) and [Environments](https://spack.readthedocs.io/en/latest/environments.html).<br>
We also reccommend you check the [Spack 101 Tutorial](https://spack-tutorial.readthedocs.io/en/latest/).
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ markdown_extensions:
- pymdownx.mark
- pymdownx.tilde
- pymdownx.snippets
- pymdownx.highlight
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
Expand All @@ -98,6 +99,7 @@ nav:
- getting_started/index.md
- Set Up your NCI Account: getting_started/set_up_nci_account.md
- Australian Research Environment (ARE): getting_started/are.md
- Set up spack for model builds: getting_started/spack.md

- Models:
- Models: models/index.md
Expand Down

0 comments on commit bf7e614

Please sign in to comment.