-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathsetup.sh
executable file
·176 lines (161 loc) · 4.27 KB
/
setup.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#!/bin/bash -e
case `uname` in
Linux) ECHO="echo -e" ;;
*) ECHO="echo" ;;
esac
# defaults
ACCESS=https
WHICH_CMSSW=CMSSW_10_6_29_patch1
FORK=cms-svj
BRANCH=Run2_UL
CORES=8
HLT=""
usage() {
$ECHO "setup.sh [options]"
$ECHO
$ECHO "Options:"
$ECHO "-c [release] \tCMSSW release to install (default = $WHICH_CMSSW)"
$ECHO "-f [fork] \tclone from specified fork (default = $FORK)"
$ECHO "-b [branch] \tclone specified branch (default = $BRANCH)"
$ECHO "-s [protocol] \tuse protocol to clone (default = ${ACCESS}, alternative = ssh)"
$ECHO "-j [cores] \t# cores for CMSSW compilation (default = ${CORES})"
$ECHO "-t \tinstall HLT releases"
$ECHO "-h \tprint this message and exit"
exit $1
}
CUR_DIR=`pwd`
#check arguments
while getopts "c:f:b:s:j:th" opt; do
case "$opt" in
c) WHICH_CMSSW=$OPTARG
;;
f) FORK=$OPTARG
;;
b) BRANCH=$OPTARG
;;
s) ACCESS=$OPTARG
;;
j) CORES=$OPTARG
;;
t) HLT=true
;;
h) usage 0
;;
esac
done
if [ "$ACCESS" = "ssh" ]; then
export [email protected]:
export ACCESS_CMSSW=--ssh
elif [ "$ACCESS" = "https" ]; then
export ACCESS_GITHUB=https://github.com/
export ACCESS_CMSSW=--https
else
usage 1
fi
# OS check: try redhat-release first to handle Singularity case
# kept in view of handling post-SL7 OS
if [[ -f "/etc/redhat-release" ]]; then
VERSION_TMP=`awk -F'[ .]' '{print $4}' "/etc/redhat-release"`
POSSIBLE_VERSIONS=( 7 )
if [[ "${POSSIBLE_VERSIONS[@]} " =~ "${VERSION_TMP}" ]]; then
SLC_VERSION="slc${VERSION_TMP}"
else
echo "WARNING::Unknown SLC version. Defaulting to SLC7."
SLC_VERSION="slc7"
fi
elif [[ `uname -r` == *"el7"* ]]; then
SLC_VERSION="slc7"
else
echo "WARNING::Unknown SLC version. Defaulting to SLC7."
SLC_VERSION="slc7"
fi
install_CMSSW(){
THIS_CMSSW="$1"
MINIMAL=
UPDATE_HLT=
# -------------------------------------------------------------------------------------
# CMSSW release area
# -------------------------------------------------------------------------------------
if [ -n "$THIS_CMSSW" ]; then
case $THIS_CMSSW in
CMSSW_8_0_*)
export SCRAM_ARCH=${SLC_VERSION}_amd64_gcc530
UPDATE_HLT=1
MINIMAL=1
;;
CMSSW_9_4_*)
export SCRAM_ARCH=${SLC_VERSION}_amd64_gcc630
MINIMAL=1
;;
CMSSW_10_2_*)
export SCRAM_ARCH=${SLC_VERSION}_amd64_gcc700
MINIMAL=1
;;
CMSSW_10_6_*)
export SCRAM_ARCH=${SLC_VERSION}_amd64_gcc700
;;
*)
$ECHO "Unknown architecture for release $THIS_CMSSW"
exit 1
;;
esac
scramv1 project CMSSW $THIS_CMSSW
cd $THIS_CMSSW
eval `scramv1 runtime -sh`
$ECHO "setup $CMSSW_VERSION"
fi
# -------------------------------------------------------------------------------------
# CMSSW compilation
# -------------------------------------------------------------------------------------
if [ -n "$THIS_CMSSW" ]; then
# reinitialize environment
eval `scramv1 runtime -sh`
cd src
git cms-init $ACCESS_CMSSW
git clone ${ACCESS_GITHUB}kpedro88/CondorProduction Condor/Production
git clone ${ACCESS_GITHUB}${FORK}/SVJProduction SVJ/Production -b ${BRANCH}
if [ -n "$UPDATE_HLT" ]; then
git cms-merge-topic -u cms-svj:ScoutingContent80Xmin
fi
if [ -n "$MINIMAL" ]; then
# don't need to compile SVJ-specific code for HLT
cd SVJ/Production
git config core.sparsecheckout true
{
echo '/batch'
echo '/python'
echo '/test'
} > .git/info/sparse-checkout
git read-tree -mu HEAD
# skip genproductions entirely
else
# use as little of genproductions as possible
git clone --depth 1 --no-checkout ${ACCESS_GITHUB}cms-svj/genproductions -b Run2_UL Configuration/GenProduction
# setup sparse checkout
cd Configuration/GenProduction
git config core.sparsecheckout true
{
echo '/Utilities'
echo '/bin/MadGraph5_aMCatNLO'
echo '!/bin/MadGraph5_aMCatNLO/cards'
echo '/MetaData'
} > .git/info/sparse-checkout
git read-tree -mu HEAD
fi
cd $CMSSW_BASE/src
scram b -j $CORES
cd SVJ/Production/batch
$CMSSW_BASE/src/Condor/Production/scripts/postInstall.sh -b $CMSSW_BASE/src/SVJ/Production/batch -c
fi
}
# run the installations
cd $CUR_DIR
install_CMSSW $WHICH_CMSSW
if [ -n "$HLT" ]; then
HLT_DIR=${CUR_DIR}/HLT
mkdir -p $HLT_DIR
for HLT_CMSSW in CMSSW_8_0_33_UL CMSSW_9_4_14_UL_patch1 CMSSW_10_2_16_UL; do
cd $HLT_DIR
install_CMSSW $HLT_CMSSW
done
fi