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 | else |
---|
517 | exit |
---|
518 | endif |
---|
519 | endif |
---|
520 | |
---|
521 | # Build the appropriate 'dimensions.h' file |
---|
522 | cd dimension |
---|
523 | ./makdim $ntrac $dim |
---|
524 | # echo contents of dimensions.h to standard output |
---|
525 | cat $libf/grid/dimensions.h |
---|
526 | |
---|
527 | cd $LMDGCM |
---|
528 | # set path to objects directory |
---|
529 | set libo=$libo/$nomlib |
---|
530 | # create objects directory, if it doesn't exist |
---|
531 | if ( ! -d $libo ) then |
---|
532 | mkdir $libo |
---|
533 | cd $model |
---|
534 | endif |
---|
535 | |
---|
536 | ######################################################################## |
---|
537 | # Differentes dynamiques (3d, 2d, 1d) |
---|
538 | ######################################################################## |
---|
539 | |
---|
540 | set dimension=`echo $dim | wc -w` |
---|
541 | echo dimension $dimension dim $dim |
---|
542 | if ( $dimension == 1 ) then |
---|
543 | echo pas de dynamique |
---|
544 | set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique " |
---|
545 | endif |
---|
546 | endif |
---|
547 | |
---|
548 | cd $model |
---|
549 | if ( $dimension == 3 ) then |
---|
550 | cd libf/grid |
---|
551 | \rm fxyprim.h |
---|
552 | cp -p fxy_${grille}.h fxyprim.h |
---|
553 | endif |
---|
554 | |
---|
555 | ###################################################################### |
---|
556 | # Traitement special pour le nouveau rayonnement de Laurent Li. |
---|
557 | ###################################################################### |
---|
558 | |
---|
559 | if ( -f $libf/phy$physique/raddim.h ) then |
---|
560 | if ( -f $libf/phy$physique/raddim.$dimh.h ) then |
---|
561 | \rm $libf/phy$physique/raddim.h |
---|
562 | cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h |
---|
563 | echo $libf/phy$physique/raddim.$dimh.h |
---|
564 | cat $libf/phy$physique/raddim.$dimh.h |
---|
565 | cat $libf/phy$physique/raddim.h |
---|
566 | else |
---|
567 | echo On peut diminuer la taille de l executable en creant |
---|
568 | echo le fichier $libf/phy$physique/raddim.$dimh.h |
---|
569 | \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h |
---|
570 | endif |
---|
571 | endif |
---|
572 | |
---|
573 | ###################################################################### |
---|
574 | # Gestion du filtre qui n'existe qu'en 3d. |
---|
575 | ###################################################################### |
---|
576 | |
---|
577 | # set filtre to 'oldfiltrez' if using -olddyn option |
---|
578 | if ( "$dyntype" == "olddyn" ) then |
---|
579 | set filtre="oldfiltrez" |
---|
580 | endif |
---|
581 | |
---|
582 | if ( `expr $dimc \> 2` == 1 ) then |
---|
583 | set filtre="FILTRE=$filtre" |
---|
584 | else |
---|
585 | set filtre="FILTRE= L_FILTRE= " |
---|
586 | endif |
---|
587 | echo "MACRO FILTRE $filtre" |
---|
588 | |
---|
589 | echo "dimc $dimc" |
---|
590 | |
---|
591 | ######################################################################## |
---|
592 | # Avant de lancer le make, on recree le makefile si necessaire |
---|
593 | ######################################################################## |
---|
594 | # c'est a dire dans 3 cas: |
---|
595 | # 1. si la liste des fichiers .F et .h a ete modifiee depuis la |
---|
596 | # derniere creation du makefile |
---|
597 | # 2. si le fichier contenant cette liste "liste_des_sources" |
---|
598 | # n'existe pas. |
---|
599 | # 3. Si le makefile n'existe pas. |
---|
600 | ######################################################################## |
---|
601 | |
---|
602 | cd $model |
---|
603 | find libf -name '*.[Fh]' -print >! tmp77 |
---|
604 | #find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90 |
---|
605 | find libf -name '*.[Fh]90' -print >> tmp90 |
---|
606 | |
---|
607 | if ( `diff tmp77 liste_des_sources_f77 | wc -w` \ |
---|
608 | || `diff tmp90 liste_des_sources_f90 | wc -w` \ |
---|
609 | || ! -f makefile \ |
---|
610 | || ! -f liste_des_sources_f90 \ |
---|
611 | || ! -f liste_des_sources_f77 ) then |
---|
612 | echo "les fichiers suivants ont ete crees ou detruits" |
---|
613 | echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90" |
---|
614 | diff liste_des_sources_f77 tmp77 |
---|
615 | diff liste_des_sources_f90 tmp90 |
---|
616 | \cp tmp77 liste_des_sources_f77 |
---|
617 | \cp tmp90 liste_des_sources_f90 |
---|
618 | echo "On recree le makefile" |
---|
619 | if ("$dyntype" == "olddyn") then |
---|
620 | ./create_make_gcm olddyn3d grid bibio aeronomars phy$physique >! tmp |
---|
621 | else |
---|
622 | ./create_make_gcm dyn3d grid bibio aeronomars phy$physique >! tmp |
---|
623 | endif |
---|
624 | \mv tmp makefile |
---|
625 | echo "Nouveau makefile cree." |
---|
626 | endif |
---|
627 | |
---|
628 | ######################################################################## |
---|
629 | # Execution de la comande make |
---|
630 | ######################################################################## |
---|
631 | |
---|
632 | echo PHYSIQUE $phys |
---|
633 | echo dynamique $dyn $dimension |
---|
634 | echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code |
---|
635 | echo PATH pour les fichiers INCLUDE $include |
---|
636 | echo OPLINK="$oplink" |
---|
637 | |
---|
638 | if $HP then |
---|
639 | set f77='fort77 +OP' |
---|
640 | set f90='jensaisrien' |
---|
641 | set opt_link="$opt_link -lm" |
---|
642 | else if $VPP then |
---|
643 | set f77=frt |
---|
644 | set f90=$f77 |
---|
645 | else if $CRAY then |
---|
646 | set f77=f90 |
---|
647 | set f90=f90 |
---|
648 | else if $LINUX then |
---|
649 | set f77=ifort |
---|
650 | set f90=ifort |
---|
651 | set opt_link=" -L$LIBOGCM -L$NCDFLIB -lnetcdf " |
---|
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 | set include="$include"" -I$libf/phy$physique" |
---|
684 | |
---|
685 | |
---|
686 | ################################################################# |
---|
687 | # Execution de la comande make... ENFIN! |
---|
688 | ################################################################# |
---|
689 | |
---|
690 | if $VPP then |
---|
691 | set optim90=" $optim90 -Am -M$libo" |
---|
692 | set optimtru90="$optim90" |
---|
693 | else if $SUN then |
---|
694 | set optim90=" $optim90 -M$libo" |
---|
695 | set optimtru90=" $optimtru90 " |
---|
696 | else if $NEC then |
---|
697 | set optim90=" $optim90 -I$libo " |
---|
698 | else if $XNEC then |
---|
699 | set optim90=" $optim90 -I$libo " |
---|
700 | set optimtru90=" $optimtru90 -I$libo " |
---|
701 | else if $LINUX then |
---|
702 | # Ehouarn : adapt to gfortran |
---|
703 | set optim="$optim -I${libo}" |
---|
704 | set optim90="$optim90 -I${libo}" |
---|
705 | set optimtru90="$optimtru90 -I${libo}" |
---|
706 | # Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above) |
---|
707 | # set mod_loc_dir=$libo |
---|
708 | endif |
---|
709 | |
---|
710 | set link="$f90 $optim90" |
---|
711 | |
---|
712 | set ar=ar |
---|
713 | |
---|
714 | if $XNEC then |
---|
715 | set link="sxld $opt_link" |
---|
716 | set link="$f90 " |
---|
717 | # set ar=sxar |
---|
718 | endif |
---|
719 | |
---|
720 | |
---|
721 | cd $localdir |
---|
722 | |
---|
723 | echo $make -f $LMDGCM/makefile \ |
---|
724 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
725 | OPTIM="$optim" \ |
---|
726 | OPTIM90="$optim90" \ |
---|
727 | OPTIMTRU90="$optimtru90" \ |
---|
728 | INCLUDE="$include" \ |
---|
729 | $filtre \ |
---|
730 | LIBO=$libo \ |
---|
731 | $dyn \ |
---|
732 | $phys \ |
---|
733 | DIM=$dimc \ |
---|
734 | DYNTYPE="$dyntype" \ |
---|
735 | L_ADJNT="$adjnt" \ |
---|
736 | LOCAL_DIR="$localdir" \ |
---|
737 | F77="$f77" \ |
---|
738 | F90="$f90" \ |
---|
739 | OPLINK="$oplink" \ |
---|
740 | LINK="$link" \ |
---|
741 | GCM="$LMDGCM" \ |
---|
742 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
743 | MOD_SUFFIX=$mod_suffix \ |
---|
744 | AR=$ar \ |
---|
745 | PROG=$code |
---|
746 | |
---|
747 | |
---|
748 | $make -f $LMDGCM/makefile \ |
---|
749 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
750 | OPTIM="$optim" \ |
---|
751 | OPTIM90="$optim90" \ |
---|
752 | OPTIMTRU90="$optimtru90" \ |
---|
753 | INCLUDE="$include" \ |
---|
754 | $filtre \ |
---|
755 | LIBO=$libo \ |
---|
756 | $dyn \ |
---|
757 | $phys \ |
---|
758 | DIM=$dimc \ |
---|
759 | DYNTYPE="$dyntype" \ |
---|
760 | L_ADJNT="$adjnt" \ |
---|
761 | LOCAL_DIR="$localdir" \ |
---|
762 | F77="$f77" \ |
---|
763 | F90="$f90" \ |
---|
764 | OPLINK="$oplink" \ |
---|
765 | LINK="$link" \ |
---|
766 | GCM="$LMDGCM" \ |
---|
767 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
768 | MOD_SUFFIX=$mod_suffix \ |
---|
769 | AR=$ar \ |
---|
770 | PROG=$code |
---|
771 | |
---|
772 | # cleanup, remove dimensions.h and scatterers.h |
---|
773 | \rm -f $libf/grid/dimensions.h |
---|
774 | \rm -f $libf/phymars/scatterers.h |
---|