-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.install
executable file
·414 lines (301 loc) · 11 KB
/
main.install
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
#!/bin/bash
# Script that downloads and installs the libraries required to install and run for AWI-CM3
# Needs c and fortran compilers, as well as MPI distribution already available
#=================================================================#
#=================================================================#
# Configuration
# Which libraries shall be installed?
switch_openmpi=
switch_zlib=
switch_szip=
switch_libaec=
switch_hdf5=
switch_netcdfc=
switch_netcdff=
switch_eccodes=t
switch_grads=
switch_perl=
switch_cdo=
switch_nco=
# Which versions shall be installed?
version_openmpi=4.1.5
version_zlib=1.3.1
version_szip=2.1.1
version_libaec=1.1.3
version_hdf5=1.14.3
version_netcdfc=4.9.0
version_netcdff=4.6.1
version_eccodes=2.34.1
version_grads=2.2.1
version_perl=5.32.0
version_cdo=1.9.9
version_nco=5.0.6
# Where should the tarballs be downloaded from?
site_openmpi=https://download.open-mpi.org/release/open-mpi/v4.1
site_zlib=https://zlib.net/
site_szip=https://support.hdfgroup.org/ftp/lib-external/szip/
site_libaec=https://gitlab.dkrz.de/k202009/libaec/-/archive/
site_hdf5=https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/ #Note: this is the release version, not the package version
site_netcdfc=https://github.com/Unidata/netcdf-c/archive/refs/tags/
site_netcdff=https://github.com/Unidata/netcdf-fortran/archive/refs/tags/
site_eccodes=https://confluence.ecmwf.int/download/attachments/45757960/
site_grads=ftp://cola.gmu.edu/grads/2.2/ #Note: this 2.2 is the release version, not the package version
site_perl=http://www.cpan.org/src/5.0/ #Note: this 5.0 is the release version, not the package version
site_cdo=https://code.mpimet.mpg.de/attachments/download/23323/
site_nco=https://github.com/nco/nco/archive/
# Which server are we installing on?
#source [email protected]
#source [email protected]
#source [email protected]
#source [email protected]
#source [email protected]
#source [email protected]
#source [email protected]
#source [email protected]
#source [email protected]
#source config.levante_intel_systemlibs.dkrz.de
source [email protected]
# End of user configuration
#=================================================================#
#=================================================================#
# Install OpenMPI
if [ "$switch_openmpi" = t ] ; then
url=${site_openmpi}/openmpi-${version_openmpi}.tar.gz
mkdir -p ${build_dir}
pushd ${build_dir}
wget -nc ${url}
tar xzf openmpi-${version_openmpi}.tar.gz
pushd openmpi-${version_openmpi}
CC=${CC} CFLAGS=-w ./configure \
--prefix=${prefix} \
2>&1 | tee openmpi_configure.log
make all 2>&1 | tee openmpi_compile.log
make install 2>&1 | tee openmpi_install.log
popd
popd
fi
export OPENMPI_ROOT=$prefix
#=================================================================#
#=================================================================#
# Install ZLIB
if [ "$switch_zlib" = t ] ; then
url=${site_zlib}/zlib-${version_zlib}.tar.gz
mkdir -p ${build_dir}
pushd ${build_dir}
wget -nc ${url}
tar xzf zlib-${version_zlib}.tar.gz
pushd zlib-${version_zlib}
CC=${CC} CFLAGS=-w ./configure \
--prefix=${prefix} 2>&1 | tee zlib_configure.log
make all 2>&1 | tee zlib_compile.log
make install 2>&1 | tee zlib_install.log
popd
popd
fi
export ZLIB_ROOT=$prefix
#=================================================================#
#=================================================================#
# Install SZIP
if [ "$switch_szip" = t ] ; then
url=${site_szip}/${version_szip}/src/szip-${version_szip}.tar.gz
mkdir -p ${build_dir}
pushd ${build_dir}
echo ${url}
wget -nc ${url}
tar xzf szip-${version_szip}.tar.gz
pushd szip-${version_szip}
CC=${CC} CFLAGS=-w ./configure \
--prefix=${prefix} 2>&1 | tee szip_configure.log
make all 2>&1 | tee szip_compile.log
make install 2>&1 | tee szip_install.log
popd
popd
fi
export SZIP_ROOT=$prefix
#=================================================================#
#=================================================================#
# Install LIBAEC
if [ "$switch_libaec" = t ] ; then
url=${site_libaec}/v${version_libaec}/libaec-${version_libaec}.tar.gz
mkdir -p ${build_dir}
pushd ${build_dir}
wget -nc ${url}
tar xzf libaec-${version_libaec}.tar.gz
mv libaec-v${version_libaec}-* libaec-${version_libaec}
pushd libaec-${version_libaec}
cmake DCMAKE_INSTALL_PREFIX=${prefix} . 2>&1 | tee libaec_configure.log
make all 2>&1 | tee libaec_compile.log
make install DESTDIR=${prefix} prefix=${prefix} 2>&1 | tee libaec_install.log
mkdir -p ${prefix}/lib/
mkdir -p ${prefix}/include/
cp ${prefix}/usr/local/lib64/* ${prefix}/lib/
cp ${prefix}/usr/local/include/* ${prefix}/include/
popd
popd
fi
export AEC_ROOT=/sw/spack-levante/libaec-1.0.5-gij7yv/
export LIBAEC_ROOT=/sw/spack-levante/libaec-1.0.5-gij7yv/
#=================================================================#
#=================================================================#
# Install HDF5 1.10.5 with parallel I/O
if [ "$switch_hdf5" = t ] ; then
url=${site_hdf5}/hdf5-${version_hdf5}/src/hdf5-${version_hdf5}.tar.gz
mkdir -p ${build_dir}
pushd ${build_dir}
wget -nc ${url}
tar xzf hdf5-${version_hdf5}.tar.gz
pushd hdf5-${version_hdf5}
#CC=${CC} CPPFLAGS=-I${prefix}/include LDFLAGS=-L${prefix}/lib CFLAGS=-w ./configure \
# --disable-static \
# --enable-parallel \
# --enable-fortran \
# --prefix=${prefix} 2>&1 | tee hdf5_configure.log
make all 2>&1 | tee hdf5_compile.log
make install 2>&1 | tee hdf5_install.log
mkdir -p ${prefix}/lib
mkdir -p ${prefix}/include
ln -s ${build_dir}/hdf5-${version_hdf5}/hdf5/lib/* ${prefix}/lib/
ln -s ${build_dir}/hdf5-${version_hdf5}/hdf5/include/* ${prefix}/include/
popd
popd
fi
export HDF5_ROOT=$prefix
#=================================================================#
#=================================================================#
# Install parallel NetCDF using parallel HDF5
if [ "$switch_netcdfc" = t ] ; then
url=${site_netcdfc}/v${version_netcdfc}.tar.gz
mkdir -p ${build_dir}
pushd ${build_dir}
wget -nc ${url}
tar zxf v${version_netcdfc}.tar.gz
pushd netcdf-c-${version_netcdfc}
CC=${CC} CPPFLAGS=-I${prefix}/include LDFLAGS=-L${prefix}/lib ./configure \
--enable-netcdf4 \
--disable-dap \
--prefix=${prefix} 2>&1 | tee netcdf_configure.log
make all 2>&1 | tee netcdf_compile.log
make install 2>&1 | tee netcdf_install.log
popd
popd
fi
export NetCDF_C_ROOT="/work/ab0995/a270270/software/netcdf_combined"
export LD_LIBRARY_PATH=${NetCDF_C_ROOT}/lib:${LD_LIBRARY_PATH}
#=================================================================#
#=================================================================#
# Install NetCDF Fortran
if [ "$switch_netcdff" = t ] ; then
url=${site_netcdff}/v${version_netcdff}.tar.gz
mkdir -p ${build_dir}
pushd ${build_dir}
wget -nc ${url}
tar zxf v${version_netcdff}.tar.gz
pushd netcdf-fortran-${version_netcdff}
FC=${FC} CC=${CC} FCFLAGS=${FCFLAGS} CPPFLAGS=-I${prefix}/include LDFLAGS=-L${prefix}/lib ./configure \
--prefix=${prefix} 2>&1 | tee netcdff_configure.log
make all 2>&1 | tee netcdff_compile.log
make install 2>&1 | tee netcdff_install.log
popd
popd
fi
export NetCDF_FORTRAN_ROOT="/work/ab0995/a270270/software/netcdf_combined"
#=================================================================#
#=================================================================#
#Installing eccodes
if [ "$switch_eccodes" = t ] ; then
url=${site_eccodes}/eccodes-${version_eccodes}-Source.tar.gz
mkdir -p ${build_dir}
cd ${build_dir}
wget -nc ${url}
tar zxf eccodes-${version_eccodes}-Source.tar.gz
cmake eccodes-${version_eccodes}-Source \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_Fortran_COMPILER=${FC} \
-DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
-DENABLE_NETCDF=ON \
-DENABLE_AEC=ON \
-DENABLE_ECCODES_OMP_THREADS=ON \
-DENABLE_JPG=OFF \
-DENABLE_PNG=OFF \
-DENABLE_PYTHON=ON \
-DENABLE_FORTRAN=ON \
-DECBUILD_DISABLE_RPATH_FIX=ON \
-DBUILD_SHARED_LIBS=BOTH
make -j 4 | tee eccodes_make.out
make check | tee eccodes_check.out
make install | tee eccodes_install.out
ln -s $prefix/lib64/* $prefix/lib/
fi
#=================================================================#
#=================================================================#
# Install Grads
if [ "$switch_grads" = t ] ; then
url=${site_grads}/grads-${version_grads}-src.tar.gz
mkdir -p ${build_dir}
pushd ${build_dir}
wget -nc ${url}
tar zxf grads-${version_grads}-src.tar.gz
pushd grads-${version_grads}
FC=${FC} CC=${CC} CPPFLAGS=-I${prefix}/include LDFLAGS=-L${prefix}/lib ./configure \
--prefix=${prefix} 2>&1 | tee grads_configure.log
make all 2>&1 | tee grads_compile.log
make install 2>&1 | tee grads_install.log
popd
popd
fi
export GRADS_ROOT=$prefix
#=================================================================#
#=================================================================#
# Install Perl
if [ "$switch_perl" = t ] ; then
url=${site_perl}/perl-${version_perl}.tar.gz
mkdir -p ${build_dir}
pushd ${build_dir}
wget -nc ${url}
tar zxf perl-${version_perl}.tar.gz
pushd perl-${version_perl}
./Configure -des -Dprefix=${prefix}/perl-${version_perl} -Dotherlibdirs=${prefix}/lib
make all 2>&1 | tee perl_compile.log
make install 2>&1 | tee perl_install.log
curl -sL https://cpanmin.us | ${prefix}/perl-${version_perl}/bin/perl - --notest -l ${prefix}/perl-${version_perl} App::cpanminus Time::Piece URI
popd
popd
fi
export PERL_ROOT=$prefix
#=================================================================#
#=================================================================#
# Install CDO
if [ "$switch_cdo" = t ] ; then
url=${site_cdo}/cdo-${version_cdo}.tar.gz
mkdir -p ${build_dir}
pushd ${build_dir}
wget -nc ${url}
tar zxf cdo-${version_cdo}.tar.gz
pushd cdo-${version_cdo}
./configure FC=${FC} F77=${F77} CPPFLAGS='' CFLAGS="" FCFLAGS="" CC=${CC} CXX=$CXX CPP="$CXX -E" LDFLAGS="$LDFLAGS -L${prefix}/lib -Wl,-rpath=${prefix}/lib" --prefix=${prefix} --with-szlib=${prefix} --disable-cgribex --with-netcdf=${prefix} --with-hdf5=${prefix} --enable-hirlam-extensions=yes --with-eccodes=${prefix}
make -j24 2>&1 | tee cdo_compile.log
make install 2>&1 | tee cdo_install.log
popd
popd
fi
export CDO_ROOT=$prefix
#=================================================================#
#=================================================================#
# Install NCO
if [ "$switch_nco" = t ] ; then
url=${site_nco}/${version_nco}.tar.gz
mkdir -p ${build_dir}
pushd ${build_dir}
wget -nc ${url}
tar zxf ${version_nco}.tar.gz
pushd nco-${version_nco}
./configure NETCDF_ROOT=${prefix} --prefix=${prefix}
make 2>&1 | tee nco_compile.log
make install 2>&1 | tee nco_install.log
popd
popd
fi
export NCO_ROOT=$prefix
printf "============================="
printf "Library installation finished"
printf "============================="