Skip to content

C2SM/spack-c2sm

Repository files navigation

The spack extension of C2SM and MCH

Documentation Status

Spack is the package manager used by C2SM and MeteoSwiss to install and deploy software on supercomputers, local machines and the cloud.

Documentations

Infos about c2sm-supported software and machines

General infos about spack

Workflow

We suggest local/individual spack instances and the use of spack environments.

Clone the repository

git clone --depth 1 --recurse-submodules --shallow-submodules -b v0.21.1.3 https://github.com/C2SM/spack-c2sm.git

Setup the shell environment and optionally specify an upstream, where spack will look for installed software, i.e.

. spack-c2sm/setup-env.sh
. spack-c2sm/setup-env.sh /user-environment
. spack-c2sm/setup-env.sh /mch-environment/v6
. spack-c2sm/setup-env.sh /mch-environment/v7

Sourcing this file will put the spack command in your PATH, set up your MODULEPATH to use Spack’s packages, and add other useful shell integration for certain commands, environments, and modules. For bash, it also sets up tab completion. (source: spack docu)

Optionally activate a spack environment

spack env activate <path_to_env>

and starts exploring

spack info <package>
spack spec <spec>

and installing

spack install <spec>
spack dev-build <spec>

packages.

Updating spack-c2sm is in the hands of the user.

git pull
git submodule update --recursive

Before an update we advice to clean your instance

spack uninstall -a
spack clean -a
rm -rf ~/.spack

After an update we advice to rebuild packages, preferably in a new shell so that no outdated shell variables are retained.

Command cheat sheet

Command
Clone git clone --depth 1 --recurse-submodules --shallow-submodules -b <branch/tag> https://github.com/C2SM/spack-c2sm.git
Update git pull
git submodule update --recursive
Load . spack-c2sm/setup-env.sh to run without an upstream
or
. spack-c2sm/setup-env.sh /user-environment to use /user-environment as an upsream
spack compiler find autodetects compilers
spack external find --all autodetects externally installed packages
Clean spack uninstall -a uninstalls all packages
spack clean -a cleans all misc caches

Spec syntax: <package>@<version>%<compiler>+<variant> ~<variant>^<sub-package> +<sub-package-variant><compiler flags>

Command
Find spack find lists all installed packages.
spack find <spec> lists all installed packages that match the spec.
Info spack info <package>
Spec spack spec <spec> concretizes abstract spec (unspecfied variant = any)
Spack is not required to use the default of an unspecified variant. The default value is only a tiebreaker for the concretizer.
Install spack install <spec>
Locate spack location --install-dir <spec> prints location of all installs that satisfy the spec
Load env spack load <spec> loads run environment
Activate env spack env activate <env_name>
Deactivate env spack deactivate