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

With spack v0.18 we suggest local/individual spack instances and the use of spack environments.

A user clones the spack repo

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

gets spack in the command line

. spack-c2sm/setup-env.sh

activates an environment

spack env activate <path_to_env>

and starts exploring

spack info <package>
spack spec <spec>

and building

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

a package.

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

git pull
git submodule update --recursive

After an update we advice to clean

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

and rebuild.

Command cheat sheet

Command
Clone git clone --depth 1 --recurse-submodules --shallow-submodules -b <branch/tag> https://github.com/C2SM/spack-c2sm.git
Load . spack-c2sm/setup-env.sh autodetects machine
or
. spack-c2sm/setup-env.sh <machine> forces machine
or
. spack-c2sm/setup-env.sh unknown uses blank config
spack compiler find autodetects compilers
spack external find --all autodetects externally installed packages
Update git pull
git submodule update --recursive
Clean spack uninstall -a uninstalls all packages
spack clean -a cleans all misc caches
rm -rf ~/.spack removes user scope data

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