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