forked from opensbli/environment_and_run_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstallOPS.sh
More file actions
executable file
·151 lines (139 loc) · 3.81 KB
/
InstallOPS.sh
File metadata and controls
executable file
·151 lines (139 loc) · 3.81 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
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
#!/bin/bash
##@brief Download, compile and install OPS library
##@author Jianping Meng
##@contributors Pushpender Sharma Teja Ala
##@details
function usage {
echo "This script will download, compile and install the OPS library to a specified directory!"
echo "./$(basename $0) -h -> Showing usage"
echo "./$(basename $0) -d -> Specifying the directory for installation"
echo "./$(basename $0) -c -> Specifying the compiler"
echo "./$(basename $0) -H -> Specifying the HDF5 directory"
echo "./$(basename $0) -o -> Specifying the branch (e.g.,feature/HDF5Slice)"
echo "./$(basename $0) -m -> Specifying the machine type"
echo "./$(basename $0) -A -> Copy the CMake file for compiling applications to the directory"
echo "Machine type can be: Ubuntu ARCHER2 IRIDIS5 Fedora DAaaS"
echo "If without specifying the machine, the script will assume all dependencies prepared!"
}
optstring="hc:m:A:d:H:o:"
Compiler="Gnu"
Dir="$HOME/OPS_INSTALL"
Machine="None"
HDF5Root=""
Branch="develop"
AppCMakeDir=""
while getopts ${optstring} options; do
case ${options} in
h)
usage
exit 0
;;
c)
Compiler=${OPTARG}
;;
m)
Machine=${OPTARG}
;;
A)
AppCMakeDir=${OPTARG}
;;
d)
Dir=${OPTARG}
;;
H)
HDF5Root="-DHDF5_ROOT=${OPTARG}"
;;
o)
Branch="${OPTARG}"
;;
:)
echo "$0: Must supply an argument to -$OPTARG." >&2
exit 1
;;
?)
echo "Invalid option: -${OPTARG}."
exit 2
;;
esac
done
if [ $# -eq 0 ]
then
echo "This script will download, compile with ${Compiler} and install the OPS library to to ${Dir}!"
fi
# OPTIMISATION=-DCFLAG="-ftree-vectorize -funroll-loops"
# echo ${OPTIMISATION}
# #-DCXXFLAG="-ftree-vectorize -funroll-loops"
OPTIMISATION="-DCFLAG=-ftree-vectorize -DCXXFLAG=-ftree-vectorize"
if ! grep "CreateOpenSBLIEnv" /proc/$PPID/cmdline
then
if [ $Machine == "Ubuntu" ]
then
HDF5Lib="libhdf5-openmpi-dev"
if [ -z ${HDF5Root} ]
then
HDF5Lib=""
fi
sudo apt install libhdf5-mpi-dev build-essential ${HDF5Lib}
fi
if [ $Machine == "Fedora" ]
then
HDF5Lib="hdf5-openmpi-devel hdf5-devel"
if [ -z ${HDF5Root} ]
then
HDF5Lib=""
fi
sudo dnf install make automake gcc gcc-c++ kernel-devel ${HDF5Lib}
fi
fi
if [ $Machine == "CIRRUS" ]
then
module load nvidia/nvhpc/22.2
module load cmake/3.22.1
OPTIMISATION=""
if [ -z ${HDF5Root} ]
then
module load hdf5parallel/1.12.0-nvhpc-openmpi
fi
fi
if [ $Machine == "ARCHER2" ]
then
module purge PrgEnv-cray
module load load-epcc-module
module load cmake/3.21.3
module load PrgEnv-gnu
if [ -z ${HDF5Root} ]
then
module load cray-hdf5-parallel
fi
fi
if [ $Machine == "IRIDIS5" ]
then
module load gcc/6.4.0
if [ -z ${HDF5Root} ]
then
module load hdf5/1.10.2/gcc/parallel
fi
module load cuda/10.0
module load cmake
fi
#https://github.com/OP-DSL/OPS/archive/refs/heads/feature/HDF5Slice.zip
#https://github.com/OP-DSL/OPS/archive/refs/heads/BurgerEquation.zip
#OPS-feature-HDF5Slice/
#OPS-BurgerEquation
wget -c https://github.com/OP-DSL/OPS/archive/refs/heads/${Branch}.zip
FileName="$(basename -- $Branch)"
unzip "${FileName}.zip"
rm -r -f "${FileName}.zip"
SourceDir=OPS-`echo ${Branch} | sed 's/\//-/g'`
cd ${SourceDir}
if [ ! -z ${AppCMakeDir} ]
then
cp apps/c/CMakeLists.txt ${AppCMakeDir}
fi
mkdir build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=${Dir} -DCMAKE_BUILD_TYPE=Release ${OPTIMISATION} -DBUILD_OPS_APPS=OFF ${HDF5Root}
cmake --build . -j 4
cmake --install .
cd ../../
rm -r -f ${SourceDir}