forked from C2SM-RCM/buildenv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
machineEnvironment.sh
148 lines (139 loc) · 4.64 KB
/
machineEnvironment.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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
# setup environment for different systems
#
# NOTE: the location of the base bash script and module initialization
# vary from system to system, so you will have to add the location
# if your system is not supported below
exitError()
{
\rm -f /tmp/tmp.${user}.$$ 1>/dev/null 2>/dev/null
echo "ERROR $1: $3" 1>&2
echo "ERROR LOCATION=$0" 1>&2
echo "ERROR LINE=$2" 1>&2
exit $1
}
showWarning()
{
echo "WARNING $1: $3" 1>&2
echo "WARNING LOCATION=$0" 1>&2
echo "WARNING LINE=$2" 1>&2
}
modulepathadd() {
if [ -d "$1" ] && [[ ":$MODULEPATH:" != *":$1:"* ]]; then
MODULEPATH="${MODULEPATH:+"$MODULEPATH:"}$1"
fi
}
# setup empty defaults
host="" # name of host
queue="" # standard queue to submit jobs to
nthreads="" # number of threads to use for parallel builds
mpilaunch="" # command to launch an MPI executable (e.g. aprun)
installdir="" # directory where libraries are installed
testdata="" # directory where unittestdata is stored
# setup machine specifics
if [ "`hostname | grep lema`" != "" ] ; then
. /etc/bash.bashrc
. /opt/modules/default/init/bash
export host="lema"
queue="dev"
nthreads=12
mpilaunch="aprun"
installdir=/project/c01/install/${host}
testdata=/scratch/jenkins/data
elif [ "`hostname | grep daint`" != "" ] ; then
. /etc/bash.bashrc
. /opt/modules/default/init/bash
export host="daint"
queue="normal"
nthreads=8
mpilaunch="aprun"
installdir=/project/c01/install/${host}
testdata=/scratch/daint/jenkins/data
elif [ "`hostname | grep dora`" != "" ] ; then
. /etc/bash.bashrc
. /opt/modules/default/init/bash
export host="dora"
queue="normal"
nthreads=8
mpilaunch="aprun"
installdir=/project/c01/install/daint
testdata=/scratch/dora/jenkins/data
elif [ "`hostname | grep jupiter`" != "" ] ; then
. /etc/bash.bashrc
. /opt/modules/default/init/bash
export host="jupiter"
queue="batch"
nthreads=8
mpilaunch="aprun"
installdir="???"
testdata="???"
elif [ "`hostname | grep castor`" != "" ] ; then
. /etc/bashrc
. /apps/castor/Modules/default/init/bash
module load slurm
export host="castor"
queue="normal"
nthreads=6
mpilaunch="mpiexec"
installdir=/project/c01/install/${host}
testdata=/scratch/castor/jenkins/castor/data
elif [ "`hostname | grep santis`" != "" ] ; then
. /etc/bash.bashrc
. /opt/modules/default/init/bash
export host="santis"
queue="normal"
nthreads=8
mpilaunch="aprun"
installdir="???"
testdata="???"
elif [ "`hostname | grep durian`" != "" ] ; then
shopt -s expand_aliases
alias sbatch='eval'
alias squeue='echo'
alias module='echo $* 2>/dev/null 1>/dev/null'
export host="durian"
queue="normal"
nthreads=4
mpilaunch="mpirun"
installdir="/Users/fuhrer/Desktop/install"
testdata="/Users/fuhrer/Desktop/install/testdata"
elif [ "`hostname | grep bertie`" != "" ] ; then
shopt -s expand_aliases
alias sbatch='eval'
alias squeue='echo'
alias module='echo $* 2>/dev/null 1>/dev/null'
export host="bertie"
queue="normal"
nthreads=4
mpilaunch="mpirun"
installdir="/home/spiros/Work/install"
testdata="/home/spiros/Work/install/testdata"
elif [ "`hostname | grep kesch`" != "" -o "`hostname | grep escha`" != "" ] ; then
. /etc/bashrc && true # In some conditions the omitted true triggered an error.
. /usr/Modules/3.2.10/init/bash
. /etc/profile.d/cray_pe.sh
export host="kesch"
queue="debug"
nthreads=1
mpilaunch="srun"
installdir="/project/c01/install/${host}"
testdata="/scratch/jenkins/data"
elif [ "`hostname | grep greina`" != "" ] ; then
. /etc/bashrc
. /cm/local/apps/environment-modules/3.2.10/init/bash
export host="greina"
queue="none"
nthreads=4
mpilaunch="none"
installdir="/users/jenkins/install/${host}/"
testdata=???
fi
# make sure everything is set
test -n "${host}" || exitError 2001 ${LINENO} "Variable <host> could not be set (unknown machine `hostname`?)"
test -n "${queue}" || exitError 2002 ${LINENO} "Variable <queue> could not be set (unknown machine `hostname`?)"
test -n "${nthreads}" || exitError 2003 ${LINENO} "Variable <nthreads> could not be set (unknown machine `hostname`?)"
test -n "${mpilaunch}" || exitError 2004 ${LINENO} "Variable <mpilaunch> could not be set (unknown machine `hostname`?)"
test -n "${installdir}" || exitError 2005 ${LINENO} "Variable <installdir> could not be set (unknown machine `hostname`?)"
# export installation directory
export INSTALL_DIR="${installdir}"
export TESTDATA_DIR="${testdata}"