forked from aditimodi/iitm-esm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.sh
executable file
·280 lines (246 loc) · 7.88 KB
/
compile.sh
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
#!/bin/bash
set -e
ROOTDIR=$(pwd)
MACHINE="intel_pratyush"
debug=""
npes=8
while getopts 'dj:' flag; do
case "${flag}" in
d) debug=".debug" ;;
j) npes=$OPTARG ;;
esac
done
shift $(($OPTIND - 1))
opts=$@
EXECDIR="$ROOTDIR/exec"
SRCDIR="$ROOTDIR/src"
MKMF="$ROOTDIR/bin/mkmf"
MKMFTEMPLATE="$ROOTDIR/bin/mkmf.template.$MACHINE$debug"
. "$ROOTDIR/bin/env.$MACHINE"
echo '...............Compiling lib_fms for MoM4p1.....................'
libname='lib_fms.a'
libsrc='mom4p1/shared'
builddir=$EXECDIR/$libsrc
FMS_MOM=$SRCDIR/$libsrc
paths=" \
$FMS_MOM/astronomy \
$FMS_MOM/column_diagnostics \
$FMS_MOM/coupler \
$FMS_MOM/drifters \
$FMS_MOM/exchange \
$FMS_MOM/fft \
$FMS_MOM/field_manager \
$FMS_MOM/oda_tools \
$FMS_MOM/random_numbers \
$FMS_MOM/sat_vapor_pres \
$FMS_MOM/station_data \
$FMS_MOM/topography \
$FMS_MOM/tracer_manager \
$FMS_MOM/tridiagonal \
$FMS_MOM/include \
$FMS_MOM/platform \
$FMS_MOM/constants \
$FMS_MOM/fms \
$FMS_MOM/time_manager \
$FMS_MOM/mpp \
$FMS_MOM/diag_manager \
$FMS_MOM/memutils \
$FMS_MOM/constants \
$FMS_MOM/mpp/include \
$FMS_MOM/data_override \
$FMS_MOM/horiz_interp \
$FMS_MOM/time_interp \
$FMS_MOM/axis_utils \
$FMS_MOM/mosaic \
$FMS_MOM/amip_interp \
"
lib=$builddir/$libname
mkdir -p $builddir
cd $builddir
cppDefs="-Duse_netCDF4 -Duse_libMPI -DENABLE_ODA -DUSE_OCEAN_BGC"
$MKMF -c "$cppDefs" -f -p $libname -t $MKMFTEMPLATE $paths
make -j $npes
LIB_FMS_MOM=$lib
INC_FMS_MOM=$builddir
echo '...............Done.....................'
echo "#-------------------------MAKE MOM4P1--------------------------------------"
cppDef="-Duse_netCDF4 -Duse_libMPI -DENABLE_ODA -DUSE_OCEAN_BGC"
execname="ocean.exe"
libsrc="mom4p1"
builddir=$EXECDIR/$libsrc/mom4p1
mkdir -p $builddir
cd $builddir
SRC="$SRCDIR/$libsrc"
paths=" $SRC/atmos_param/diag_integral \
$SRC/atmos_param/monin_obukhov \
$SRC/mom4p1/ocean_bgc \
$SRC/mom4p1/ocean_core \
$SRC/mom4p1/ocean_diag \
$SRC/mom4p1/ocean_param/sources \
$SRC/mom4p1/ocean_param/mixing \
$SRC/mom4p1/ocean_param/gotm-4.0/include \
$SRC/mom4p1/ocean_param/gotm-4.0/turbulence \
$SRC/mom4p1/ocean_param/gotm-4.0/util \
$SRC/mom4p1/ocean_tracers \
$SRC/ocean_shared/generic_tracers \
$SRC/atmos_null \
$SRC/coupler \
$SRC/ice_sis \
$SRC/ice_param \
$SRC/rivers \
$SRC/shared/include \
"
OPTS="-I$INC_FMS_MOM"
LIBS="$LIB_FMS_MOM"
export LD=$FC
$MKMF -c "$cppDef" -f -p ${execname} -t $MKMFTEMPLATE -o "$OPTS" -l "$LIBS" $paths
make -j $npes
echo "#--------------------------------------------------------------------------------"
echo "#-------------------------MAKE NC_COMBINE--------------------------------------"
cppDef="-Dlib_mppnccp2r -Duse_libMPI"
exename=nc_combine.exe
libsrc="mom4p1/postprocessing/nc_combine"
paths="$SRCDIR/$libsrc"
builddir=$EXECDIR/$libsrc
mkdir -p $builddir
cd $builddir
export LD=$FC
OPTS="-I$INC_FMS_MOM"
LIBS="$LIB_FMS_MOM"
$MKMF -c "$cppDef" -f -p ${exename} -t $MKMFTEMPLATE -o "$OPTS" -l "$LIBS" $paths
make -j $numproc
echo "#--------------------------------------------------------------------------------"
echo "#-------------------------MAKE AOCOUPLER--------------------------------------"
cppDef="-Duse_netCDF4 -Duse_libMPI"
execname="aocoupler.exe"
libsrc="aocoupler"
paths="$SRCDIR/$libsrc"
builddir=$EXECDIR/$libsrc
export LD=$FC
mkdir -p $builddir
cd $builddir
$MKMF -c "$cppDef" -f -p ${execname} -t $MKMFTEMPLATE -o "$OPTS" -l "$LIBS" $paths
make -j $npes
echo "#--------------------------------------------------------------------------------"
echo '...............Compiling lib_bacio.....................'
cppDefs=""
libname='lib_bacio.a'
libsrc='gfs/lib/bacio'
builddir=$EXECDIR/$libsrc
paths=$SRCDIR/$libsrc
lib=$builddir/$libname
mkdir -p $builddir
cd $builddir
$MKMF -c "$cppDefs" -f -p $libname -t $MKMFTEMPLATE $paths
make -j $npes
LIB_BACIO=$lib
INC_BACIO=$builddir
echo '...............Done.....................'
echo '...............Compiling lib_w3nco.....................'
cppDefs="-DLINUX"
libname='lib_w3nco.a'
libsrc='gfs/lib/w3nco_v2.0.5'
builddir=$EXECDIR/$libsrc
paths=$SRCDIR/$libsrc
lib=$builddir/$libname
mkdir -p $builddir
cd $builddir
$MKMF -c "$cppDefs" -f -p $libname -t $MKMFTEMPLATE $paths
make -j $npes
LIB_W3NCO=$lib
INC_W3NCO=$builddir
echo '...............Done.....................'
echo '...............Compiling lib_w3emc.....................'
cppDefs="-DLINUX"
libname='lib_w3emc.a'
libsrc='gfs/lib/w3emc_v2.0.5'
builddir=$EXECDIR/$libsrc
paths=$SRCDIR/$libsrc
lib=$builddir/$libname
mkdir -p $builddir
cd $builddir
$MKMF -c "$cppDefs" -f -p $libname -t $MKMFTEMPLATE $paths
make -j $npes
LIB_W3EMC=$lib
INC_W3EMC=$builddir
echo '...............Done.....................'
echo '...............Compiling gfsio lib.....................'
libname='lib_gfsio.a'
libsrc='gfs/lib/gfsio'
builddir=$EXECDIR/$libsrc
paths=$SRCDIR/$libsrc
lib=$builddir/$libname
mkdir -p $builddir
cd $builddir
sed "s/\-r8//g" $MKMFTEMPLATE > mkmf.template
$MKMF -c "$cppDefs" -f -p $libname -t mkmf.template $paths
make -j $npes
LIB_GFSIO=$lib
INC_GFSIO=$builddir
echo '...............Done.....................'
echo '...............Compiling lib_fms_gfs.....................'
cppDefs="-Duse_netCDF -Duse_libMPI -DENABLE_ODA -Dfms_interp" # -Dtest_interp"
libname='lib_fms_gfs.a'
libsrc='gfs/shared'
builddir=$EXECDIR/$libsrc
SRC=$SRCDIR/$libsrc
paths="$SRC/mpp $SRC/include \
$SRC/mpp/include \
$SRC/fms $SRC/platform \
$SRC/memutils $SRC/constants \
$SRC/horiz_interp $SRC/mosaic \
"
lib=$builddir/$libname
mkdir -p $builddir
cd $builddir
$MKMF -c "$cppDefs" -f -p $libname -t $MKMFTEMPLATE $paths
make -j $npes
LIB_FMS_GFS=$lib
INC_FMS_GFS=$builddir
echo '...............Done.....................'
echo "#-------------------------MAKE GFS--------------------------------------"
cppDefs="-Duse_netCDF -Duse_libMPI -DENABLE_ODA -Dfms_interp" # -Dtest_interp"
execname="atm.exe"
libsrc="gfs"
SRC="$SRCDIR/$libsrc"
paths="$SRC/model $SRC/shared/include $SRC/shared/diag_manager"
builddir=$EXECDIR/$libsrc/gfs
export LD=$FC
mkdir -p $builddir
cd $builddir
OPTS="-I$INC_GFSIO -I$INC_BACIO -I$INC_W3NCO -I$INC_W3EMC -I$INC_FMS_GFS"
LIBS="$LIB_GFSIO $LIB_BACIO $LIB_W3EMC $LIB_W3NCO $LIB_FMS_GFS"
$MKMF -c "$cppDefs" -f -p ${execname} -t $MKMFTEMPLATE -o "$OPTS" -l "$LIBS" $paths
make -j $npes
echo "#--------------------------------------------------------------------------------"
echo "#-------------------------MAKE NC_COMBINE_GFS--------------------------------------"
cppDefs="-Duse_netCDF -Duse_libMPI -DENABLE_ODA -Dlib_mppnccp2r -DnotInterp"
execname="nc_combine_gfs.exe"
libsrc="gfs"
SRC="$SRCDIR/$libsrc"
paths="$SRC/nc_combine_gfs $SRC/shared/include \
$SRC/shared/diag_manager $SRC/model/time_manager.F90"
builddir=$EXECDIR/$libsrc/nc_combine_gfs
export LD=$FC
mkdir -p $builddir
cd $builddir
OPTS="-I$INC_FMS_GFS"
LIBS="$LIB_FMS_GFS"
$MKMF -c "$cppDefs" -f -p ${execname} -t $MKMFTEMPLATE -o "$OPTS" -l "$LIBS" $paths
make -j $npes
echo "#--------------------------------------------------------------------------------"
echo "#-------------------------MAKE sfc_ini_surface--------------------------------------"
cppDefs="-Duse_netCDF -Duse_libMPI -Dlib_xgrid -DENABLE_ODA -Dfms_interp" # -Dtest_interp"
execname="sfc_ini_surface.exe"
libsrc="gfs/sfc_ini_surface"
SRC="$SRCDIR/$libsrc"
paths="$SRC"
builddir=$EXECDIR/$libsrc
export LD=$FC
mkdir -p $builddir
cd $builddir
OPTS="-I$INC_GFSIO -I$INC_BACIO -I$INC_W3NCO -I$INC_W3EMC -I$INC_FMS_GFS"
LIBS="$LIB_GFSIO $LIB_BACIO $LIB_W3EMC $LIB_W3NCO $LIB_FMS_GFS"
$MKMF -c "$cppDefs" -f -p ${execname} -t $MKMFTEMPLATE -o "$OPTS" -l "$LIBS" $paths
make -j $npes
echo "#--------------------------------------------------------------------------------"