1 | #!/bin/bash |
---|
2 | # $Id: makelmdz_fcm 2250 2015-03-26 15:28:42Z fhourdin $ |
---|
3 | # This is a script in Bash. |
---|
4 | |
---|
5 | # FH : on ne cr\'ee plus le fichier arch.mk qui est suppos\'e exister par |
---|
6 | # FH : ailleurs. |
---|
7 | # FH : ulterieurement, ce fichier sera pr\'e-existant pour une s\'erie |
---|
8 | # FH : de configurations en versions optimis\'ees et debug qui seront |
---|
9 | # FH : li\'es (ln -s) avec arch.mk en fonction de l'architecture. |
---|
10 | # FH : Pour le moment, cette version est en test et on peut cr\'eer les |
---|
11 | # FH : arch.mk en lan\c{}cant une premi\`ere fois makegcm. |
---|
12 | # |
---|
13 | ##set -x |
---|
14 | set -e |
---|
15 | ######################################################################## |
---|
16 | # options par defaut pour la commande make |
---|
17 | ######################################################################## |
---|
18 | |
---|
19 | dim="96x72x19" |
---|
20 | physique=lmd |
---|
21 | filtre=filtrez |
---|
22 | grille=reg |
---|
23 | couple=false |
---|
24 | veget=false |
---|
25 | sisvat=false |
---|
26 | rrtm=false |
---|
27 | chimie=false |
---|
28 | parallel=none |
---|
29 | paramem="par" |
---|
30 | compil_mod=prod |
---|
31 | io=ioipsl |
---|
32 | LIBPREFIX="" |
---|
33 | cosp=false |
---|
34 | job=1 |
---|
35 | full='' |
---|
36 | |
---|
37 | LMDGCM=`/bin/pwd` |
---|
38 | LIBOGCM=$LMDGCM/libo |
---|
39 | LIBFGCM=$LMDGCM/libf |
---|
40 | DYN_COMMON_PATH=$LIBFGCM/dyn3d_common |
---|
41 | # path for optional packages, but default set to ".void_dir" |
---|
42 | FILTRE_PATH=$LMDGCM/.void_dir |
---|
43 | DYN_PHYS_PATH=$LMDGCM/.void_dir |
---|
44 | DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir |
---|
45 | RRTM_PATH=$LMDGCM/.void_dir |
---|
46 | SISVAT_PATH=$LMDGCM/.void_dir |
---|
47 | COSP_PATH=$LMDGCM/.void_dir |
---|
48 | fcm_path=$LMDGCM/tools/fcm/bin |
---|
49 | |
---|
50 | ######################################################################## |
---|
51 | # Quelques initialisations de variables du shell. |
---|
52 | ######################################################################## |
---|
53 | |
---|
54 | CPP_KEY="" |
---|
55 | INCLUDE="" |
---|
56 | LIB="" |
---|
57 | adjnt="" |
---|
58 | COMPIL_FFLAGS="%PROD_FFLAGS" |
---|
59 | PARA_FFLAGS="" |
---|
60 | PARA_LD="" |
---|
61 | EXT_SRC="" |
---|
62 | |
---|
63 | ######################################################################## |
---|
64 | # lecture des options de mymake |
---|
65 | ######################################################################## |
---|
66 | |
---|
67 | while (($# > 0)) |
---|
68 | do |
---|
69 | case $1 in |
---|
70 | "-h") cat <<fin |
---|
71 | Usage : |
---|
72 | makelmdz_fcm [options] -arch nom_arch exec |
---|
73 | [-h] : brief help |
---|
74 | [-d [[IMx]JMx]LM] : IM, JM, LM are the dimensions in x, y, z (default: $dim) |
---|
75 | [-p PHYS] : set of physical parametrizations (in libf/phyPHYS), (default: lmd) |
---|
76 | [-prod / -dev / -debug] : compilation mode production (default) / developement / debug |
---|
77 | [-c false/MPI1/OMCT] : coupling with ocean model : MPI1/OMCT/false (default: false) |
---|
78 | [-v false/orchidee2.0/orchidee1.9/true] : version of the vegetation model to include (default: false) |
---|
79 | false : no vegetation model |
---|
80 | orchidee2.0 : compile using ORCHIDEE 2.0 (or more recent version) |
---|
81 | orchidee1.9 : compile using ORCHIDEE up to the version including OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6 |
---|
82 | true : (obsolete; for backward compatibility) use ORCHIDEE tag 1.9-1.9.6 |
---|
83 | [-chimie INCA/false] : with INCA chemistry model or without (default: false) |
---|
84 | [-cosp true/false] : compile with/without cosp package (default: false) |
---|
85 | [-sisvat true/false] : compile with/without sisvat package (default: false) |
---|
86 | [-rrtm true/false] : compile with/without rrtm package (default: false) |
---|
87 | [-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp |
---|
88 | [-g GRI] : grid configuration in dyn3d/GRI_xy.h (default: reg, inclues a zoom) |
---|
89 | [-io ioipsl/mix/xios] : Input/Output library (default: ioipsl) |
---|
90 | [-include INCLUDES] : extra include path to add |
---|
91 | [-cpp CPP_KEY] : additional preprocessing definitions |
---|
92 | [-adjnt] : adjoint model, not operational ... |
---|
93 | [-mem] : reduced memory dynamics (if in parallel mode) |
---|
94 | [-filtre NOMFILTRE] : use filtre from libf/NOMFILTRE (default: filtrez) |
---|
95 | [-link LINKS] : additional links with other libraries |
---|
96 | [-j n] : active parallel compiling on ntask |
---|
97 | [-full] : full recompiling |
---|
98 | [-fcm_path path] : path to the fcm tool (default: tools/fcm/bin) |
---|
99 | [-ext_src path] : path to an additional set of routines to compile with the model |
---|
100 | -arch nom_arch : target architecture |
---|
101 | exec : executable to build |
---|
102 | fin |
---|
103 | exit;; |
---|
104 | |
---|
105 | "-d") |
---|
106 | dim=$2 ; shift ; shift ;; |
---|
107 | |
---|
108 | "-p") |
---|
109 | physique="$2" ; shift ; shift ;; |
---|
110 | |
---|
111 | "-g") |
---|
112 | grille="$2" ; shift ; shift ;; |
---|
113 | |
---|
114 | "-c") |
---|
115 | couple="$2" ; shift ; shift ;; |
---|
116 | |
---|
117 | "-prod") |
---|
118 | compil_mod="prod" ; shift ;; |
---|
119 | |
---|
120 | "-dev") |
---|
121 | compil_mod="dev" ; shift ;; |
---|
122 | |
---|
123 | "-debug") |
---|
124 | compil_mod="debug" ; shift ;; |
---|
125 | |
---|
126 | "-io") |
---|
127 | io="$2" ; shift ; shift ;; |
---|
128 | |
---|
129 | "-v") |
---|
130 | veget="$2" ; shift ; shift ;; |
---|
131 | |
---|
132 | "-sisvat") |
---|
133 | sisvat="$2" ; shift ; shift ;; |
---|
134 | |
---|
135 | "-rrtm") |
---|
136 | rrtm="$2" ; shift ; shift ;; |
---|
137 | |
---|
138 | "-chimie") |
---|
139 | chimie="$2" ; shift ; shift ;; |
---|
140 | |
---|
141 | "-parallel") |
---|
142 | parallel="$2" ; shift ; shift ;; |
---|
143 | |
---|
144 | "-include") |
---|
145 | INCLUDE="$INCLUDE -I$2" ; shift ; shift ;; |
---|
146 | |
---|
147 | "-cpp") |
---|
148 | CPP_KEY="$CPP_KEY $2" ; shift ; shift ;; |
---|
149 | |
---|
150 | "-adjnt") |
---|
151 | echo "not operational ... work to be done here ";exit |
---|
152 | opt_dep="$opt_dep adjnt" ; adjnt="-ladjnt -ldyn3d " |
---|
153 | optim="$optim -Dadj" ; shift ;; |
---|
154 | |
---|
155 | "-cosp") |
---|
156 | cosp="$2" ; shift ; shift ;; |
---|
157 | |
---|
158 | "-mem") |
---|
159 | paramem="mem" ; shift ;; |
---|
160 | |
---|
161 | "-filtre") |
---|
162 | filtre=$2 ; shift ; shift ;; |
---|
163 | |
---|
164 | "-link") |
---|
165 | LIB="$LIB $2" ; shift ; shift ;; |
---|
166 | |
---|
167 | "-fcm_path") |
---|
168 | fcm_path=$2 ; shift ; shift ;; |
---|
169 | |
---|
170 | "-ext_src") |
---|
171 | EXT_SRC=$2 ; shift ; shift ;; |
---|
172 | "-j") |
---|
173 | job=$2 ; shift ; shift ;; |
---|
174 | "-full") |
---|
175 | full="-full" ; shift ;; |
---|
176 | |
---|
177 | "-arch") |
---|
178 | arch=$2 ; shift ; shift ;; |
---|
179 | |
---|
180 | *) |
---|
181 | code="$1" ; shift ;; |
---|
182 | esac |
---|
183 | done |
---|
184 | |
---|
185 | ############################################################### |
---|
186 | # path to fcm |
---|
187 | ############################################################### |
---|
188 | # handle case when provided path to fcm was given as a relative |
---|
189 | # path (from makelmdz_fcm script directory) and not an absolute path |
---|
190 | if [[ ${fcm_path:0:1} != "/" ]] ; then |
---|
191 | # prepend with makelmdz_fcm location |
---|
192 | fcm_path=$(cd $(dirname $0) ; pwd)"/"${fcm_path} |
---|
193 | fi |
---|
194 | |
---|
195 | # add fcm_path to PATH |
---|
196 | export PATH=${fcm_path}:${PATH} |
---|
197 | |
---|
198 | echo "Path to fcm:" |
---|
199 | echo ${fcm_path} |
---|
200 | |
---|
201 | ############################################################### |
---|
202 | # lecture des chemins propres \`a l'architecture de la machine # |
---|
203 | ############################################################### |
---|
204 | rm -f .void_file |
---|
205 | echo > .void_file |
---|
206 | rm -rf .void_dir |
---|
207 | mkdir .void_dir |
---|
208 | rm -f arch.path |
---|
209 | ln -s arch/arch-${arch}.path ./arch.path |
---|
210 | source arch.path |
---|
211 | |
---|
212 | ######################################################################## |
---|
213 | # Definition des clefs CPP, des chemins des includes et modules |
---|
214 | # et des libraries |
---|
215 | ######################################################################## |
---|
216 | |
---|
217 | if [[ "$compil_mod" == "prod" ]] |
---|
218 | then |
---|
219 | COMPIL_FFLAGS="%PROD_FFLAGS" |
---|
220 | elif [[ "$compil_mod" == "dev" ]] |
---|
221 | then |
---|
222 | COMPIL_FFLAGS="%DEV_FFLAGS" |
---|
223 | elif [[ "$compil_mod" == "debug" ]] |
---|
224 | then |
---|
225 | COMPIL_FFLAGS="%DEBUG_FFLAGS" |
---|
226 | fi |
---|
227 | |
---|
228 | phys_root=$physique |
---|
229 | if [[ "${physique:0:3}" == "lmd" ]] ; then phys_root=lmd ; fi |
---|
230 | if [[ "${physique:0:4}" == "mars" ]] ; then phys_root=mars ; fi |
---|
231 | if [[ "${physique:0:3}" == "std" ]] ; then phys_root=std ; fi |
---|
232 | if [[ "${physique:0:5}" == "venus" ]] ; then phys_root=venus ; fi |
---|
233 | if [[ "${physique:0:5}" == "titan" ]] ; then phys_root=titan ; fi |
---|
234 | if [[ "${physique:0:3}" == "mar" ]] ; then phys_root=mar ; fi |
---|
235 | if [[ "${physique:0:3}" == "dev" ]] ; then phys_root=dev ; fi |
---|
236 | |
---|
237 | if [[ "$physique" != "nophys" ]] |
---|
238 | then |
---|
239 | #We'll use some physics |
---|
240 | CPP_KEY="$CPP_KEY CPP_PHYS" |
---|
241 | if [[ "${phys_root}" == "lmd" ]] |
---|
242 | then |
---|
243 | #For lmd physics, default planet type is Earth |
---|
244 | CPP_KEY="$CPP_KEY CPP_EARTH" |
---|
245 | fi |
---|
246 | # set the dyn/phys interface path |
---|
247 | DYN_PHYS_PATH="${LIBFGCM}/dynlonlat_phylonlat" |
---|
248 | DYN_PHYS_SUB_PATH="${LIBFGCM}/dynlonlat_phylonlat/phy${phys_root}" |
---|
249 | fi |
---|
250 | |
---|
251 | if [[ "$filtre" == "filtrez" ]] |
---|
252 | then |
---|
253 | FILTRE_PATH=${LIBFGCM}/$filtre |
---|
254 | fi |
---|
255 | |
---|
256 | if [[ "$chimie" == "INCA" ]] |
---|
257 | then |
---|
258 | CPP_KEY="$CPP_KEY INCA" |
---|
259 | INCLUDE="$INCLUDE -I${INCA_INCDIR}" |
---|
260 | LIB="$LIB -L${INCA_LIBDIR} -lchimie" |
---|
261 | fi |
---|
262 | |
---|
263 | if [[ "$couple" != "false" ]] |
---|
264 | then |
---|
265 | if [[ "$couple" == "MPI1" ]] |
---|
266 | then |
---|
267 | CPP_KEY="$CPP_KEY CPP_COUPLE" |
---|
268 | export OASIS_INCDIR=$LMDGCM/../../prism/X64/build/lib/psmile.MPI1 |
---|
269 | export OASIS_LIBDIR=$LMDGCM/../../prism/X64/lib |
---|
270 | INCLUDE="$INCLUDE -I${OASIS_INCDIR}" |
---|
271 | LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lmpp_io" |
---|
272 | else |
---|
273 | CPP_KEY="$CPP_KEY CPP_COUPLE CPP_OMCT" |
---|
274 | INCLUDE="$INCLUDE -I${OASIS_INCDIR}" |
---|
275 | LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lscrip -lmct -lmpeu" |
---|
276 | fi |
---|
277 | fi |
---|
278 | |
---|
279 | if [[ "$parallel" == "mpi" ]] |
---|
280 | then |
---|
281 | CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI" |
---|
282 | PARA_FFLAGS="%MPI_FFLAGS" |
---|
283 | PARA_LD="%MPI_LD" |
---|
284 | elif [[ "$parallel" == "omp" ]] |
---|
285 | then |
---|
286 | CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP" |
---|
287 | PARA_FFLAGS="%OMP_FFLAGS" |
---|
288 | PARA_LD="%OMP_LD" |
---|
289 | elif [[ "$parallel" == "mpi_omp" ]] |
---|
290 | then |
---|
291 | CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP" |
---|
292 | PARA_FFLAGS="%MPI_FFLAGS %OMP_FFLAGS" |
---|
293 | PARA_LD="%MPI_LD %OMP_LD" |
---|
294 | fi |
---|
295 | |
---|
296 | if [[ ( "$parallel" == "omp" || "$parallel" == "mpi_omp" ) \ |
---|
297 | && "$compil_mod" == "debug" ]] |
---|
298 | then |
---|
299 | echo "Usually, parallelization with OpenMP requires some optimization." |
---|
300 | echo "We suggest switching to \"-dev\"." |
---|
301 | fi |
---|
302 | |
---|
303 | if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" ] |
---|
304 | then |
---|
305 | #NB: option 'true': for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6 |
---|
306 | # For this case, cpp flag ORCHIDEE_NOOPENMP must be added to the makelmdz_fcm arguments |
---|
307 | # option orchidee1.9 : Compile with ORCHIDEE version up to the inclusion of OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6 |
---|
308 | INCLUDE="${INCLUDE} -I${ORCH_INCDIR}" |
---|
309 | CPP_KEY="$CPP_KEY CPP_VEGET" |
---|
310 | # temporary, for Orchidee versions 1.9.* (before openmp activation) |
---|
311 | if [[ "$veget" == "orchidee1.9" ]] ; then |
---|
312 | CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP" |
---|
313 | fi |
---|
314 | if [[ "$veget" == "orchidee2.0" ]] ; then |
---|
315 | orch_libs="sechiba parameters stomate parallel orglob orchidee" |
---|
316 | else |
---|
317 | orch_libs="sechiba parameters stomate parallel orglob" |
---|
318 | fi |
---|
319 | LIB="${LIB} -L${ORCH_LIBDIR}" |
---|
320 | for lib in ${orch_libs} ; do |
---|
321 | if [ -f ${ORCH_LIBDIR}/lib${LIBPREFIX}$lib.a ] ; then |
---|
322 | LIB="${LIB} -l${LIBPREFIX}$lib " |
---|
323 | fi |
---|
324 | done |
---|
325 | elif [[ "$veget" != "false" ]] ; then |
---|
326 | echo "Option -v $veget does not exist" |
---|
327 | echo "Use ./makelmdz_fcm -h for more information" |
---|
328 | exit |
---|
329 | fi |
---|
330 | |
---|
331 | if [[ "$sisvat" == "true" ]] |
---|
332 | then |
---|
333 | CPP_KEY="$CPP_KEY CPP_SISVAT" |
---|
334 | SISVAT_PATH="$LIBFGCM/%PHYS/sisvat" |
---|
335 | fi |
---|
336 | |
---|
337 | if [[ "$rrtm" == "true" ]] |
---|
338 | then |
---|
339 | CPP_KEY="$CPP_KEY CPP_RRTM" |
---|
340 | RRTM_PATH="$LIBFGCM/%PHYS/rrtm" |
---|
341 | fi |
---|
342 | |
---|
343 | if [[ $io == ioipsl ]] |
---|
344 | then |
---|
345 | CPP_KEY="$CPP_KEY CPP_IOIPSL" |
---|
346 | INCLUDE="$INCLUDE -I${IOIPSL_INCDIR}" |
---|
347 | LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl" |
---|
348 | elif [[ $io == mix ]] |
---|
349 | then |
---|
350 | # For now, xios implies also using ioipsl |
---|
351 | CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS" |
---|
352 | INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}" |
---|
353 | LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios" |
---|
354 | elif [[ $io == xios ]] |
---|
355 | then |
---|
356 | # For now, xios implies also using ioipsl |
---|
357 | CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS CPP_IOIPSL_NO_OUTPUT" |
---|
358 | INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}" |
---|
359 | LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios" |
---|
360 | fi |
---|
361 | |
---|
362 | if [[ "$cosp" == "true" ]] |
---|
363 | then |
---|
364 | CPP_KEY="$CPP_KEY CPP_COSP" |
---|
365 | COSP_PATH="$LIBFGCM/phylmd/cosp" |
---|
366 | # LIB="${LIB} -l${LIBPREFIX}cosp" |
---|
367 | fi |
---|
368 | |
---|
369 | INCLUDE="$INCLUDE ${NETCDF_INCDIR}" |
---|
370 | LIB="$LIB ${NETCDF_LIBDIR}" |
---|
371 | |
---|
372 | ######################################################################## |
---|
373 | # calcul du nombre de dimensions |
---|
374 | ######################################################################## |
---|
375 | |
---|
376 | |
---|
377 | dim_full=$dim |
---|
378 | dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
379 | set $dim |
---|
380 | dimc=$# |
---|
381 | echo calcul de la dimension |
---|
382 | echo dim $dim |
---|
383 | echo dimc $dimc |
---|
384 | |
---|
385 | |
---|
386 | ######################################################################## |
---|
387 | # Gestion des dimensions du modele. |
---|
388 | # on cree ou remplace le fichier des dimensions |
---|
389 | ######################################################################## |
---|
390 | |
---|
391 | cd $LIBFGCM/grid |
---|
392 | if [[ -f dimensions.h ]] |
---|
393 | then |
---|
394 | echo 'ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs' |
---|
395 | echo "Attendez que la premiere compilation soit terminee pour relancer la suivante." |
---|
396 | echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs," |
---|
397 | echo vous pouvez continuer en repondant oui. |
---|
398 | echo "Voulez-vous vraiment continuer?" |
---|
399 | echo "" |
---|
400 | echo "WARNING: you are probably already compiling the model somewhere else." |
---|
401 | echo "Wait until the first compilation is finished before launching this one." |
---|
402 | echo "If you are sure that you are not compiling elsewhere, just answer " |
---|
403 | echo "yes (or 'oui') to the question below to proceed." |
---|
404 | echo "Do you wish to continue?" |
---|
405 | read reponse |
---|
406 | if [[ $reponse == "oui" || $reponse == "yes" ]] |
---|
407 | then |
---|
408 | \rm -f $LIBFGCM/grid/dimensions.h |
---|
409 | else |
---|
410 | exit |
---|
411 | fi |
---|
412 | fi |
---|
413 | |
---|
414 | |
---|
415 | cd $LIBFGCM/grid/dimension |
---|
416 | ./makdim $dim |
---|
417 | cat $LIBFGCM/grid/dimensions.h |
---|
418 | cd $LMDGCM |
---|
419 | |
---|
420 | |
---|
421 | ######################################################################## |
---|
422 | # Differentes dynamiques (3d, 2d, 1d) |
---|
423 | ######################################################################## |
---|
424 | |
---|
425 | dimension=`echo $dim | wc -w` |
---|
426 | echo dimension $dimension |
---|
427 | |
---|
428 | if (( $dimension == 3 )) |
---|
429 | then |
---|
430 | cd $LIBFGCM/grid |
---|
431 | \rm fxyprim.h |
---|
432 | cp -p fxy_${grille}.h fxyprim.h |
---|
433 | #else |
---|
434 | # echo "Probleme dans les dimensions de la dynamique !!" |
---|
435 | # echo "Non reactive pour l'instant !!!" |
---|
436 | fi |
---|
437 | |
---|
438 | if (( $dimension == 1 )) |
---|
439 | then |
---|
440 | CPP_KEY="$CPP_KEY CPP_1D" |
---|
441 | ##in 1D, add dyn3d to include path (because main prog is in physics) |
---|
442 | INCLUDE="$INCLUDE -Ilibf/dyn3d -Ilibf/dyn3d_common" |
---|
443 | ## no filtre in 1d: |
---|
444 | FILTRE_PATH=$LMDGCM/.void_dir |
---|
445 | ## no need to compile all routines in dyn3d_common either: |
---|
446 | DYN_COMMON_PATH=$LMDGCM/.void_dir |
---|
447 | ## no need to compile all routines in dynlmdz_phy... ; |
---|
448 | ## (because key ones are included in 1D main program) |
---|
449 | DYN_PHYS_PATH=$LMDGCM/.void_dir |
---|
450 | DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir |
---|
451 | fi |
---|
452 | |
---|
453 | ###################################################################### |
---|
454 | # Traitement special pour le nouveau rayonnement de Laurent Li. |
---|
455 | # ---> YM desactive pour le traitemement en parallele |
---|
456 | ###################################################################### |
---|
457 | |
---|
458 | #if [[ -f $libf/phy$physique/raddim.h ]] |
---|
459 | #then |
---|
460 | # if [[ -f $libf/phy$physique/raddim.$dimh.h ]] |
---|
461 | #then |
---|
462 | # \rm -f $libf/phy$physique/raddim.h |
---|
463 | # cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h |
---|
464 | # echo $libf/phy$physique/raddim.$dimh.h |
---|
465 | # cat $libf/phy$physique/raddim.h |
---|
466 | # else |
---|
467 | # echo On peut diminuer la taille de l executable en creant |
---|
468 | # echo le fichier $libf/phy$physique/raddim.$dimh.h |
---|
469 | # \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h |
---|
470 | # fi |
---|
471 | #fi |
---|
472 | |
---|
473 | ###################################################################### |
---|
474 | # Gestion du filtre qui n'existe qu'en 3d. |
---|
475 | ###################################################################### |
---|
476 | |
---|
477 | if (( `expr $dimc \> 2` == 1 )) |
---|
478 | then |
---|
479 | filtre="FILTRE=$filtre" |
---|
480 | else |
---|
481 | filtre="FILTRE= L_FILTRE= " |
---|
482 | fi |
---|
483 | echo MACRO FILTRE $filtre |
---|
484 | |
---|
485 | echo $dimc |
---|
486 | |
---|
487 | |
---|
488 | |
---|
489 | ###################################################################### |
---|
490 | # Creation du suffixe de la configuration |
---|
491 | ###################################################################### |
---|
492 | |
---|
493 | |
---|
494 | SUFF_NAME=_${dim_full} |
---|
495 | SUFF_NAME=${SUFF_NAME}_phy${physique} |
---|
496 | |
---|
497 | if [[ "$parallel" != "none" ]] |
---|
498 | then |
---|
499 | SUFF_NAME=${SUFF_NAME}_para |
---|
500 | DYN=dyn${dimc}d${paramem} |
---|
501 | if [[ "$paramem" == "mem" ]] |
---|
502 | then |
---|
503 | SUFF_NAME=${SUFF_NAME}_${paramem} |
---|
504 | else |
---|
505 | echo "The version of the dynamics in dyn3dpar is no longer updated." |
---|
506 | echo "You should use option \"-mem\"." |
---|
507 | exit 1 |
---|
508 | fi |
---|
509 | else |
---|
510 | SUFF_NAME=${SUFF_NAME}_seq |
---|
511 | if (( $dimension == 1 )) |
---|
512 | then |
---|
513 | # dynamics-related routines in"dyn1d" subdirectory of phy${physique} |
---|
514 | DYN=phy${physique}/dyn1d |
---|
515 | else |
---|
516 | DYN=dyn${dimc}d |
---|
517 | fi |
---|
518 | fi |
---|
519 | |
---|
520 | if [[ $veget != "false" ]] |
---|
521 | then |
---|
522 | SUFF_NAME=${SUFF_NAME}_orch |
---|
523 | fi |
---|
524 | |
---|
525 | if [[ $couple != "false" ]] |
---|
526 | then |
---|
527 | SUFF_NAME=${SUFF_NAME}_couple |
---|
528 | fi |
---|
529 | |
---|
530 | if [[ $chimie == "INCA" ]] |
---|
531 | then |
---|
532 | SUFF_NAME=${SUFF_NAME}_inca |
---|
533 | fi |
---|
534 | |
---|
535 | cd $LMDGCM |
---|
536 | config_fcm="config.fcm" |
---|
537 | rm -f $config_fcm |
---|
538 | touch $config_fcm |
---|
539 | rm -f bin/${code}${SUFF_NAME}.e |
---|
540 | rm -f arch.fcm |
---|
541 | rm -f arch.opt |
---|
542 | |
---|
543 | echo "%ARCH $arch" >> $config_fcm |
---|
544 | echo "%INCDIR $INCLUDE" >> $config_fcm |
---|
545 | echo "%LIB $LIB" >> $config_fcm |
---|
546 | echo "%ROOT_PATH $PWD" >> $config_fcm |
---|
547 | echo "%LIBF $LIBFGCM" >> $config_fcm |
---|
548 | echo "%LIBO $LIBOGCM" >> $config_fcm |
---|
549 | echo "%DYN $DYN" >> $config_fcm |
---|
550 | echo "%DYN_COMMON $DYN_COMMON_PATH" >> $config_fcm |
---|
551 | echo "%FILTRE $FILTRE_PATH" >> $config_fcm |
---|
552 | echo "%PHYS phy${physique}" >> $config_fcm |
---|
553 | echo "%DYN_PHYS $DYN_PHYS_PATH" >> $config_fcm |
---|
554 | echo "%DYN_PHYS_SUB $DYN_PHYS_SUB_PATH" >> $config_fcm |
---|
555 | echo "%RRTM $RRTM_PATH" >> $config_fcm |
---|
556 | echo "%SISVAT $SISVAT_PATH" >> $config_fcm |
---|
557 | echo "%COSP $COSP_PATH" >> $config_fcm |
---|
558 | echo "%CPP_KEY $CPP_KEY" >> $config_fcm |
---|
559 | echo "%EXEC $code" >> $config_fcm |
---|
560 | echo "%SUFF_NAME $SUFF_NAME" >> $config_fcm |
---|
561 | echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> $config_fcm |
---|
562 | echo "%PARA_FFLAGS $PARA_FFLAGS" >> $config_fcm |
---|
563 | echo "%PARA_LD $PARA_LD" >> $config_fcm |
---|
564 | echo "%EXT_SRC $EXT_SRC" >> $config_fcm |
---|
565 | |
---|
566 | |
---|
567 | |
---|
568 | ln -s arch/arch-${arch}.fcm arch.fcm |
---|
569 | if test -f arch/arch-${arch}.opt && [ $compil_mod = "prod" ] |
---|
570 | then |
---|
571 | ln -s arch/arch-${arch}.opt arch.opt |
---|
572 | else |
---|
573 | ln -s .void_file arch.opt |
---|
574 | fi |
---|
575 | |
---|
576 | rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock |
---|
577 | ./build_gcm ${fcm_path} -j $job $full |
---|
578 | |
---|
579 | rm -rf tmp_src |
---|
580 | rm -rf config |
---|
581 | ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config |
---|
582 | ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/tmp tmp_src |
---|
583 | |
---|
584 | |
---|
585 | if [[ -r $LIBFGCM/grid/dimensions.h ]] |
---|
586 | then |
---|
587 | # Cleanup: remove dimension.h file |
---|
588 | \rm -f $LIBFGCM/grid/dimensions.h |
---|
589 | fi |
---|