-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakeDataLinksInLCRC
executable file
·118 lines (97 loc) · 3.36 KB
/
MakeDataLinksInLCRC
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
#!/bin/bash
if [ $0 != "-bash" ]; then
echo -e "\e[93m PLEASE source MakeDataLinksInLCRC \e[0m"
exit
fi
echo -e "\e[92m#############################################"
echo -e "# Make data link for LCRC"
echo -e "#############################################\e[0m"
DATAPATH=/lcrc/project/HELIOS/experimentsData/
expDIR=$(pwd)
echo " This bash script do only 2 things: "
echo " 1) change the expName.sh"
echo " 2) setup symbolic link to the exp data."
echo ""
echo " This script is assume you will work at the master branch."
echo " If not, please use SetUpNewExp "
echo "--------------------------------------------"
if [ $# -eq 0 ]; then
git branch -a
read -p 'Eneter the experiment name: ' expName
else
expName=$1
fi
isBranchExist=`git branch -a | grep ${expName} | wc -l`
if [ ${isBranchExist} -eq 0 ]; then
echo "Experimental name (${expName}) does not exist. Abort."
exit
fi
if [ ${expName} == "master" ] || [ ${expName} == "ARR01" ]; then
echo -e "\e[93m============ Restore everything to master \e[0m"
git checkout master expName.sh
git checkout master ${expDIR}/analysis/working/GeneralSortMapping.h
expName="ARR01"
isMaster=1
else
echo -e "\e[93m=================== Overwrite the expName.sh \e[0m"
echo "!!!!!!!!!! to restore the expName.sh by > git checkout expName.sh"
echo "#!/bin/bash -l" > ${expDIR}/expName.sh
echo "expName=${expName}" >> ${expDIR}/expName.sh
isMaster=0
fi
echo -e "\e[93m=================== Exp Name : ${expName} \e[0m"
Data=${DATAPATH}/${expName}/data
mergedData=${DATAPATH}/${expName}/merged_data
rootData=${DATAPATH}/${expName}/root_data
#===== Check folder exist
echo -e "\e[93m=================== create folders \e[0m"
if [ -d ${Data} ]; then
echo " ${Data} ....... already exist."
else
mkdir -pv ${Data}
fi
if [ -d ${mergedData} ]; then
echo " ${mergedData} ... already exist."
else
mkdir -pv ${mergedData}
fi
if [ -d ${rootData} ]; then
echo " ${rootData} .. already exist."
else
mkdir -pv ${rootData}
fi
#===== create symbolic links
echo -e "\e[93m=================== creating symbolic links \e[0m"
rm -f ${expDIR}/analysis/data
rm -f ${expDIR}/analysis/merged_data
rm -f ${expDIR}/analysis/root_data
ln -sfv ${Data} ${expDIR}/analysis/data
ln -sfv ${mergedData} ${expDIR}/analysis/merged_data
ln -sfv ${rootData} ${expDIR}/analysis/root_data
#===== sourse the heliosrc.sh
echo -e "\e[93m=================== source heliosrc.sh \e[0m"
echo $(pwd)
cd $(pwd)
source heliosrc.sh
env | grep "HELIOSSYS"
#===== checkout the mapping
if [ ${isMaster} == 0 ]; then
echo -e "\e[93m=================== Checkout the mapping from the branch \e[0m"
cd ${HELIOSSYS}/analysis/working
git checkout origin/${expName} GeneralSortMapping.h
isNewMapping=$(grep -rn "NARRAY" GeneralSortMapping.h)
if [ -z ${isNewMapping} ]; then
echo " patching up old Mapping file"
echo "#define NARRAY 30" >> GeneralSortMapping.h
echo "#define NRDT 8" >> GeneralSortMapping.h
echo "#define NELUM 16" >> GeneralSortMapping.h
echo "#define NEZERO 5" >> GeneralSortMapping.h
echo "#define NTAC 3" >> GeneralSortMapping.h
echo "#define NCRDT 0" >> GeneralSortMapping.h
fi
cd ${HELIOSSYS}
fi
echo -e "\e[93m=================== done. \e[0m"
if [ ${isMaster} == 0 ]; then
echo -e "\e[91m to restor to master > simple run the script again and pick master \e[0m "
fi