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