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