-
Notifications
You must be signed in to change notification settings - Fork 16
/
build_interface_pdaf.ksh
executable file
·287 lines (255 loc) · 10.1 KB
/
build_interface_pdaf.ksh
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
#! /bin/ksh
#
always_da(){
route "${cyellow}>> always_da${cnormal}"
route "${cyellow}<< always_da${cnormal}"
}
substitutions_da(){
route "${cyellow}>> substitutions_da${cnormal}"
c_substitutions_pdaf
route "${cyellow}<< substitutions_da${cnormal}"
}
configure_da(){
route "${cyellow}>> configure_da${cnormal}"
#PDAF part configuration variables
export PDAF_DIR=$dadir
if [[ $compiler == "Gnu" ]]; then
export PDAF_ARCH=linux_gfortran_openmpi
else
export PDAF_ARCH=linux_ifort
fi
if [[ $profiling == "scalasca" ]]; then
comFC="scorep-mpif90"
comCC="scorep-mpicc"
else
comFC="${mpiPath}/bin/mpif90"
comCC="${mpiPath}/bin/mpicc"
fi
pdaflib_cpp_defs=" "
# pdaflib_cpp_defs+=" -DPDAF_DEBUG "
# libs_src=" -L$lapackPath -L${mpiPath}/lib64"
# libs_src=" -L$lapackPath -lopenblas -L${mpiPath}/lib64"
# libs_src=" $lapackPath/mkl/lib/intel64/libmkl_intel_lp64.a $lapackPath/mkl/lib/intel64/libmkl_intel_thread.a $lapackPath/mkl/lib/intel64/libmkl_core.a -L${mpiPath}/lib64"
# libs_src=" -L$lapackPath -llapack -lblas -L${mpiPath}/lib64"
# libs_src=" -L$lapackPath/mkl/lib/intel64 -Wl,--no-as-needed -lmkl_scalapack_ilp64 -lmkl_cdft_core -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lmkl_blacs_intelmpi_ilp64 -lm -ldl -L${mpiPath}/lib64 -lirc -lintlc"
if [[ $compiler == "Gnu" ]]; then
libs_src=" -ldl $lapackPath/mkl/latest/lib/intel64/libmkl_gf_lp64.a $lapackPath/mkl/latest/lib/intel64/libmkl_gnu_thread.a $lapackPath/mkl/latest/lib/intel64/libmkl_core.a -L${mpiPath}/lib64"
else
libs_src=" $lapackPath/mkl/latest/lib/intel64/libmkl_intel_lp64.a $lapackPath/mkl/latest/lib/intel64/libmkl_intel_thread.a $lapackPath/mkl/latest/lib/intel64/libmkl_core.a -L${mpiPath}/lib64"
fi
c_configure_pdaf_arch
#PDAF interface part configuration variables
importFlags=" "
importFlagsOAS=" "
importFlagsPFL=" "
importFlagsCLM=" "
importFlagsCOS=" "
importFlagsDA=" "
cppdefs=" "
# cppdefs+=" ${pf}-DOLD_TRUNCATE_SAT "
# cppdefs+=" ${pf}-DPDAF_DEBUG "
obj=' '
libs=" -L$mpiPath -lmpich -L$netcdfPath/lib/ -lnetcdff -lnetcdf "
libsOAS=" "
libsPFL=" "
libsCLM=" "
libsCOS=" "
pf=""
# Oasis include dirs
importFlagsOAS+="-I$oasdir/$platform/build/lib/psmile.MPI1 "
importFlagsOAS+="-I$oasdir/$platform/build/lib/scrip "
# CLM include dirs
importFlagsCLM+="-I$clmdir/build/ "
# COSMO include dirs
importFlagsCOS+="-I$cosdir/obj "
# ParFlow include dirs
importFlagsPFL+="-I$pfldir/pfsimulator/parflow_lib "
importFlagsPFL+="-I$pfldir/pfsimulator/amps/oas3 "
importFlagsPFL+="-I$pfldir/pfsimulator/amps/common "
if [[ ${mList[3]} == parflow ]] ; then
importFlagsPFL+="-I$pfldir/build/include "
if [[ $processor == "GPU" ]]; then
importFlagsPFL+="-I$pfldir/rmm/include/rmm "
fi
else
importFlagsPFL+="-I$pfldir/pfsimulator/include "
fi
# DA include dirs
importFlagsDA+="-I$dadir/interface/model/common "
if [[ $withPFL == "true" ]] ; then
importFlagsDA+="-I$dadir/interface/model/${mList[3]} "
fi
# Oasis libraries
libsOAS+="-lpsmile.MPI1 "
libsOAS+="-lmct "
libsOAS+="-lmpeu "
libsOAS+="-lscrip "
# CLM libraries
libsCLM+="-lclm "
# COSMO libraries
libsCOS+="-lcosmo "
if [[ ${mList[2]} == "cosmo5_1" ]] ; then
libsCOS+="-L$gribPath/lib/ "
libsCOS+="-leccodes_f90 "
libsCOS+="-leccodes "
else
libsCOS+="$grib1Path/libgrib1.a "
fi
# ParFlow library paths and libraries
libsPFL+="-lpfsimulator "
libsPFL+="-lamps "
libsPFL+="-lpfkinsol "
libsPFL+="-lgfortran "
libsPFL+="-lcjson "
if [[ $processor == "GPU" ]]; then
libsPFL+="-lstdc++ "
libsPFL+="-lcudart "
libsPFL+="-lrmm "
libsPFL+="-lnvToolsExt "
fi
libsPFL+="-L$hyprePath/lib -lHYPRE "
libsPFL+="-L$siloPath/lib -lsilo "
if [[ $withOAS == "false" && $withPFL == "true" ]] ; then
importFlags+=$importFlagsPFL
importFlags+=$importFlagsDA
cppdefs+=" ${pf}-DPARFLOW_STAND_ALONE "
libs+=$libsPFL
obj+=' $(OBJPF) '
fi
if [[ $withOAS == "false" && $withCLM == "true" ]] ; then
if [[ ${mList[1]} == clm3_5 ]] ; then
importFlags+=$importFlagsCLM
importFlags+=$importFlagsDA
cppdefs+=" ${pf}-DCLMSA "
libs+=$libsCLM
obj+=' $(OBJCLM) print_update_clm.o'
fi
if [[ ${mList[1]} == clm5_0 ]] ; then
importFlags+=$importFlagsDA
importFlags+=" -I$clmdir/build/intel/mpi/nodebug/nothreads/include "
importFlags+=" -I$clmdir/build/intel/mpi/nodebug/nothreads/mct/noesmf/c1a1l1i1o1r1g1w1e1/include "
importFlags+=" -I$clmdir/build/intel/mpi/nodebug/nothreads/mct/noesmf/include "
importFlags+=" -I$clmdir/build/intel/mpi/nodebug/nothreads/mct/noesmf/clm/obj "
importFlags+=" -I$clmdir/build/atm/obj "
importFlags+=" -I$clmdir/build/ice/obj "
importFlags+=" -I$clmdir/build/ocn/obj "
importFlags+=" -I$clmdir/build/glc/obj "
importFlags+=" -I$clmdir/build/rof/obj "
importFlags+=" -I$clmdir/build/wav/obj "
importFlags+=" -I$clmdir/build/esp/obj "
importFlags+=" -I$clmdir/build/cpl/obj "
importFlags+=" -I$clmdir/build/lib/include "
importFlags+=" -I$clmdir/build/ "
cppdefs+=" ${pf}-DCLMSA ${pf}-DCLMFIVE "
libs+=" -L$clmdir/build/lib/ -lcpl "
libs+=" -L$clmdir/build/lib/ -latm -lice "
libs+=" -L$clmdir/build/intel/mpi/nodebug/nothreads/mct/noesmf/lib/ -lclm "
libs+=" -L$clmdir/build/lib/ -locn -lrof -lglc -lwav -lesp "
libs+=" -L$clmdir/build/intel/mpi/nodebug/nothreads/mct/noesmf/c1a1l1i1o1r1g1w1e1/lib -lcsm_share "
libs+=" -L$clmdir/build/intel/mpi/nodebug/nothreads/lib -lpio -lgptl -lmct -lmpeu "
libs+=" -lpnetcdf -mkl -lnetcdff -lnetcdf "
obj+=' $(OBJCLM5)'
fi
if [[ ${mList[1]} == eclm ]] ; then
comment "Needs to be updated with eCLM coupling configuration, but have to have something here otherwise compilation complains about the if / fi construct "
#importFlags+=$importFlagsDA
# importFlags+=" -I$clmdir/build/intel/mpi/nodebug/nothreads/include "
# importFlags+=" -I$clmdir/build/intel/mpi/nodebug/nothreads/mct/noesmf/c1a1l1i1o1r1g1w1e1/include "
# importFlags+=" -I$clmdir/build/intel/mpi/nodebug/nothreads/mct/noesmf/include "
# importFlags+=" -I$clmdir/build/intel/mpi/nodebug/nothreads/mct/noesmf/clm/obj "
# importFlags+=" -I$clmdir/build/atm/obj "
# importFlags+=" -I$clmdir/build/ice/obj "
# importFlags+=" -I$clmdir/build/ocn/obj "
# importFlags+=" -I$clmdir/build/glc/obj "
# importFlags+=" -I$clmdir/build/rof/obj "
# importFlags+=" -I$clmdir/build/wav/obj "
# importFlags+=" -I$clmdir/build/esp/obj "
# importFlags+=" -I$clmdir/build/cpl/obj "
# importFlags+=" -I$clmdir/build/lib/include "
# importFlags+=" -I$clmdir/build/ "
# cppdefs+=" ${pf} -DCLMFIVE"
# libs+=" -L$clmdir/build/lib/ -lcpl "
# libs+=" -L$clmdir/build/lib/ -latm -lice "
# libs+=" -L$clmdir/build/intel/mpi/nodebug/nothreads/mct/noesmf/lib/ -lclm "
# libs+=" -L$clmdir/build/lib/ -locn -lrof -lglc -lwav -lesp "
# libs+=" -L$clmdir/build/intel/mpi/nodebug/nothreads/mct/noesmf/c1a1l1i1o1r1g1w1e1/lib -lcsm_share "
# libs+=" -L$clmdir/build/intel/mpi/nodebug/nothreads/lib -lpio -lgptl -lmct -lmpeu "
# libs+=" -lpnetcdf -mkl -lnetcdff -lnetcdf "
# obj+=' $(OBJCLM5)'
fi
fi
if [[ $withCLM == "true" && $withCOS == "true" && $withPFL == "false" ]] ; then
if [[ ${mList[1]} == clm5_0 ]] ; then
comment "Not yet implemented combination of pdaf and models (clm5_0)"
exit 1
fi
if [[ ${mList[1]} == eclm ]] ; then
comment "Not yet implemented combination of pdaf and models (eclm)"
exit 1
fi
importFlags+=$importFlagsCLM
importFlags+=$importFlagsOAS
importFlags+=$importFlagsCOS
importFlags+=$importFlagsDA
cppdefs+=" ${pf}-DCOUP_OAS_COS ${pf}-DGRIBDWD ${pf}-DNETCDF ${pf}-DHYMACS ${pf}-DMAXPATCH_PFT=1 "
if [[ $cplscheme == "true" ]] ; then ; cppdefs+=" ${pf}-DCPL_SCHEME_F " ; fi
if [[ $readCLM == "true" ]] ; then ; cppdefs+=" ${pf}-DREADCLM " ; fi
libs+=$libsCLM
libs+=$libsCOS
libs+=$libsOAS
obj+=' $(OBJCLM) $(OBJCOSMO) '
fi
if [[ $withCLM == "true" && $withCOS == "false" && $withPFL == "true" ]] ; then
if [[ ${mList[1]} == clm5_0 ]] ; then
comment "Not yet implemented combination of pdaf and models (clm5_0)"
exit 1
fi
if [[ ${mList[1]} == eclm ]] ; then
comment "Not yet implemented combination of pdaf and models (eclm)"
exit 1
fi
importFlags+=$importFlagsCLM
importFlags+=$importFlagsOAS
importFlags+=$importFlagsPFL
importFlags+=$importFlagsDA
cppdefs+=" ${pf}-DCOUP_OAS_PFL ${pf}-DMAXPATCH_PFT=1 "
cppdefs+=" ${pf}-DOBS_ONLY_PARFLOW " # Remove for observations from both ParFlow + CLM
if [[ $readCLM == "true" ]] ; then ; cppdefs+=" ${pf}-DREADCLM " ; fi
if [[ $freeDrain == "true" ]] ; then ; cppdefs+=" ${pf}-DFREEDRAINAGE " ; fi
libs+=$libsCLM
libs+=$libsOAS
libs+=$libsPFL
obj+=' $(OBJCLM) $(OBJPF) '
fi
if [[ $withCLM == "true" && $withCOS == "true" && $withPFL == "true" ]] ; then
if [[ ${mList[1]} == clm5_0 ]] ; then
comment "Not yet implemented combination of pdaf and models (clm5_0)"
exit 1
fi
if [[ ${mList[1]} == eclm ]] ; then
comment "Not yet implemented combination of pdaf and models (eclm)"
exit 1
fi
importFlags+=$importFlagsCLM
importFlags+=$importFlagsOAS
importFlags+=$importFlagsPFL
importFlags+=$importFlagsCOS
importFlags+=$importFlagsDA
cppdefs+=" ${pf}-DCOUP_OAS_COS ${pf}-DGRIBDWD ${pf}-DNETCDF ${pf}-DHYMACS ${pf}-DMAXPATCH_PFT=1 ${pf}-DCOUP_OAS_PFL "
if [[ $cplscheme == "true" ]] ; then ; cppdefs+=" ${pf}-DCPL_SCHEME_F " ; fi
if [[ $readCLM == "true" ]] ; then ; cppdefs+=" ${pf}-DREADCLM " ; fi
if [[ $freeDrain == "true" ]] ; then ; cppdefs+=" ${pf}-DFREEDRAINAGE " ; fi
libs+=$libsCLM
libs+=$libsOAS
libs+=$libsCOS
libs+=$libsPFL
obj+=' $(OBJCLM) $(OBJCOSMO) $(OBJPF) '
fi
c_configure_pdaf
route "${cyellow}<< configure_da${cnormal}"
}
make_da(){
route "${cyellow}>> make_da${cnormal}"
c_make_pdaf
route "${cyellow}<< make_da${cnormal}"
}