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=std |
---|
9 | set phys="PHYS=$physique" |
---|
10 | set include='-I$(LIBF)/grid -I$(LIBF)/bibio -I.' |
---|
11 | set ntrac = 1 |
---|
12 | set filtre=filtrez |
---|
13 | set grille=reg |
---|
14 | set dyntype="dyn" |
---|
15 | set bands="32x36" |
---|
16 | set scatterers="1" |
---|
17 | ######################################################################## |
---|
18 | # path a changer contenant les sources et les objets du modele |
---|
19 | ######################################################################## |
---|
20 | |
---|
21 | #### If you want you can set environment variables here |
---|
22 | # default LMDGCM is where the makegcm script is: |
---|
23 | #setenv LMDGCM `pwd`"/"`dirname $0` # only works for relative paths |
---|
24 | set scriptdir=`dirname $0` |
---|
25 | setenv LMDGCM `readlink -f $scriptdir` |
---|
26 | #setenv LMDGCM "/san/home/rdword/gcm/LMDZ.GENERIC" |
---|
27 | setenv LIBOGCM $LMDGCM/libo |
---|
28 | ## NetCDF, what is below is OK on Gnome |
---|
29 | if ( `hostname` == n201 ) then |
---|
30 | echo "GNOME cluster" |
---|
31 | setenv NCDFLIB /usr/local/lib |
---|
32 | setenv NCDFINC /usr/local/include |
---|
33 | else if ( `hostname` == ciclad1.ipsl.jussieu.fr ) then |
---|
34 | echo "CICLAD cluster" |
---|
35 | setenv NCDFLIB /opt/netcdf/ifort/lib |
---|
36 | setenv NCDFINC /opt/netcdf/ifort/include |
---|
37 | else |
---|
38 | # NetCDF, on LMD farm: |
---|
39 | echo "LMD machines" |
---|
40 | setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_ifort/lib |
---|
41 | setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_ifort/include |
---|
42 | endif |
---|
43 | |
---|
44 | setenv localdir "`pwd`" |
---|
45 | set MODIPSL=0 |
---|
46 | echo $localdir | grep modipsl >& /dev/null |
---|
47 | if ( ! $status ) then |
---|
48 | set MODIPSL=1 |
---|
49 | setenv LMDGCM $localdir |
---|
50 | cd ../.. |
---|
51 | setenv LIBOGCM "`pwd`/lib" |
---|
52 | cd $localdir |
---|
53 | if ( `hostname` == rhodes ) then |
---|
54 | set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
---|
55 | set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
---|
56 | else |
---|
57 | if ( `hostname` == nymphea0 ) then |
---|
58 | set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
---|
59 | set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
---|
60 | else |
---|
61 | echo 'Probleme de definition des variables NCDFINC et NCDFLIB' |
---|
62 | endif |
---|
63 | endif |
---|
64 | else |
---|
65 | if ( ! $?LMDGCM ) then |
---|
66 | echo You must initialize the variable LMDGCM in your environnement |
---|
67 | echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc |
---|
68 | exit |
---|
69 | endif |
---|
70 | if ( ! $?LIBOGCM ) then |
---|
71 | set LIBOGCM=$LMDGCM/libo |
---|
72 | endif |
---|
73 | if ( ! $?NCDFLIB ) then |
---|
74 | echo You must initialize the variable NCDFLIB in your environnement |
---|
75 | echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc |
---|
76 | exit |
---|
77 | endif |
---|
78 | if ( ! $?NCDFINC ) then |
---|
79 | echo You must initialize the variable NCDFINC in your environnement |
---|
80 | echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc |
---|
81 | exit |
---|
82 | endif |
---|
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 | #NB: on gnome -O3 ==> NaNs ... |
---|
190 | set optim=" -O2 -fp-model precise -ip -mkl=sequential -align all " |
---|
191 | set optim90=" -O2 -fp-model precise -ip -mkl=sequential -align all " |
---|
192 | set optimtru90=" -O2 -fp-model precise -ip -mkl=sequential -align all " |
---|
193 | if ( `hostname` == ciclad1.ipsl.jussieu.fr ) then |
---|
194 | echo "YOU ARE ON CICLAD CLUSTER" |
---|
195 | set opt_link=" -L$NCDFLIB -lnetcdf" # this is necessary on ciclad |
---|
196 | endif |
---|
197 | set mod_loc_dir=$LIBOGCM |
---|
198 | set mod_suffix=mod |
---|
199 | else if $NEC then |
---|
200 | set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
201 | set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
202 | ### set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lioipsl -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v " |
---|
203 | set opt_link=" -C hopt -float0 -ew -P static -L/SX/usr/local/lib -lnetcdf_i8r8 " |
---|
204 | set mod_loc_dir="." |
---|
205 | set mod_suffix="mod" |
---|
206 | else if $XNEC then |
---|
207 | set optim90=' -clear -R5 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
208 | set optimtru90=' -clear -R5 -f4 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
209 | if $MODIPSL then |
---|
210 | if $COUPLE then |
---|
211 | set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
212 | else |
---|
213 | set opt_link="-L$IOIPSLDIR -lsxioipsl -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
214 | endif |
---|
215 | set mod_loc_dir="./" |
---|
216 | else |
---|
217 | #### 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" |
---|
218 | set opt_link=" -C hopt -float0 -ew -P static -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8" |
---|
219 | set mod_loc_dir="." |
---|
220 | endif |
---|
221 | set mod_suffix="mod" |
---|
222 | |
---|
223 | endif |
---|
224 | |
---|
225 | set nomlib=$machine |
---|
226 | |
---|
227 | # Impose distinct name for 64 bit Linux machines (to avoid mixing 32 and 64) |
---|
228 | if (`uname` == Linux && `uname -m` == "x86_64") then |
---|
229 | set nomlib=${machine}64 |
---|
230 | endif |
---|
231 | |
---|
232 | ######################################################################## |
---|
233 | # lecture des options de mymake |
---|
234 | ######################################################################## |
---|
235 | |
---|
236 | top: |
---|
237 | if ($#argv > 0) then |
---|
238 | switch ($1:q) |
---|
239 | |
---|
240 | case -h: |
---|
241 | |
---|
242 | ######################################################################## |
---|
243 | # Manuel en ligne |
---|
244 | ######################################################################## |
---|
245 | more <<eod |
---|
246 | |
---|
247 | |
---|
248 | makegcm [Options] prog |
---|
249 | |
---|
250 | |
---|
251 | The makegcm script: |
---|
252 | ------------------- |
---|
253 | |
---|
254 | 1. compiles a series of subroutines located in the $LMDGCM/libf |
---|
255 | sub-directories. |
---|
256 | The objects are then stored in the libraries in $LIBOGCM. |
---|
257 | |
---|
258 | 2. then, makegcm compiles program prog.f located by default in |
---|
259 | $LMDGCM/libf/dyn3d and makes the link with the libraries. |
---|
260 | |
---|
261 | Environment Variables '$LMDGCM' and '$LIBOGCM' |
---|
262 | must be set as environment variables or directly |
---|
263 | in the makegcm file. |
---|
264 | |
---|
265 | The makegcm command is used to control the different versions of the model |
---|
266 | in parallel, compiled using the compilation options |
---|
267 | and the various dimensions, without having to recompile the whole model. |
---|
268 | |
---|
269 | The FORTRAN libraries are stored in directory $LIBOGCM. |
---|
270 | |
---|
271 | |
---|
272 | OPTIONS: |
---|
273 | -------- |
---|
274 | |
---|
275 | The following options can either be defined by default by editing the |
---|
276 | makegcm "script", or in interactive mode: |
---|
277 | |
---|
278 | -d imxjmxlm where im, jm, and lm are the number of longitudes, |
---|
279 | latitudes and vertical layers respectively. |
---|
280 | |
---|
281 | -t ntrac Selects the number of tracers present in the model |
---|
282 | |
---|
283 | Options -d and -t overwrite file |
---|
284 | $LMDGCM/libf/grid/dimensions.h |
---|
285 | which contains the 3 dimensions of the |
---|
286 | horizontal grid |
---|
287 | im, jm, lm plus the number of tracers passively advected |
---|
288 | by the dynamics ntrac, |
---|
289 | in 4 PARAMETER FORTRAN format |
---|
290 | with a new file: |
---|
291 | $LMDGCM/libf/grid/dimension/dimensions.im.jm.lm.tntrac |
---|
292 | If the file does not exist already |
---|
293 | it is created by the script |
---|
294 | $LMDGCM/libf/grid/dimension/makdim |
---|
295 | |
---|
296 | -s nscat Number of radiatively active scatterers |
---|
297 | |
---|
298 | -p PHYS Selects the set of physical parameterizations |
---|
299 | you want to compile the model with. |
---|
300 | The model is then compiled using the physical |
---|
301 | parameterization sources in directory: |
---|
302 | $LMDGCM/libf/phyPHYS |
---|
303 | |
---|
304 | -g grille Selects the grid type. |
---|
305 | This option overwrites file |
---|
306 | $LMDGCM/libf/grid/fxyprim.h |
---|
307 | with file |
---|
308 | $LMDGCM/libf/grid/fxy_grille.h |
---|
309 | the grid can take the following values: |
---|
310 | 1. reg - the regular grid |
---|
311 | 2. sin - to obtain equidistant points in terms of sin(latitude) |
---|
312 | 3. new - to zoom into a part of the globe |
---|
313 | |
---|
314 | -O "compilation options" set of fortran compilation options to use |
---|
315 | |
---|
316 | -include path |
---|
317 | Used if the subroutines contain #include files (ccp) that |
---|
318 | are located in directories that are not referenced by default. |
---|
319 | |
---|
320 | -adjnt Compiles the adjoint model to the dynamical code. |
---|
321 | |
---|
322 | -olddyn To compile GCM with "old dynamics" |
---|
323 | |
---|
324 | -filtre filter |
---|
325 | To select the longitudinal filter in the polar regions. |
---|
326 | "filter" corresponds to the name of a directory located in |
---|
327 | $LMDGCM/libf. The standard filter for the model is "filtrez" |
---|
328 | which can be used for a regular grid and for a |
---|
329 | grid with longitudinal zoom. |
---|
330 | |
---|
331 | -link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..." |
---|
332 | Adds a link to FORTRAN libraries |
---|
333 | libfile1.a, libfile2.a ... |
---|
334 | located in directories dir1, dir2 ...respectively |
---|
335 | If dirn is a directory with an automatic path |
---|
336 | (/usr/lib ... for example) |
---|
337 | there is no need to specify -Ldirn. |
---|
338 | |
---|
339 | eod |
---|
340 | exit |
---|
341 | |
---|
342 | ######################################################################## |
---|
343 | # Lecture des differentes options |
---|
344 | ######################################################################## |
---|
345 | |
---|
346 | case -d |
---|
347 | set dim=$2 ; shift ; shift ; goto top |
---|
348 | |
---|
349 | case -O: |
---|
350 | set optim90="$2" ; set optim="$2" ; set optimtru90="$2" ; shift ; shift ; goto top |
---|
351 | |
---|
352 | case -p |
---|
353 | set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top |
---|
354 | |
---|
355 | case -s |
---|
356 | set scatterers="$2" ; shift ; goto top |
---|
357 | |
---|
358 | case -g |
---|
359 | set grille="$2" ; shift ; shift ; goto top |
---|
360 | |
---|
361 | case -b |
---|
362 | set bands=$2 ; shift ; shift ; goto top |
---|
363 | |
---|
364 | case -t |
---|
365 | set ntrac=$2 ; shift ; shift ; goto top |
---|
366 | |
---|
367 | case -include |
---|
368 | set include="$include -I$2" ; shift ; shift ; goto top |
---|
369 | |
---|
370 | case -adjnt |
---|
371 | set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d " |
---|
372 | |
---|
373 | case -olddyn |
---|
374 | set dyntype="olddyn" ; shift; goto top |
---|
375 | |
---|
376 | case -filtre |
---|
377 | set filtre=$2 ; shift ; shift ; goto top |
---|
378 | |
---|
379 | case -link |
---|
380 | set opt_link="$opt_link $2" ; shift ; shift ; goto top |
---|
381 | |
---|
382 | case -debug |
---|
383 | if $HP then |
---|
384 | set optim90=" -g " |
---|
385 | else if $SUN then |
---|
386 | setenv PARALLEL 4 |
---|
387 | set optim90=" -g -C " |
---|
388 | set optimtru90=" -g -C " |
---|
389 | else if $CRAY then |
---|
390 | set optim90="$optim90"" -G1 " |
---|
391 | else if $LINUX then |
---|
392 | set optim=" -g -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug" |
---|
393 | set optim90=" -g -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug" |
---|
394 | set optimtru90=" -g -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug" |
---|
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 | |
---|
408 | echo "apres les opts dim $dim" |
---|
409 | |
---|
410 | ######################################################################## |
---|
411 | # cas special sans physique |
---|
412 | ######################################################################## |
---|
413 | if ( "$physique" == 'nophys' ) then |
---|
414 | set phys="L_PHY= LIBPHY=" |
---|
415 | endif |
---|
416 | |
---|
417 | ######################################################################## |
---|
418 | #subtilites sur le nom de la librairie |
---|
419 | ######################################################################## |
---|
420 | |
---|
421 | |
---|
422 | \rm tmp ; touch tmp |
---|
423 | \rm tmp90 ; touch tmp90 |
---|
424 | foreach i ( $optim90 ) |
---|
425 | echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp |
---|
426 | end |
---|
427 | set suf= |
---|
428 | foreach i ( `sort tmp | uniq ` ) |
---|
429 | set suf=$suf$i |
---|
430 | end |
---|
431 | if ( ! $IBM ) then |
---|
432 | set nomlib="$nomlib$suf" |
---|
433 | endif |
---|
434 | if ( $DEC ) then |
---|
435 | set nomlib=DEC |
---|
436 | endif |
---|
437 | |
---|
438 | # dimension |
---|
439 | echo "dimension avant sed $dim" |
---|
440 | if ( $IBM ) then |
---|
441 | set dim=`echo $dim | sed -en 's/[^0-9]/ /g'` |
---|
442 | set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'` |
---|
443 | else if ( $SUN || $XNEC ) then |
---|
444 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
445 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
446 | else |
---|
447 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
448 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
449 | endif |
---|
450 | |
---|
451 | # bands |
---|
452 | echo "bands avant sed $bands" |
---|
453 | if ( $IBM ) then |
---|
454 | set bands=`echo $bands | sed -en 's/[^0-9]/ /g'` |
---|
455 | set bands_=`echo $bands | sed -en 's/[^0-9]/_/g'` |
---|
456 | else if ( $SUN || $XNEC ) then |
---|
457 | set bands=`echo $bands | sed -e 's/[^0-9]/ /g'` |
---|
458 | set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'` |
---|
459 | else |
---|
460 | set bands=`echo $bands | sed -e 's/[^0-9]/ /g'` |
---|
461 | set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'` |
---|
462 | endif |
---|
463 | |
---|
464 | |
---|
465 | # build final name of libraries directory: |
---|
466 | if ( "$dyntype" == "olddyn" ) then |
---|
467 | set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}_olddyn |
---|
468 | else |
---|
469 | set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille} |
---|
470 | endif |
---|
471 | |
---|
472 | # Append number of bands to nomlib (new for universal model) |
---|
473 | set nomlib=${nomlib}_${bands_} |
---|
474 | |
---|
475 | # Append 'physique' type, if it is not mars, to nomlib |
---|
476 | if ( "$physique" != "mars" ) then |
---|
477 | set nomlib=${nomlib}_${physique} |
---|
478 | endif |
---|
479 | |
---|
480 | ## M-A-F nomlib trop long sur CRAY pour ar |
---|
481 | if ( $CRAY ) then |
---|
482 | set nomlib=F90_${dim_}_t${ntrac} |
---|
483 | endif |
---|
484 | if ( $NEC || $XNEC ) then |
---|
485 | set nomlib=F90_${dim_}_t${ntrac} |
---|
486 | endif |
---|
487 | |
---|
488 | echo "calcul de la dimension" |
---|
489 | set dimc=`echo $dim | wc -w` |
---|
490 | |
---|
491 | if ( "$dimc" == "2" ) then |
---|
492 | set include="$include "'-I$(LIBF)/dyn2d ' |
---|
493 | set dimh=$dim |
---|
494 | else |
---|
495 | if ( "$dyntype" == "olddyn" ) then |
---|
496 | set include="$include "'-I$(LIBF)/olddyn3d ' |
---|
497 | else |
---|
498 | set include="$include "'-I$(LIBF)/dyn3d ' |
---|
499 | endif |
---|
500 | set dimh=`echo $dim | awk ' { print $1 "." $2 } '` |
---|
501 | endif |
---|
502 | echo "dimc is $dimc" |
---|
503 | |
---|
504 | ######################################################################## |
---|
505 | # path pour les #include |
---|
506 | ######################################################################## |
---|
507 | |
---|
508 | set include="$include -I$NCDFINC " |
---|
509 | echo $include |
---|
510 | |
---|
511 | ######################################################################## |
---|
512 | # Gestion des dimensions du modele. |
---|
513 | # on cree ou remplace le fichier des dimensions/nombre de traceur |
---|
514 | ######################################################################## |
---|
515 | |
---|
516 | cd $libf/grid |
---|
517 | if ( -f dimensions.h ) then |
---|
518 | echo "WARNING: you are already compiling the model somewhere else" |
---|
519 | echo "Wait until the first compilation is finished before starting." |
---|
520 | echo "If you are sure that you are not compiling elsewhere, you can" |
---|
521 | echo "type [yes] to continue." |
---|
522 | echo "Do you want to continue?" |
---|
523 | if ( $< == "yes" ) then |
---|
524 | #remove old dimensions.h , bands.h and scatterers.h files |
---|
525 | \rm -f $libf/grid/dimensions.h |
---|
526 | \rm -f $libf/grid/bands.h |
---|
527 | \rm -f $libf/phy${physique}/bands.h |
---|
528 | \rm -f $libf/phy${physique}/scatterers.h |
---|
529 | else |
---|
530 | exit |
---|
531 | endif |
---|
532 | endif |
---|
533 | |
---|
534 | # Build the appropriate 'dimensions.h' file |
---|
535 | cd dimension |
---|
536 | ./makdim $ntrac $dim |
---|
537 | # echo contents of dimensions.h to standard output |
---|
538 | cat $libf/grid/dimensions.h |
---|
539 | |
---|
540 | # Build the appropriate 'bands.h' file |
---|
541 | cd $libf/phy$physique/bands |
---|
542 | ./makbands $bands |
---|
543 | # echo contents of bands.h to standard output |
---|
544 | cat $libf/phy$physique/bands.h |
---|
545 | |
---|
546 | # Build the appropriate 'scatterers.h' file |
---|
547 | cd $libf/phy$physique/scatterers |
---|
548 | ./make_scatterers $scatterers |
---|
549 | # echo contents of scatterers.h to standard output |
---|
550 | cat $libf/phy$physique/scatterers.h |
---|
551 | |
---|
552 | cd $LMDGCM |
---|
553 | # set path to objects directory |
---|
554 | set libo=$libo/$nomlib |
---|
555 | # create objects directory, if it doesn't exist |
---|
556 | if ( ! -d $libo ) then |
---|
557 | mkdir $libo |
---|
558 | cd $model |
---|
559 | endif |
---|
560 | |
---|
561 | ######################################################################## |
---|
562 | # Differentes dynamiques (3d, 2d, 1d) |
---|
563 | ######################################################################## |
---|
564 | |
---|
565 | set dimension=`echo $dim | wc -w` |
---|
566 | echo dimension $dimension dim $dim |
---|
567 | if ( $dimension == 1 ) then |
---|
568 | echo pas de dynamique |
---|
569 | set dyn="L_DYN= DYN= L_FILTRE= " |
---|
570 | endif |
---|
571 | endif |
---|
572 | |
---|
573 | cd $model |
---|
574 | if ( $dimension == 3 ) then |
---|
575 | cd libf/grid |
---|
576 | \rm fxyprim.h |
---|
577 | cp -p fxy_${grille}.h fxyprim.h |
---|
578 | endif |
---|
579 | |
---|
580 | ###################################################################### |
---|
581 | # Gestion du filtre qui n'existe qu'en 3d. |
---|
582 | ###################################################################### |
---|
583 | |
---|
584 | # set filtre to 'oldfiltrez' if using -olddyn option |
---|
585 | if ( "$dyntype" == "olddyn" ) then |
---|
586 | set filtre="oldfiltrez" |
---|
587 | endif |
---|
588 | |
---|
589 | if ( `expr $dimc \> 2` == 1 ) then |
---|
590 | set filtre="FILTRE=$filtre" |
---|
591 | else |
---|
592 | set filtre="FILTRE= L_FILTRE= " |
---|
593 | endif |
---|
594 | echo "MACRO FILTRE $filtre" |
---|
595 | |
---|
596 | echo "dimc $dimc" |
---|
597 | |
---|
598 | ######################################################################## |
---|
599 | # Avant de lancer le make, on recree le makefile si necessaire |
---|
600 | ######################################################################## |
---|
601 | # c'est a dire dans 3 cas: |
---|
602 | # 1. si la liste des fichiers .F et .h a ete modifiee depuis la |
---|
603 | # derniere creation du makefile |
---|
604 | # 2. si le fichier contenant cette liste "liste_des_sources" |
---|
605 | # n'existe pas. |
---|
606 | # 3. Si le makefile n'existe pas. |
---|
607 | ######################################################################## |
---|
608 | |
---|
609 | cd $model |
---|
610 | find libf -name '*.[Fh]' -print | sort >! tmp77 |
---|
611 | #find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90 |
---|
612 | find libf -name '*.[Fh]90' -print | sort >> tmp90 |
---|
613 | |
---|
614 | if ( `diff tmp77 liste_des_sources_f77 | wc -w` \ |
---|
615 | || `diff tmp90 liste_des_sources_f90 | wc -w` \ |
---|
616 | || ! -f makefile \ |
---|
617 | || ! -f liste_des_sources_f90 \ |
---|
618 | || ! -f liste_des_sources_f77 ) then |
---|
619 | echo "les fichiers suivants ont ete crees ou detruits" |
---|
620 | echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90" |
---|
621 | diff liste_des_sources_f77 tmp77 |
---|
622 | diff liste_des_sources_f90 tmp90 |
---|
623 | \cp tmp77 liste_des_sources_f77 |
---|
624 | \cp tmp90 liste_des_sources_f90 |
---|
625 | echo "Remaking the makefile!" |
---|
626 | if ("$dyntype" == "olddyn") then |
---|
627 | ./create_make_gcm olddyn3d grid bibio phy$physique >! tmp |
---|
628 | else |
---|
629 | ./create_make_gcm dyn3d grid bibio phy$physique >! tmp |
---|
630 | endif |
---|
631 | \mv tmp makefile |
---|
632 | echo "New makefile created." |
---|
633 | endif |
---|
634 | |
---|
635 | ######################################################################## |
---|
636 | # Execution de la comande make |
---|
637 | ######################################################################## |
---|
638 | |
---|
639 | |
---|
640 | echo PHYSIQUE $phys |
---|
641 | echo dynamique $dyn $dimension |
---|
642 | echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code |
---|
643 | echo PATH pour les fichiers INCLUDE $include |
---|
644 | echo OPLINK="$oplink" |
---|
645 | |
---|
646 | if $HP then |
---|
647 | set f77='fort77 +OP' |
---|
648 | set f90='jensaisrien' |
---|
649 | set opt_link="$opt_link -lm" |
---|
650 | else if $VPP then |
---|
651 | set f77=frt |
---|
652 | set f90=$f77 |
---|
653 | else if $CRAY then |
---|
654 | set f77=f90 |
---|
655 | set f90=f90 |
---|
656 | else if $LINUX then |
---|
657 | set f77=ifort |
---|
658 | set f90=ifort |
---|
659 | #### uncomment for double precision |
---|
660 | # set f77="ifort -real-size 64 -DNC_DOUBLE" |
---|
661 | # set f90="ifort -real-size 64 -DNC_DOUBLE" |
---|
662 | set opt_link=" -L$LIBOGCM -L$NCDFLIB -lnetcdf " |
---|
663 | # set f77=pgf90 |
---|
664 | # set f90=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 | # etat0_netcdf a besoin d'info de la physique |
---|
698 | # A revoir |
---|
699 | set include="$include"" -I$libf/phy$physique" |
---|
700 | |
---|
701 | |
---|
702 | ################################################################# |
---|
703 | # Execution de la comande make... ENFIN! |
---|
704 | ################################################################# |
---|
705 | |
---|
706 | if $VPP then |
---|
707 | set optim90=" $optim90 -Am -M$libo" |
---|
708 | set optimtru90="$optim90" |
---|
709 | else if $SUN then |
---|
710 | set optim90=" $optim90 -M$libo" |
---|
711 | set optimtru90=" $optimtru90 " |
---|
712 | else if $NEC then |
---|
713 | set optim90=" $optim90 -I$libo " |
---|
714 | else if $XNEC then |
---|
715 | set optim90=" $optim90 -I$libo " |
---|
716 | set optimtru90=" $optimtru90 -I$libo " |
---|
717 | else if $LINUX then |
---|
718 | set optim="$optim -module $libo" |
---|
719 | set optim90="$optim90 -module $libo" |
---|
720 | set optimtru90="$optimtru90 -module $libo" |
---|
721 | # Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above) |
---|
722 | # set mod_loc_dir=$libo |
---|
723 | endif |
---|
724 | |
---|
725 | set link="$f90 $optim90" |
---|
726 | |
---|
727 | set ar=ar |
---|
728 | |
---|
729 | if $XNEC then |
---|
730 | set link="sxld $opt_link" |
---|
731 | set link="$f90 " |
---|
732 | # set ar=sxar |
---|
733 | endif |
---|
734 | |
---|
735 | cd $localdir |
---|
736 | |
---|
737 | set source_code=${code}.F |
---|
738 | # handle cases when the main program is in the physics directory |
---|
739 | if (-f $LMDGCM/libf/phy${physique}/${code}.F) then |
---|
740 | set dyn="$dyn DIRMAIN=phy$physique " |
---|
741 | endif |
---|
742 | if (-f $LMDGCM/libf/phy${physique}/${code}.F90) then |
---|
743 | set source_code=${code}.F90 |
---|
744 | set dyn="$dyn DIRMAIN=phy$physique " |
---|
745 | endif |
---|
746 | |
---|
747 | echo $make -f $LMDGCM/makefile \ |
---|
748 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
749 | OPTIM="$optim" \ |
---|
750 | OPTIM90="$optim90" \ |
---|
751 | OPTIMTRU90="$optimtru90" \ |
---|
752 | INCLUDE="$include" \ |
---|
753 | $filtre \ |
---|
754 | LIBO=$libo \ |
---|
755 | $dyn \ |
---|
756 | $phys \ |
---|
757 | DIM=$dimc \ |
---|
758 | DYNTYPE="$dyntype" \ |
---|
759 | L_ADJNT="$adjnt" \ |
---|
760 | LOCAL_DIR="$localdir" \ |
---|
761 | F77="$f77" \ |
---|
762 | F90="$f90" \ |
---|
763 | OPLINK="$oplink" \ |
---|
764 | LINK="$link" \ |
---|
765 | GCM="$LMDGCM" \ |
---|
766 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
767 | MOD_SUFFIX=$mod_suffix \ |
---|
768 | AR=$ar \ |
---|
769 | SOURCE=$source_code \ |
---|
770 | PROG=$code |
---|
771 | |
---|
772 | $make -f $LMDGCM/makefile \ |
---|
773 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
774 | OPTIM="$optim" \ |
---|
775 | OPTIM90="$optim90" \ |
---|
776 | OPTIMTRU90="$optimtru90" \ |
---|
777 | INCLUDE="$include" \ |
---|
778 | $filtre \ |
---|
779 | LIBO=$libo \ |
---|
780 | $dyn \ |
---|
781 | $phys \ |
---|
782 | DIM=$dimc \ |
---|
783 | DYNTYPE="$dyntype" \ |
---|
784 | L_ADJNT="$adjnt" \ |
---|
785 | LOCAL_DIR="$localdir" \ |
---|
786 | F77="$f77" \ |
---|
787 | F90="$f90" \ |
---|
788 | OPLINK="$oplink" \ |
---|
789 | LINK="$link" \ |
---|
790 | GCM="$LMDGCM" \ |
---|
791 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
792 | MOD_SUFFIX=$mod_suffix \ |
---|
793 | AR=$ar \ |
---|
794 | SOURCE=$source_code \ |
---|
795 | PROG=$code |
---|
796 | |
---|
797 | \rm -f $libf/grid/dimensions.h |
---|
798 | \rm -f $libf/grid/bands.h |
---|
799 | \rm -f $libf/phy${physique}/bands.h |
---|
800 | \rm -f $libf/phy$physique/scatterers.h |
---|