-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspackSetupEnvironment.sh
More file actions
executable file
·30 lines (26 loc) · 1.21 KB
/
spackSetupEnvironment.sh
File metadata and controls
executable file
·30 lines (26 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
#SBATCH --output /shared/home/root/scripts/logs/spackSetupEnvironment-%j.log
#SBATCH --error /shared/home/root/scripts/logs/spackSetupEnvironment-%j.log
# This script is used to set up a spack environment that has not yet been
# created, but has a definition file at
# /shared/home/root/environments/<environmentName>/spack.yml. The environment
# will be created with the name of the folder above the spack.yml definition,
# and this script will not only define the environment, but also install the
# packages that it requires.
# If the environment has already been created, this script will fail, since it
# assumes the environment does not already exist. If you just want to install
# packages for an existing environment, use `spackEnvironment.sh`.
if [ -x "${1}" ]
then
echo "Environment name is required, e.g. `spackSetupEnvironment.sh environmentName`"
exit 1
fi
. /shared/spack/share/spack/setup-env.sh
ENVIRONMENT=$1
echo "Creating environment $ENVIRONMENT..."
spack env create $ENVIRONMENT "/shared/home/root/environments/$ENVIRONMENT/spack.yml"
echo "Activating environment $ENVIRONMENT..."
spack env activate $ENVIRONMENT
echo "Installing packages for $ENVIRONMENT..."
spack install
echo "Done!"