-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup_cmake
executable file
·194 lines (165 loc) · 7.46 KB
/
setup_cmake
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/bin/bash
#
# setup_cmake Chooses the correct cmake build command for a machine.
#
#-------------------------------------------------------------------------------
BUILD_TYPE=Debug
MACHINE_ID=`uname -n`
echo Building KORC for machine $MACHINE_ID
echo
echo cmake configured to generate a $BUILD_TYPE build.
# CMake doesn't like being reconfigured completely. To avoid problems this
# script will delete the CMakeCache.txt file allowing this script to start
# from a clean slate. Use the -f option on rm to silence any errors from
# rm. This makes will cause rm to ignore the error to occur if
# CMakeCache.txt doesn't exist.
rm -f CMakeCache.txt
rm -rf CMakeFiles
echo
if [ $MACHINE_ID == "MBP115573" ]
then
# Config for Matt Beidler's ORNL machine.
rm -f CMakeCache.txt
rm -rf CMakeFiles
rm ./src/*.mod
rm -rf ./build
mkdir ./build
export CC=/usr/local/bin/gcc-13
export CXX=/usr/local/bin/g++-13
export FC=/usr/local/bin/gfortran-13
cmake -DCMAKE_BUILD_TYPE:String=$BUILD_TYPE \
-DMPI_Fortran_LINK_FLAGS="-ld_classic -Wl,-flat_namespace -Wl,-commons,use_dylibs -L/usr/local/Cellar/hwloc/2.10.0/lib -L/usr/local/Cellar/libevent/2.1.12_1/lib" \
-DUSE_OMP=ON \
-DUSE_PSPLINE=OFF \
-DUSE_FIO=OFF \
-DCORI_DIR=OFF \
-DKORC_TEST=OFF \
-DCMAKE_Fortran_FLAGS="-O3 -DHDF5_DOUBLE_PRESICION -fopenmp" \
-DCMAKE_C_FLAGS="-O3 -fopenmp" \
-DCMAKE_CXX_FLAGS="-O3 -fopenmp" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g -ffpe-trap=invalid,zero,overflow -fbacktrace -Werror" \
-DCMAKE_C_FLAGS_DEBUG="-g -g3" \
-DCMAKE_CXX_FLAGS_DEBUG="-g -g3" \
-DFIO_LIBRARIES=/Users/21b/Desktop/KORC/FIO/install/lib/libfusionio.a \
-DM3DC1_LIBRARIES=/Users/21b/Desktop/KORC/FIO/install/lib/libm3dc1.a \
-DFIO_INCLUDE_PATH=/Users/21b/Desktop/KORC/FIO/install/include \
-DFIO_LINK_FLAGS="-L/Users/21b/Desktop/KORC/FIO/install/lib -lfusionio -lm3dc1" \
-DFRUIT_INCLUDE_PATH=/Users/21b/Desktop/KORC/test/fruit \
-DFRUIT_LINK_FLAGS="-L/Users/21b/Desktop/KORC/test/fruit -lfruit" \
-DFRUIT_LIBRARIES=/Users/21b/Desktop/KORC/test/fruit/libfruit.a \
-DKORCSRC_INCLUDE_PATH=/Users/21b/Desktop/KORC/build/modules \
-DKORCSRC_LINK_FLAGS="-L/Users/21b/Desktop/KORC/build/lib -lkorcsrc" \
-DKORCSRC_LIBRARIES=/Users/21b/Desktop/KORC/build/lib/libkorcsrc.a \
-DNIMROD_INCLUDE_PATH=/Users/21b/Desktop/NIMROD/NIMUW/nimrod \
-DNIMFIO_INCLUDE_PATH=/Users/21b/Desktop/NIMROD/NIMUW/nimfio \
-DNIMFIO_LINK_FLAGS="-L/Users/21b/Desktop/NIMROD/NIMUW/nimfio -lnimfio" \
-DNIMFIO_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/nimfio/libnimfio.a \
-DNIMCORE_INCLUDE_PATH=/Users/21b/Desktop/NIMROD/NIMUW/nimcore \
-DNIMCORE_LINK_FLAGS="-L/Users/21b/Desktop/NIMROD/NIMUW/nimcore -lnimblock -lnimbltype -lnimlocate -lnimmatrix -lnimiter -lnimpar" \
-DNIMBLK_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/nimcore/libnimblock.a \
-DNIMBTY_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/nimcore/libnimbltype.a \
-DNIMLOC_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/nimcore/libnimlocate.a \
-DNIMMAT_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/nimcore/libnimmatrix.a \
-DNIMITER_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/nimcore/libnimiter.a \
-DNIMPAR_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/nimcore/libnimpar.a \
-DNIMLIB_INCLUDE_PATH=/Users/21b/Desktop/NIMROD/NIMUW/nimlib \
-DNIMLIB_LINK_FLAGS="-L/Users/21b/Desktop/NIMROD/NIMUW/nimlib -lnimlib -lnimmpi" \
-DNIMLIB_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/nimlib/libnimlib.a \
-DNIMMPI_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/nimlib/libnimmpi.a \
-DNIMEXT_INCLUDE_PATH=/Users/21b/Desktop/NIMROD/NIMUW/externals \
-DNIMEXT_LINK_FLAGS="-L/Users/21b/Desktop/NIMROD/NIMUW/externals -llapack_dummy -lsslu_dummy -lslud_dummy" \
-DNIMLAP_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/externals/liblapack_dummy.a \
-DNIMSLU_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/externals/libsslu_dummy.a \
-DNIMLUD_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/externals/libslud_dummy.a \
elif [ $LMOD_SYSTEM_NAME == "perlmutter" ]
then
HARDWARE_TYPE=GPU
rm -f CMakeCache.txt
rm -rf CMakeFiles
rm ./src/*.mod
rm -rf ./build
mkdir ./build && cd $_
if [ "$HARDWARE_TYPE" == CPU ]
then
cmake \
-DCMAKE_BUILD_TYPE:String=$BUILD_TYPE \
-DUSE_OMP=ON \
-DCMAKE_Fortran_FLAGS="-Mfree -Mpreprocess -fPIC -O3 -mp -Mvect=simd:256 -Mbyteswapio -DHDF5_DOUBLE_PRESICION" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g -Minfo=all -Minstrument -traceback -lnvhpcwrapnvtx" \
-DCMAKE_C_FLAGS="-O3 -mp -Mvect=simd:256" \
-DCMAKE_C_FLAGS_DEBUG="-g -Minfo=all -traceback" \
-DCMAKE_CXX_FLAGS="-O3 -std=c++11 -mp -Mvect=simd:256" \
-DCMAKE_CXX_FLAGS_DEBUG="-g -Minfo=all -traceback" \
-DUSE_PSPLINE=ON \
..
elif [ "$HARDWARE_TYPE" == GPU ]
then
cmake \
-DCMAKE_BUILD_TYPE:String=$BUILD_TYPE \
-DUSE_OMP=OFF \
-DUSE_ACC=ON \
-DUSE_PSPLINE=ON \
-DCMAKE_Fortran_FLAGS="-fast -acc=gpu -gpu=deepcopy,cc80,lineinfo -Mfree -fPIC -O3 -Mpreprocess -DHDF5_DOUBLE_PRESICION" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g -Minfo=all -Minstrument -traceback -lnvhpcwrapnvtx" \
-DCMAKE_C_FLAGS="-O3 -mp" \
-DCMAKE_C_FLAGS_DEBUG="-g -Minfo=all -traceback" \
-DCMAKE_CXX_FLAGS="-O3 -std=c++11 -mp" \
-DCMAKE_CXX_FLAGS_DEBUG="-g -Minfo=all -traceback" \
..
else
echo " choose a valid hardware type "
fi
[[ $? -eq 0 ]] && make VERBOSE=1
elif [ $HOSTNAME == "checkerboard.ornl.gov" ]
then
HARDWARE_TYPE=GPU
rm -f CMakeCache.txt
rm -rf CMakeFiles
rm ./src/*.mod
rm -rf ./build
mkdir ./build && cd $_
export CC=nvc
export CXX=nvc++
export FC=nvfortran
if [ "$HARDWARE_TYPE" == CPU ]
then
cmake \
-DCMAKE_BUILD_TYPE:String=$BUILD_TYPE \
-DUSE_OMP=ON \
-DCMAKE_Fortran_FLAGS="-Mfree -Mpreprocess -fPIC -O3 -mp -Mvect=simd:256 -Mbyteswapio -DHDF5_DOUBLE_PRESICION" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g -Minfo=all -Minstrument -traceback -lnvhpcwrapnvtx" \
-DCMAKE_C_FLAGS="-O3 -mp -Mvect=simd:256" \
-DCMAKE_C_FLAGS_DEBUG="-g -Minfo=all -traceback" \
-DCMAKE_CXX_FLAGS="-O3 -std=c++11 -mp -Mvect=simd:256" \
-DCMAKE_CXX_FLAGS_DEBUG="-g -Minfo=all -traceback" \
-DUSE_PSPLINE=ON \
..
elif [ "$HARDWARE_TYPE" == GPU ]
then
cmake \
-DCMAKE_BUILD_TYPE:String=$BUILD_TYPE \
-DCMAKE_PREFIX_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.5/comm_libs/openmpi/openmpi-3.1.5/lib/ \
-DUSE_OMP=OFF \
-DUSE_ACC=ON \
-DUSE_PSPLINE=ON \
-DCMAKE_Fortran_FLAGS="-fast -acc=gpu -gpu=deepcopy -Mfree -fPIC -O3 -Mpreprocess -DHDF5_DOUBLE_PRESICION" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g -Minfo=all -Minstrument -traceback -lnvhpcwrapnvtx" \
-DCMAKE_C_FLAGS="-O3 -mp" \
-DCMAKE_C_FLAGS_DEBUG="-g -Minfo=all -traceback" \
-DCMAKE_CXX_FLAGS="-O3 -std=c++11 -mp" \
-DCMAKE_CXX_FLAGS_DEBUG="-g -Minfo=all -traceback" \
..
else
echo " choose a valid hardware type "
fi
[[ $? -eq 0 ]] && make VERBOSE=1
else
# MACHINE_ID is new and unknown. Inform the user how to add support for this new machine.
echo $MACHINE_ID not suported by this script.
echo To support this machine, add a new elif statement of the form
echo
echo elif [ \$MACHINE_ID == \"$MACHINE_ID\" ]
echo then
echo " " cmake -DVARIABLE=value ...
echo
fi