-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·95 lines (86 loc) · 2.25 KB
/
setup.sh
File metadata and controls
executable file
·95 lines (86 loc) · 2.25 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
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
#!/bin/bash
ACCESS=ssh
CORES=8
BATCH=""
CMSSWVER=CMSSW_16_0_0_pre4
CMSSWVERS=(
CMSSW_16_0_0_pre4 \
)
usage(){
EXIT=$1
echo "setup.sh [options]"
echo ""
echo "-B configure some settings for checkout within batch setups (default = ${BATCH})"
echo "-C choose CMSSW version (default = ${CMSSWVER}, choices=${CMSSWVERS[@]})"
echo "-a [protocol] use protocol to clone (default = ${ACCESS}, alternative = https)"
echo "-j [cores] run CMSSW compilation on # cores (default = ${CORES})"
echo "-h display this message and exit"
exit $EXIT
}
# process options
while getopts "BC:a:j:h" opt; do
case "$opt" in
B) BATCH=--upstream-only
;;
C) CMSSWVER=$OPTARG
;;
a) ACCESS=$OPTARG
;;
j) CORES=$OPTARG
;;
h) usage 0
;;
esac
done
# check options
if [ "$ACCESS" = "ssh" ]; then
ACCESS_GITHUB=git@github.com:
ACCESS_GITLAB=ssh://git@gitlab.cern.ch:7999/
ACCESS_CMSSW=--ssh
elif [ "$ACCESS" = "https" ]; then
ACCESS_GITHUB=https://github.com/
ACCESS_GITLAB=https://gitlab.cern.ch/
ACCESS_CMSSW=--https
else
usage 1
fi
# check CMSSW version
if [[ ! " ${CMSSWVERS[@]} " =~ " $CMSSWVER " ]]; then
echo "Unsupported CMSSW version: $CMSSWVER"
usage 1
fi
# OS check: try redhat-release first to handle Singularity case
# kept in view of handling post-SL7 OS
declare -A OS_PREFIX
OS_PREFIX[7]=slc7
OS_PREFIX[8]=el8
OS_PREFIX[9]=el9
POSSIBLE_VERSIONS=( 7 8 9 )
if [[ -f "/etc/redhat-release" ]]; then
VERSION_TMP=$(grep -o "[0-9]\+\." /etc/redhat-release | head -n1 | cut -d'.' -f1)
if [[ "${POSSIBLE_VERSIONS[@]} " =~ "${VERSION_TMP}" ]]; then
SLC_VERSION="${OS_PREFIX[${VERSION_TMP}]}"
else
echo "WARNING::Unknown SLC version. Defaulting to SLC7."
SLC_VERSION="slc7"
fi
else
for POSVER in ${POSSIBLE_VERSIONS[@]}; do
if [[ `uname -r` == *"el${POSVER}"* ]]; then
SLC_VERSION="${OS_PREFIX[$POSVER]}"
break
fi
done
if [ -z "$SLC_VERSION" ]; then
echo "WARNING::Unknown SLC version. Defaulting to SLC7."
SLC_VERSION="slc7"
fi
fi
export SCRAM_ARCH=${SLC_VERSION}_amd64_gcc12
scram project $CMSSWVER
cd ${CMSSWVER}/src
eval `scramv1 runtime -sh`
git cms-init $ACCESS_CMSSW $BATCH
git clone ${ACCESS_GITHUB}fastmachinelearning/sonic-workflows -b CMSSW_16_0_X
cd ${CMSSW_BASE}/src
scram b -j ${CORES}