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