-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·74 lines (58 loc) · 1.43 KB
/
install
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash -e
SRC=$1
DEST=$2
if [ -z $SRC ]; then
echo Usage: install SOURCE_DIR \[DESTINATION_DIR\]
exit
fi
if [ -z $TMPDIR ]; then
echo Please set \$TMPDIR
exit
fi
TMPFILE=/tmp/.$RANDOM
if [ -z $DEST ]; then
PARENT=`dirname $SRC`
DEST=$PARENT/`date -Idate`
fi
rm -rf failures.log ~/.intel ~/.spack
if [ ! -d $DEST ];then
git clone https://github.com/spack/spack $DEST
cp modules.yaml $DEST/etc/spack/
cp packages.yaml $DEST/etc/spack/
cp -a licenses $DEST/etc/spack/
fi
rm -f $DEST/etc/spack/compilers.yaml
source $DEST/share/spack/setup-env.sh
module purge
# If a directory is given, search for specs
if [ -d $SRC ]; then
(
source $SRC/share/spack/setup-env.sh
spack find -xv --no-groups --show-full-compiler > $TMPFILE
)
elif [ -f $SRC ]; then
cp $SRC $TMPFILE
else
echo Error using input source!
exit
fi
while read compiler; do
echo Installing compiler $compiler
spack install $compiler
spack load --first $compiler
spack compiler find
spack unload --all
new_compiler=1
done < <( cat $TMPFILE | grep -oP '%[^\s]+' | sort -u | sed 's/%//' )
if [ $new_compiler ]; then
spack compiler list
cp ~/.spack/linux/compilers.yaml $DEST/etc/spack/
fi
while read spec; do
spack install $spec || echo Error installing $spec >> failures.log
done < $TMPFILE
echo
grep Another $DEST/opt/spack/*/*/*/.spack/spack-build-out.txt >> failures.log
if [ -f failures.log ]; then
cat failures.log
fi