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