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