1 | #!/bin/csh -f |
---|
2 | # $Header: /users/lmdz/cvsroot/LMDZ.3.3/makegcm,v 1.21 2001/07/04 08:41:44 lmdz Exp $ |
---|
3 | #set verbose echo |
---|
4 | ######################################################################## |
---|
5 | # options par defaut pour la commande make |
---|
6 | ######################################################################## |
---|
7 | set dim="64x48x32" |
---|
8 | set physique=mars |
---|
9 | set phys="PHYS=$physique" |
---|
10 | set include='-I$(LIBF)/grid -I$(LIBF)/bibio -I. -I$(LIBF)/aeronomars' |
---|
11 | set ntrac = 1 |
---|
12 | set filtre=filtrez |
---|
13 | set grille=reg |
---|
14 | set dyntype="dyn" |
---|
15 | set scatterers="1" |
---|
16 | set full="" |
---|
17 | ######################################################################## |
---|
18 | # path a changer contenant les sources et les objets du modele |
---|
19 | ######################################################################## |
---|
20 | |
---|
21 | #### If you want you can set environment variables here (instead of |
---|
22 | #### relying on the C-shell environment variables) |
---|
23 | # default LMDGCM to where makegcm script is located: |
---|
24 | set scriptdir=`dirname $0` |
---|
25 | setenv LMDGCM `readlink -f $scriptdir` |
---|
26 | # You may set LIBOGCM to something else; otherwise we default to: |
---|
27 | setenv LIBOGCM $LMDGCM/libo |
---|
28 | |
---|
29 | ### NetCDF librairies. some presets for LMD people. |
---|
30 | hostname | grep 'lmd.jussieu.fr' > /dev/null |
---|
31 | if ( $? == 0 ) then |
---|
32 | echo "*** NETCDF preset *** LMD machines" |
---|
33 | setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_ifort/lib |
---|
34 | setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_ifort/include |
---|
35 | endif |
---|
36 | hostname | grep 'n201' > /dev/null |
---|
37 | if ( $? == 0 ) then |
---|
38 | echo "*** NETCDF preset *** GNOME cluster" |
---|
39 | setenv NCDFLIB /usr/local/lib |
---|
40 | setenv NCDFINC /usr/local/include |
---|
41 | endif |
---|
42 | hostname | grep 'ciclad' > /dev/null |
---|
43 | if ( $? == 0 ) then |
---|
44 | echo "*** NETCDF preset *** CICLAD cluster" |
---|
45 | setenv NCDFLIB /opt/netcdf/ifort/lib |
---|
46 | setenv NCDFINC /opt/netcdf/ifort/include |
---|
47 | endif |
---|
48 | ### end NetCDF presets |
---|
49 | |
---|
50 | setenv localdir "`pwd`" |
---|
51 | set MODIPSL=0 |
---|
52 | echo $localdir | grep modipsl >& /dev/null |
---|
53 | if ( ! $status ) then |
---|
54 | set MODIPSL=1 |
---|
55 | setenv LMDGCM $localdir |
---|
56 | cd ../.. |
---|
57 | setenv LIBOGCM "`pwd`/lib" |
---|
58 | cd $localdir |
---|
59 | if ( `hostname` == rhodes ) then |
---|
60 | set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
---|
61 | set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
---|
62 | else |
---|
63 | if ( `hostname` == nymphea0 ) then |
---|
64 | set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
---|
65 | set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
---|
66 | else |
---|
67 | echo 'Probleme de definition des variables NCDFINC et NCDFLIB' |
---|
68 | endif |
---|
69 | endif |
---|
70 | else |
---|
71 | if ( ! $?LMDGCM ) then |
---|
72 | echo You must initialize the variable LMDGCM in your environnement |
---|
73 | echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc |
---|
74 | exit |
---|
75 | endif |
---|
76 | if ( ! $?LIBOGCM ) then |
---|
77 | set LIBOGCM=$LMDGCM/libo |
---|
78 | endif |
---|
79 | if ( ! $?NCDFLIB ) then |
---|
80 | echo You must initialize the variable NCDFLIB in your environnement |
---|
81 | echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc |
---|
82 | exit |
---|
83 | endif |
---|
84 | if ( ! $?NCDFINC ) then |
---|
85 | echo You must initialize the variable NCDFINC in your environnement |
---|
86 | echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc |
---|
87 | exit |
---|
88 | endif |
---|
89 | endif |
---|
90 | set model=$LMDGCM |
---|
91 | set libo=$LIBOGCM |
---|
92 | |
---|
93 | ######################################################################## |
---|
94 | # Les differentes platformes reconnues |
---|
95 | ######################################################################## |
---|
96 | |
---|
97 | set HP=0 |
---|
98 | set IBM=0 |
---|
99 | set SUN=0 |
---|
100 | set VPP=0 |
---|
101 | set CRAY=0 |
---|
102 | set DEC=0 |
---|
103 | set LINUX=0 |
---|
104 | set NEC=0 |
---|
105 | set XNEC=0 |
---|
106 | if ( `uname` == HP-UX ) then |
---|
107 | set machine=HP |
---|
108 | set HP=1 |
---|
109 | else if (`uname` == UNIX_System_V ) then |
---|
110 | set machine=VPP |
---|
111 | set VPP=1 |
---|
112 | else if (`uname` == SunOS ) then |
---|
113 | set machine=SUN |
---|
114 | set SUN=1 |
---|
115 | else if ( `uname` == AIX ) then |
---|
116 | set machine=IBM |
---|
117 | set IBM=1 |
---|
118 | else if ( `uname` == OSF1 ) then |
---|
119 | set machine=ALPHA |
---|
120 | set DEC=1 |
---|
121 | else if ( `uname` == Linux ) then |
---|
122 | set machine=LINUX |
---|
123 | set LINUX=1 |
---|
124 | else if ( `hostname` == atlas || `hostname` == axis || `hostname` == etoile ) then |
---|
125 | set machine=CRAY |
---|
126 | set CRAY=1 |
---|
127 | else if ( `uname` == SUPER-UX ) then |
---|
128 | set machine=NEC |
---|
129 | set NEC=1 |
---|
130 | else if ( `hostname` == rhodes) then |
---|
131 | set machine=XNEC |
---|
132 | set XNEC=1 |
---|
133 | else |
---|
134 | echo Vous travaillez sur une machine non prevue par le reglement |
---|
135 | exit |
---|
136 | endif |
---|
137 | |
---|
138 | # create $libo directory if it doesn't exist |
---|
139 | if ( ! -d $libo ) then |
---|
140 | mkdir $libo |
---|
141 | endif |
---|
142 | |
---|
143 | if $VPP then |
---|
144 | set netcdf=netcdf_v |
---|
145 | else |
---|
146 | set netcdf=netcdf |
---|
147 | endif |
---|
148 | ######################################################################## |
---|
149 | # Quelques initialisations de variables du shell. |
---|
150 | ######################################################################## |
---|
151 | |
---|
152 | set dyn= |
---|
153 | set opt_link="" |
---|
154 | set adjnt="" |
---|
155 | set opt_dep="" |
---|
156 | |
---|
157 | set optim90="" |
---|
158 | set oplink="" |
---|
159 | |
---|
160 | ######################################################################## |
---|
161 | # Optimisations par defaut suivant les machines |
---|
162 | ######################################################################## |
---|
163 | |
---|
164 | echo "Optimisations par defaut suivant les machines" |
---|
165 | set libf=$model/libf |
---|
166 | #setenv localdir "LOCAL_DIR=`pwd`" |
---|
167 | #setenv localdir "`pwd`" |
---|
168 | cd $model |
---|
169 | if $CRAY then |
---|
170 | set optim90="-Wp'-P' -DCRAY "'-p$(LIBO) -eiv ' |
---|
171 | set oplink="-Wl'-DSTACK=128 -f indef' -L$NCDFLIB -lnetcdf " |
---|
172 | set mod_loc_dir=" " |
---|
173 | set mod_suffix=" " |
---|
174 | else if $SUN then |
---|
175 | set optim90=" -fast" |
---|
176 | set optimtru90=" -fast -free" |
---|
177 | set opt_link="-L$NCDFLIB -lnetcdf" |
---|
178 | set mod_loc_dir=$localdir |
---|
179 | set mod_suffix=mod |
---|
180 | else if $HP then |
---|
181 | else if $IBM then |
---|
182 | else if $VPP then |
---|
183 | set optim90="$optim -X9 -w" |
---|
184 | if $COUPLE then |
---|
185 | set opt_link="-Wg,-c $IOIPSLDIR/liboasis2.4_mpi2.a /usr/lang/mpi2/lib64/libmpi.a /usr/lang/mpi2/lib64/libmp.a /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl" |
---|
186 | set oplink="-Wl,-t,-P,-dy " |
---|
187 | else |
---|
188 | set opt_link="-Wg,-c /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl" |
---|
189 | set oplink="-Wl,-t,-dy " |
---|
190 | endif |
---|
191 | set mod_loc_dir=$IOIPSLDIR |
---|
192 | set mod_suffix=mod |
---|
193 | else if $DEC then |
---|
194 | else if $LINUX then |
---|
195 | # Ehouarn 'ifort' compiler |
---|
196 | #NB: on gnome -O3 ==> NaNs ... |
---|
197 | set optim="-auto -O2 -fp-model precise -ip -mkl=sequential -align all " |
---|
198 | set optim90="-auto -O2 -fp-model precise -ip -mkl=sequential -align all " |
---|
199 | set optimtru90="-auto -O2 -fp-model precise -ip -mkl=sequential -align all " |
---|
200 | # set opt_link=" -Mfree -lpgf90 -lpgftnrtl -lpghpf -lpghpf2 -L$NCDFLIB -lnetcdf -Bstatic " |
---|
201 | # set mod_loc_dir=$LIBOGCM |
---|
202 | # ifort puts mod files in local directory |
---|
203 | set mod_loc_dir="." |
---|
204 | set mod_suffix=mod |
---|
205 | else if $NEC then |
---|
206 | set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
207 | set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
208 | ### set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lioipsl -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v " |
---|
209 | set opt_link=" -C hopt -float0 -ew -P static -L/SX/usr/local/lib -lnetcdf_i8r8 " |
---|
210 | set mod_loc_dir="." |
---|
211 | set mod_suffix="mod" |
---|
212 | else if $XNEC then |
---|
213 | set optim90=' -clear -R5 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
214 | set optimtru90=' -clear -R5 -f4 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
215 | if $MODIPSL then |
---|
216 | if $COUPLE then |
---|
217 | set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
218 | else |
---|
219 | set opt_link="-L$IOIPSLDIR -lsxioipsl -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
220 | endif |
---|
221 | set mod_loc_dir="./" |
---|
222 | else |
---|
223 | #### set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lsxioipsl -L /u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8" |
---|
224 | set opt_link=" -C hopt -float0 -ew -P static -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8" |
---|
225 | set mod_loc_dir="." |
---|
226 | endif |
---|
227 | set mod_suffix="mod" |
---|
228 | |
---|
229 | endif |
---|
230 | |
---|
231 | # Ehouarn: add 'g9fortran' string to pathname |
---|
232 | set nomlib=${machine} |
---|
233 | |
---|
234 | # Impose distinct name for 64 bit Linux machines (to avoid mixing 32 and 64) |
---|
235 | if (`uname` == Linux && `uname -m` == "x86_64") then |
---|
236 | set nomlib=${machine}64 |
---|
237 | endif |
---|
238 | |
---|
239 | ######################################################################## |
---|
240 | # lecture des options de mymake |
---|
241 | ######################################################################## |
---|
242 | |
---|
243 | top: |
---|
244 | if ($#argv > 0) then |
---|
245 | switch ($1:q) |
---|
246 | |
---|
247 | case -h: |
---|
248 | |
---|
249 | ######################################################################## |
---|
250 | # Manuel en ligne |
---|
251 | ######################################################################## |
---|
252 | more <<eod |
---|
253 | |
---|
254 | |
---|
255 | makegcm [Options] prog |
---|
256 | |
---|
257 | |
---|
258 | The makegcm script: |
---|
259 | ------------------- |
---|
260 | |
---|
261 | 1. compiles a series of subroutines located in the $LMDGCM/libf |
---|
262 | sub-directories. |
---|
263 | The objects are then stored in the libraries in $LIBOGCM. |
---|
264 | |
---|
265 | 2. then, makegcm compiles program prog.f located by default in |
---|
266 | $LMDGCM/libf/dyn3d and makes the link with the libraries. |
---|
267 | |
---|
268 | Environment Variables '$LMDGCM' and '$LIBOGCM' |
---|
269 | must be set as environment variables or directly |
---|
270 | in the makegcm file. |
---|
271 | |
---|
272 | The makegcm command is used to control the different versions of the model |
---|
273 | in parallel, compiled using the compilation options |
---|
274 | and the various dimensions, without having to recompile the whole model. |
---|
275 | |
---|
276 | The FORTRAN libraries are stored in directory $LIBOGCM. |
---|
277 | |
---|
278 | |
---|
279 | OPTIONS: |
---|
280 | -------- |
---|
281 | |
---|
282 | The following options can either be defined by default by editing the |
---|
283 | makegcm "script", or in interactive mode: |
---|
284 | |
---|
285 | -d imxjmxlm where im, jm, and lm are the number of longitudes, |
---|
286 | latitudes and vertical layers respectively. |
---|
287 | |
---|
288 | -t ntrac Selects the number of tracers present in the model |
---|
289 | |
---|
290 | Options -d and -t overwrite file |
---|
291 | $LMDGCM/libf/grid/dimensions.h |
---|
292 | which contains the 3 dimensions of the |
---|
293 | horizontal grid |
---|
294 | im, jm, lm plus the number of tracers passively advected |
---|
295 | by the dynamics ntrac, |
---|
296 | in 4 PARAMETER FORTRAN format |
---|
297 | with a new file: |
---|
298 | $LMDGCM/libf/grid/dimension/dimensions.im.jm.lm.tntrac |
---|
299 | If the file does not exist already |
---|
300 | it is created by the script |
---|
301 | $LMDGCM/libf/grid/dimension/makdim |
---|
302 | |
---|
303 | -s nscat Number of radiatively active scatterers |
---|
304 | |
---|
305 | -p PHYS Selects the set of physical parameterizations |
---|
306 | you want to compile the model with. |
---|
307 | The model is then compiled using the physical |
---|
308 | parameterization sources in directory: |
---|
309 | $LMDGCM/libf/phyPHYS |
---|
310 | |
---|
311 | -g grille Selects the grid type. |
---|
312 | This option overwrites file |
---|
313 | $LMDGCM/libf/grid/fxyprim.h |
---|
314 | with file |
---|
315 | $LMDGCM/libf/grid/fxy_grille.h |
---|
316 | the grid can take the following values: |
---|
317 | 1. reg - the regular grid |
---|
318 | 2. sin - to obtain equidistant points in terms of sin(latitude) |
---|
319 | 3. new - to zoom into a part of the globe |
---|
320 | |
---|
321 | -O "compilation options" set of fortran compilation options to use |
---|
322 | |
---|
323 | -include path |
---|
324 | Used if the subroutines contain #include files (ccp) that |
---|
325 | are located in directories that are not referenced by default. |
---|
326 | |
---|
327 | -adjnt Compiles the adjoint model to the dynamical code. |
---|
328 | |
---|
329 | -olddyn To compile GCM with "old dynamics" |
---|
330 | |
---|
331 | -filtre filter |
---|
332 | To select the longitudinal filter in the polar regions. |
---|
333 | "filter" corresponds to the name of a directory located in |
---|
334 | $LMDGCM/libf. The standard filter for the model is "filtrez" |
---|
335 | which can be used for a regular grid and for a |
---|
336 | grid with longitudinal zoom. |
---|
337 | |
---|
338 | -link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..." |
---|
339 | Adds a link to FORTRAN libraries |
---|
340 | libfile1.a, libfile2.a ... |
---|
341 | located in directories dir1, dir2 ...respectively |
---|
342 | If dirn is a directory with an automatic path |
---|
343 | (/usr/lib ... for example) |
---|
344 | there is no need to specify -Ldirn. |
---|
345 | |
---|
346 | -full Full (re)compilation (from scratch) |
---|
347 | |
---|
348 | eod |
---|
349 | exit |
---|
350 | |
---|
351 | ######################################################################## |
---|
352 | # Lecture des differentes options |
---|
353 | ######################################################################## |
---|
354 | |
---|
355 | case -d: |
---|
356 | set dim=$2 ; shift ; shift ; goto top |
---|
357 | |
---|
358 | case -O: |
---|
359 | set optim="$2" ; set optim90="$2" ; set optimtru90="$2" ; shift ; shift ; goto top |
---|
360 | |
---|
361 | case -p |
---|
362 | set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top |
---|
363 | |
---|
364 | case -s |
---|
365 | set scatterers="$2" ; shift ; goto top |
---|
366 | |
---|
367 | case -g |
---|
368 | set grille="$2" ; shift ; shift ; goto top |
---|
369 | |
---|
370 | case -t |
---|
371 | set ntrac=$2 ; shift ; shift ; goto top |
---|
372 | |
---|
373 | case -include |
---|
374 | set include="$include -I$2" ; shift ; shift ; goto top |
---|
375 | |
---|
376 | case -adjnt |
---|
377 | set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d " |
---|
378 | |
---|
379 | case -olddyn |
---|
380 | set dyntype="olddyn" ; shift; goto top |
---|
381 | |
---|
382 | case -full |
---|
383 | set full="full" ; shift ; goto top |
---|
384 | |
---|
385 | case -filtre |
---|
386 | set filtre=$2 ; shift ; shift ; goto top |
---|
387 | |
---|
388 | case -link |
---|
389 | set opt_link="$opt_link $2" ; shift ; shift ; goto top |
---|
390 | |
---|
391 | case -debug |
---|
392 | if $HP then |
---|
393 | set optim90=" -g " |
---|
394 | else if $SUN then |
---|
395 | setenv PARALLEL 4 |
---|
396 | set optim90=" -g -C " |
---|
397 | set optimtru90=" -g -C " |
---|
398 | else if $CRAY then |
---|
399 | set optim90="$optim90"" -G1 " |
---|
400 | else if $LINUX then |
---|
401 | ## for ifort |
---|
402 | set optim=" -g -O0 -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug" |
---|
403 | set optim90=" -g -O0 -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug" |
---|
404 | set optimtru90=" -g -O0 -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug" |
---|
405 | else |
---|
406 | echo "pas d option debug predefinie pour cette machine" |
---|
407 | exit |
---|
408 | endif |
---|
409 | shift ; goto top |
---|
410 | |
---|
411 | default |
---|
412 | set code="$1" ; shift ; goto top |
---|
413 | |
---|
414 | endsw |
---|
415 | endif |
---|
416 | |
---|
417 | echo "apres les opts dim $dim" |
---|
418 | |
---|
419 | ######################################################################## |
---|
420 | # cas special sans physique |
---|
421 | ######################################################################## |
---|
422 | if ( "$physique" == 'nophys' ) then |
---|
423 | set phys="L_PHY= LIBPHY=" |
---|
424 | endif |
---|
425 | |
---|
426 | ######################################################################## |
---|
427 | # choix du nombre de traceur par defaut si il n'a pas ete choisi, |
---|
428 | # suivant la physique |
---|
429 | ######################################################################## |
---|
430 | |
---|
431 | if ( $ntrac == 0 ) then |
---|
432 | if ( "$physique" == 'nophys' ) then |
---|
433 | set ntrac=1 |
---|
434 | else if ( "$physique" == 'lmd' ) then |
---|
435 | set ntrac=2 |
---|
436 | else if ( "$physique" == 'lmd_test_li' ) then |
---|
437 | set ntrac=2 |
---|
438 | else if ( "$physique" == 'ec' ) then |
---|
439 | set ntrac=1 |
---|
440 | else |
---|
441 | set ntrac = 1 |
---|
442 | endif |
---|
443 | endif |
---|
444 | |
---|
445 | ######################################################################## |
---|
446 | #subtilites sur le nom de la librairie |
---|
447 | ######################################################################## |
---|
448 | |
---|
449 | \rm tmp ; touch tmp |
---|
450 | \rm tmp90 ; touch tmp90 |
---|
451 | foreach i ( $optim90 ) |
---|
452 | echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp |
---|
453 | end |
---|
454 | set suf= |
---|
455 | foreach i ( `sort tmp | uniq ` ) |
---|
456 | set suf=$suf$i |
---|
457 | end |
---|
458 | if ( ! $IBM ) then |
---|
459 | set nomlib="$nomlib$suf" |
---|
460 | endif |
---|
461 | if ( $DEC ) then |
---|
462 | set nomlib=DEC |
---|
463 | endif |
---|
464 | |
---|
465 | # dimension |
---|
466 | |
---|
467 | echo "dimension avant sed $dim" |
---|
468 | if ( $IBM ) then |
---|
469 | set dim=`echo $dim | sed -en 's/[^0-9]/ /g'` |
---|
470 | set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'` |
---|
471 | else if ( $SUN || $XNEC ) then |
---|
472 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
473 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
474 | else |
---|
475 | # set dim=`echo $dim | sed -n -e 's/[^0-9]/ /gp'` |
---|
476 | # set dim_=`echo $dim | sed -n -e 's/[^0-9]/_/gp'` |
---|
477 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
478 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
479 | endif |
---|
480 | |
---|
481 | # build final name of libraries directory: |
---|
482 | if ( "$dyntype" == "olddyn" ) then |
---|
483 | set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}_olddyn |
---|
484 | else |
---|
485 | set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille} |
---|
486 | endif |
---|
487 | |
---|
488 | # Append 'physique' type, if it is not mars, to nomlib |
---|
489 | if ( "$physique" != "mars" ) then |
---|
490 | set nomlib=${nomlib}_${physique} |
---|
491 | endif |
---|
492 | |
---|
493 | ## M-A-F nomlib trop long sur CRAY pour ar |
---|
494 | if ( $CRAY ) then |
---|
495 | set nomlib=F90_${dim_}_t${ntrac} |
---|
496 | endif |
---|
497 | if ( $NEC || $XNEC ) then |
---|
498 | set nomlib=F90_${dim_}_t${ntrac} |
---|
499 | endif |
---|
500 | |
---|
501 | echo "calcul de la dimension" |
---|
502 | set dimc=`echo $dim | wc -w` |
---|
503 | |
---|
504 | if ( "$dimc" == "2" ) then |
---|
505 | set include="$include "'-I$(LIBF)/dyn2d ' |
---|
506 | set dimh=$dim |
---|
507 | else |
---|
508 | if ( "$dyntype" == "olddyn" ) then |
---|
509 | set include="$include "'-I$(LIBF)/olddyn3d ' |
---|
510 | else |
---|
511 | set include="$include "'-I$(LIBF)/dyn3d ' |
---|
512 | endif |
---|
513 | set dimh=`echo $dim | awk ' { print $1 "." $2 } '` |
---|
514 | endif |
---|
515 | echo "dimc is $dimc" |
---|
516 | |
---|
517 | ######################################################################## |
---|
518 | # path pour les #include |
---|
519 | ######################################################################## |
---|
520 | |
---|
521 | set include="$include -I$NCDFINC " |
---|
522 | echo $include |
---|
523 | |
---|
524 | ######################################################################## |
---|
525 | # Gestion des dimensions du modele. |
---|
526 | # on cree ou remplace le fichier des dimensions/nombre de traceur |
---|
527 | ######################################################################## |
---|
528 | |
---|
529 | cd $libf/grid |
---|
530 | if ( -f dimensions.h ) then |
---|
531 | echo "WARNING: you are probably already compiling the model (perhaps" |
---|
532 | echo " elsewhere). Wait until the first compilation ends before " |
---|
533 | echo " compiling a different configuration." |
---|
534 | echo "If you are sure that you are not already compiling, then you" |
---|
535 | echo " may continue this compilation by answering yes." |
---|
536 | echo "Do you want to continue?" |
---|
537 | if ( $< == "yes" ) then |
---|
538 | #remove old dimensions.h file |
---|
539 | \rm -f $libf/grid/dimensions.h |
---|
540 | #remove old scatterers.h file |
---|
541 | \rm -f $libf/phy$physique/scatterers.h |
---|
542 | else |
---|
543 | exit |
---|
544 | endif |
---|
545 | endif |
---|
546 | |
---|
547 | # Build the appropriate 'dimensions.h' file |
---|
548 | cd dimension |
---|
549 | ./makdim $dim |
---|
550 | # echo contents of dimensions.h to standard output |
---|
551 | cat $libf/grid/dimensions.h |
---|
552 | |
---|
553 | cd $libf/phy$physique/scatterers |
---|
554 | # Build the appropriate 'scatterers.h' file |
---|
555 | ./make_scatterers $scatterers |
---|
556 | # echo contents of scatterers.h to standard output |
---|
557 | cat $libf/phy$physique/scatterers.h |
---|
558 | |
---|
559 | cd $LMDGCM |
---|
560 | # set path to objects directory |
---|
561 | set libo=$libo/$nomlib |
---|
562 | # create objects directory, if it doesn't exist |
---|
563 | if ( ! -d $libo ) then |
---|
564 | mkdir $libo |
---|
565 | cd $model |
---|
566 | endif |
---|
567 | |
---|
568 | ######################################################################## |
---|
569 | # Differentes dynamiques (3d, 2d, 1d) |
---|
570 | ######################################################################## |
---|
571 | |
---|
572 | set dimension=`echo $dim | wc -w` |
---|
573 | echo dimension $dimension dim $dim |
---|
574 | if ( $dimension == 1 ) then |
---|
575 | echo "No dynamics" |
---|
576 | ## set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique " |
---|
577 | ## NB: we still need to have L_DYN=libdyn3d to reach routines and module |
---|
578 | ## objects which are located in dyn3d |
---|
579 | set dyn="L_DYN=-ldyn3d DYN= L_FILTRE= DIRMAIN=phy$physique " |
---|
580 | endif |
---|
581 | endif |
---|
582 | |
---|
583 | cd $model |
---|
584 | if ( $dimension == 3 ) then |
---|
585 | cd libf/grid |
---|
586 | \rm fxyprim.h |
---|
587 | cp -p fxy_${grille}.h fxyprim.h |
---|
588 | endif |
---|
589 | |
---|
590 | ###################################################################### |
---|
591 | # Traitement special pour le nouveau rayonnement de Laurent Li. |
---|
592 | ###################################################################### |
---|
593 | |
---|
594 | if ( -f $libf/phy$physique/raddim.h ) then |
---|
595 | if ( -f $libf/phy$physique/raddim.$dimh.h ) then |
---|
596 | \rm $libf/phy$physique/raddim.h |
---|
597 | cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h |
---|
598 | echo $libf/phy$physique/raddim.$dimh.h |
---|
599 | cat $libf/phy$physique/raddim.$dimh.h |
---|
600 | cat $libf/phy$physique/raddim.h |
---|
601 | else |
---|
602 | echo On peut diminuer la taille de l executable en creant |
---|
603 | echo le fichier $libf/phy$physique/raddim.$dimh.h |
---|
604 | \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h |
---|
605 | endif |
---|
606 | endif |
---|
607 | |
---|
608 | ###################################################################### |
---|
609 | # Gestion du filtre qui n'existe qu'en 3d. |
---|
610 | ###################################################################### |
---|
611 | |
---|
612 | # set filtre to 'oldfiltrez' if using -olddyn option |
---|
613 | if ( "$dyntype" == "olddyn" ) then |
---|
614 | set filtre="oldfiltrez" |
---|
615 | endif |
---|
616 | |
---|
617 | if ( `expr $dimc \> 2` == 1 ) then |
---|
618 | set filtre="FILTRE=$filtre" |
---|
619 | else |
---|
620 | set filtre="FILTRE= L_FILTRE= " |
---|
621 | endif |
---|
622 | echo "MACRO FILTRE $filtre" |
---|
623 | |
---|
624 | echo "dimc $dimc" |
---|
625 | |
---|
626 | #cleanup for a full recompilation, if requested |
---|
627 | if ("$full" == "full") then |
---|
628 | # remove makefile and $libo |
---|
629 | cd $model |
---|
630 | \rm -f makefile |
---|
631 | \rm -rf $libo/* |
---|
632 | endif |
---|
633 | |
---|
634 | ######################################################################## |
---|
635 | # Avant de lancer le make, on recree le makefile si necessaire |
---|
636 | ######################################################################## |
---|
637 | # c'est a dire dans 3 cas: |
---|
638 | # 1. si la liste des fichiers .F et .h a ete modifiee depuis la |
---|
639 | # derniere creation du makefile |
---|
640 | # 2. si le fichier contenant cette liste "liste_des_sources" |
---|
641 | # n'existe pas. |
---|
642 | # 3. Si le makefile n'existe pas. |
---|
643 | ######################################################################## |
---|
644 | |
---|
645 | cd $model |
---|
646 | find libf -name '*.[Fh]' -print | sort >! tmp77 |
---|
647 | #find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90 |
---|
648 | find libf -name '*.[Fh]90' -print | sort >> tmp90 |
---|
649 | |
---|
650 | if ( `diff tmp77 liste_des_sources_f77 | wc -w` \ |
---|
651 | || `diff tmp90 liste_des_sources_f90 | wc -w` \ |
---|
652 | || ! -f makefile \ |
---|
653 | || ! -f liste_des_sources_f90 \ |
---|
654 | || ! -f liste_des_sources_f77 ) then |
---|
655 | echo "les fichiers suivants ont ete crees ou detruits" |
---|
656 | echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90" |
---|
657 | diff liste_des_sources_f77 tmp77 |
---|
658 | diff liste_des_sources_f90 tmp90 |
---|
659 | \cp tmp77 liste_des_sources_f77 |
---|
660 | \cp tmp90 liste_des_sources_f90 |
---|
661 | echo "On recree le makefile" |
---|
662 | if ("$dyntype" == "olddyn") then |
---|
663 | ./create_make_gcm olddyn3d grid bibio aeronomars phy$physique >! tmp |
---|
664 | else |
---|
665 | ./create_make_gcm dyn3d grid bibio aeronomars phy$physique >! tmp |
---|
666 | endif |
---|
667 | \mv tmp makefile |
---|
668 | echo "Nouveau makefile cree." |
---|
669 | endif |
---|
670 | |
---|
671 | ######################################################################## |
---|
672 | # Execution de la comande make |
---|
673 | ######################################################################## |
---|
674 | |
---|
675 | echo PHYSIQUE $phys |
---|
676 | echo dynamique $dyn $dimension |
---|
677 | echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code |
---|
678 | echo PATH pour les fichiers INCLUDE $include |
---|
679 | echo OPLINK="$oplink" |
---|
680 | |
---|
681 | if $HP then |
---|
682 | set f77='fort77 +OP' |
---|
683 | set f90='jensaisrien' |
---|
684 | set opt_link="$opt_link -lm" |
---|
685 | else if $VPP then |
---|
686 | set f77=frt |
---|
687 | set f90=$f77 |
---|
688 | else if $CRAY then |
---|
689 | set f77=f90 |
---|
690 | set f90=f90 |
---|
691 | else if $LINUX then |
---|
692 | set f77=ifort |
---|
693 | set f90=ifort |
---|
694 | set opt_link=" -L$LIBOGCM -L$NCDFLIB -lnetcdf " |
---|
695 | else if $SUN then |
---|
696 | set f77=f90 |
---|
697 | set f90=f90 |
---|
698 | else if $NEC then |
---|
699 | set f77=f90 |
---|
700 | set f90=f90 |
---|
701 | else if $XNEC then |
---|
702 | set f77=sxmpif90 |
---|
703 | set f90=sxmpif90 |
---|
704 | else |
---|
705 | set f77=f77 |
---|
706 | set f90=f90 |
---|
707 | endif |
---|
708 | |
---|
709 | cd $model |
---|
710 | |
---|
711 | if $VPP then |
---|
712 | set make="gmake RANLIB=ls" |
---|
713 | else if $CRAY then |
---|
714 | set make="make RANLIB=ls" |
---|
715 | else if $NEC then |
---|
716 | set make="make RANLIB=ls" |
---|
717 | else if $LINUX then |
---|
718 | set make="make -k RANLIB=ranlib" |
---|
719 | else if $XNEC then |
---|
720 | set make="/usr/local/bin/gmake RANLIB=ls" |
---|
721 | set make="/usr/freeware/bin/gmake RANLIB=ls" |
---|
722 | else |
---|
723 | set make="make RANLIB=ranlib" |
---|
724 | endif |
---|
725 | |
---|
726 | set include="$include"" -I$libf/phy$physique" |
---|
727 | |
---|
728 | |
---|
729 | ################################################################# |
---|
730 | # Execution de la comande make... ENFIN! |
---|
731 | ################################################################# |
---|
732 | |
---|
733 | if $VPP then |
---|
734 | set optim90=" $optim90 -Am -M$libo" |
---|
735 | set optimtru90="$optim90" |
---|
736 | else if $SUN then |
---|
737 | set optim90=" $optim90 -M$libo" |
---|
738 | set optimtru90=" $optimtru90 " |
---|
739 | else if $NEC then |
---|
740 | set optim90=" $optim90 -I$libo " |
---|
741 | else if $XNEC then |
---|
742 | set optim90=" $optim90 -I$libo " |
---|
743 | set optimtru90=" $optimtru90 -I$libo " |
---|
744 | else if $LINUX then |
---|
745 | # Ehouarn : adapt to gfortran |
---|
746 | set optim="$optim -I${libo}" |
---|
747 | set optim90="$optim90 -I${libo}" |
---|
748 | set optimtru90="$optimtru90 -I${libo}" |
---|
749 | # Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above) |
---|
750 | # set mod_loc_dir=$libo |
---|
751 | endif |
---|
752 | |
---|
753 | set link="$f90 $optim90" |
---|
754 | |
---|
755 | set ar=ar |
---|
756 | |
---|
757 | if $XNEC then |
---|
758 | set link="sxld $opt_link" |
---|
759 | set link="$f90 " |
---|
760 | # set ar=sxar |
---|
761 | endif |
---|
762 | |
---|
763 | |
---|
764 | cd $localdir |
---|
765 | |
---|
766 | ## locate main program (could be in dyn3d or phy$physique |
---|
767 | ## and could be .F or .F90) |
---|
768 | set source_code=${code}.F |
---|
769 | if ( -f $LMDGCM/libf/dyn3d/${code}.F90 ) then |
---|
770 | set source_code=${code}.F90 |
---|
771 | endif |
---|
772 | if ( -f $LMDGCM/libf/phy${physique}/${code}.F ) then |
---|
773 | set source_code=${code}.F |
---|
774 | endif |
---|
775 | if ( -f $LMDGCM/libf/phy${physique}/${code}.F90 ) then |
---|
776 | set source_code=${code}.F90 |
---|
777 | endif |
---|
778 | |
---|
779 | ## locate directory where main program is located |
---|
780 | if ( $dimension == 3 ) then |
---|
781 | if ( -f $LMDGCM/libf/dyn3d/${source_code} ) then |
---|
782 | set dyn="DIRMAIN=dyn3d " |
---|
783 | endif |
---|
784 | if ( -f $LMDGCM/libf/phy${physique}/${source_code} ) then |
---|
785 | set dyn="DIRMAIN=phy${physique} " |
---|
786 | endif |
---|
787 | endif |
---|
788 | |
---|
789 | echo $make -f $LMDGCM/makefile \ |
---|
790 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
791 | OPTIM="$optim" \ |
---|
792 | OPTIM90="$optim90" \ |
---|
793 | OPTIMTRU90="$optimtru90" \ |
---|
794 | INCLUDE="$include" \ |
---|
795 | $filtre \ |
---|
796 | LIBO=$libo \ |
---|
797 | $dyn \ |
---|
798 | $phys \ |
---|
799 | DIM=$dimc \ |
---|
800 | DYNTYPE="$dyntype" \ |
---|
801 | L_ADJNT="$adjnt" \ |
---|
802 | LOCAL_DIR="$localdir" \ |
---|
803 | F77="$f77" \ |
---|
804 | F90="$f90" \ |
---|
805 | OPLINK="$oplink" \ |
---|
806 | LINK="$link" \ |
---|
807 | GCM="$LMDGCM" \ |
---|
808 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
809 | MOD_SUFFIX=$mod_suffix \ |
---|
810 | AR=$ar \ |
---|
811 | SOURCE=$source_code \ |
---|
812 | PROG=$code |
---|
813 | |
---|
814 | |
---|
815 | $make -f $LMDGCM/makefile \ |
---|
816 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
817 | OPTIM="$optim" \ |
---|
818 | OPTIM90="$optim90" \ |
---|
819 | OPTIMTRU90="$optimtru90" \ |
---|
820 | INCLUDE="$include" \ |
---|
821 | $filtre \ |
---|
822 | LIBO=$libo \ |
---|
823 | $dyn \ |
---|
824 | $phys \ |
---|
825 | DIM=$dimc \ |
---|
826 | DYNTYPE="$dyntype" \ |
---|
827 | L_ADJNT="$adjnt" \ |
---|
828 | LOCAL_DIR="$localdir" \ |
---|
829 | F77="$f77" \ |
---|
830 | F90="$f90" \ |
---|
831 | OPLINK="$oplink" \ |
---|
832 | LINK="$link" \ |
---|
833 | GCM="$LMDGCM" \ |
---|
834 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
835 | MOD_SUFFIX=$mod_suffix \ |
---|
836 | AR=$ar \ |
---|
837 | SOURCE=$source_code \ |
---|
838 | PROG=$code |
---|
839 | |
---|
840 | # cleanup, remove dimensions.h and scatterers.h |
---|
841 | \rm -f $libf/grid/dimensions.h |
---|
842 | \rm -f $libf/phy$physique/scatterers.h |
---|