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