Skip to content

Commit

Permalink
Move the configuration files to versioned target directories (#10)
Browse files Browse the repository at this point in the history
* Add more information to the README
* Use symlinking of configurations files instead of $SPACK_USER_CONFIG_PATH
* Use $SPACK_DISABLE_LOCAL_CONFIG to disable ~/spack
  • Loading branch information
harshula authored Nov 23, 2023
1 parent c1e6240 commit fc992ad
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 11 deletions.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# Spack Config

Shared spack configuration for building software on gadi@NCI
This repository contains:

* Spack configuration files required by the Spack instance(s) maintained by ACCESS-NRI on Gadi and ACCESS-NRI's [CI Docker image](https://github.com/ACCESS-NRI/build-ci/).
* The `ci` directory is to be used by the CI Docker image.
* The `gadi` directory is to be used in Gadi deployments.
* The `common` directory is a subset of required configuration files and should not be used directly.

* `spack-start.bash` is for general users to set their `bash` environment to directly run `spack` commands using ACCESS-NRI's Spack instance(s). Execute: `. spack-start.bash`. It disables local configuration changes in `~/.spack`. Advanced users should use the methods described in the Spack documentation, including setting `$SPACK_INSTALL_TREE` to a writeable directory.

## Usage

`ln -s -r -v <SPACK_VERSION>/<SPACK_TARGET>/* <SPACK_ROOT>/etc/spack/`

Where,
* <SPACK_VERSION> is the spack major version. e.g. `v0.20`.
* <SPACK_TARGET> is `ci` or `gadi`.
* <SPACK_ROOT> is the root directory of the Spack instance.

## References

* [Spack Configuration Scopes](https://spack.readthedocs.io/en/latest/configuration.html#configuration-scopes)
* [Spack Settings (config.yaml)](https://spack.readthedocs.io/en/latest/config_yaml.html)
* [Spack extended YAML Format](https://spack-tutorial.readthedocs.io/en/latest/tutorial_configuration.html#yaml-format)
17 changes: 7 additions & 10 deletions spack-start.bash
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# This is not an executable! Do not enable execute permissions.
# You need to be running a bash shell, then execute: . spack-start.bash
# This file is in $PREFIX/spack_config/

# Required layout:
# $PREFIX/spack
# $PREFIX/spack_config
# $PREFIX/spack_packages
# $PREFIX/release (defined in $PREFIX/spack_config/config.yaml)

# This file is located at $PREFIX/spack_config/$0
# $PREFIX/release (defined in $PREFIX/spack_config/*/*/config.yaml)

set -x
PREFIX="$(dirname $BASH_SOURCE)/.."
SPACK="$PREFIX/spack"
CONFIG="$PREFIX/spack_config/config"
set +x

# https://spack-tutorial.readthedocs.io/en/latest/tutorial_configuration.html#yaml-format
Expand All @@ -25,14 +23,13 @@ set +x
# adding that section, Spack replaces what was in that section with the new
# value.

# Don't disable local config, we need to use SPACK_USER_CONFIG_PATH.
#export SPACK_DISABLE_LOCAL_CONFIG=""
# Disable ~/.spack because we have seen compiler misconfiguration by users.
# This also disables /etc/spack .
export SPACK_DISABLE_LOCAL_CONFIG="true"

# No need to override, because it defaults to a non-existent /etc/spack on Gadi.
# Setting SPACK_DISABLE_LOCAL_CONFIG disables the following:
#export SPACK_SYSTEM_CONFIG_PATH=""

# Override ~/.spack because we have seen compiler misconfiguration by users.
export SPACK_USER_CONFIG_PATH="$CONFIG"
#export SPACK_USER_CONFIG_PATH=""

# TODO: Decide on the version of Python that we approve.
#export SPACK_PYTHON=
Expand Down
1 change: 1 addition & 0 deletions v0.20/ci/concretizer.yaml
File renamed without changes.
1 change: 1 addition & 0 deletions v0.20/ci/repos.yaml
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions v0.20/gadi/concretizer.yaml
4 changes: 4 additions & 0 deletions v0.20/gadi/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
config:
install_tree:
# Completely ignoring higher-level configuration options is supported with the :: notation for keys ...
root:: $spack/../release
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions v0.20/gadi/repos.yaml

0 comments on commit fc992ad

Please sign in to comment.