-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure-modules.sh
executable file
·42 lines (34 loc) · 1.55 KB
/
configure-modules.sh
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
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Enforce running from resolve root dir
if [[ ! -f $PWD/buildsystem/build.sh ]]; then
echo 'Please run this script from the top-level resolve source directory.'
exit 1
fi
SPACK_INSTALL="${SPACK_INSTALL:?SPACK_INSTALL is unset. Make sure to source load_spack.sh first}"
# Assuming MY_CLUSTER is configured
# TODO - fix this to be POSIX standardized with tolower across all scripts
base="./buildsystem/spack/${MY_CLUSTER}"
spack install -j $1 && \
spack module tcl refresh -y && \
# We will create a new modules file, with the first line being the module path
mkdir -p $base/modules && \
# Note we redirect and destroy old file
arch=$(spack arch) && \
if [ $MY_CLUSTER == "incline" ]; then
# Trim the last character (see #464 on GitLab)
arch=${arch::-1}
fi && \
echo Arch for module path being used is $arch && \
echo module use -a $SPACK_INSTALL/modules/$arch &> $base/modules/dependencies.sh && \
spack module tcl loads -r -x resolve resolve &>> $base/modules/dependencies.sh
exit_code=$?
# This makes the module and installation location globally readable which isn't ideal.
# Sticking to this avoids permission issues for other group members, but you
# should make sure that the install location is in a folder that is only
# accessible to group members
# Since we use this in CI and other users will create files we cannot chmod,
# We need to allow this command to fail
chmod -R ugo+wrx $SPACK_INSTALL/modules > /dev/null 2>&1
# Should still change permissions before exiting, but should also return the exit
# code of spack related code
exit $exit_code