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