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)/dynphy_lonlat' |
---|
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_common phy$physique" |
---|
417 | set include="$include "'-I$(LIBF)/phy_common -I$(LIBF)/phy'"$physique" |
---|
418 | set LIBPHY_COMMON='$(LIBO)/libphy_common.a' |
---|
419 | endif |
---|
420 | set libdyn_phy="" |
---|
421 | set LIBDYN_PHYS="" |
---|
422 | ######################################################################## |
---|
423 | #subtilites sur le nom de la librairie |
---|
424 | ######################################################################## |
---|
425 | |
---|
426 | |
---|
427 | \rm tmp ; touch tmp |
---|
428 | \rm tmp90 ; touch tmp90 |
---|
429 | foreach i ( $optim90 ) |
---|
430 | echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp |
---|
431 | end |
---|
432 | set suf= |
---|
433 | foreach i ( `sort tmp | uniq ` ) |
---|
434 | set suf=$suf$i |
---|
435 | end |
---|
436 | if ( ! $IBM ) then |
---|
437 | set nomlib="$nomlib$suf" |
---|
438 | endif |
---|
439 | if ( $DEC ) then |
---|
440 | set nomlib=DEC |
---|
441 | endif |
---|
442 | |
---|
443 | # dimension |
---|
444 | echo "dimension avant sed $dim" |
---|
445 | if ( $IBM ) then |
---|
446 | set dim=`echo $dim | sed -en 's/[^0-9]/ /g'` |
---|
447 | set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'` |
---|
448 | else if ( $SUN || $XNEC ) then |
---|
449 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
450 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
451 | else |
---|
452 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
453 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
454 | endif |
---|
455 | |
---|
456 | # bands |
---|
457 | echo "bands avant sed $bands" |
---|
458 | if ( $IBM ) then |
---|
459 | set bands=`echo $bands | sed -en 's/[^0-9]/ /g'` |
---|
460 | set bands_=`echo $bands | sed -en 's/[^0-9]/_/g'` |
---|
461 | else if ( $SUN || $XNEC ) then |
---|
462 | set bands=`echo $bands | sed -e 's/[^0-9]/ /g'` |
---|
463 | set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'` |
---|
464 | else |
---|
465 | set bands=`echo $bands | sed -e 's/[^0-9]/ /g'` |
---|
466 | set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'` |
---|
467 | endif |
---|
468 | |
---|
469 | |
---|
470 | # build final name of libraries directory: |
---|
471 | if ( "$dyntype" == "olddyn" ) then |
---|
472 | set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}_olddyn |
---|
473 | else |
---|
474 | set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille} |
---|
475 | endif |
---|
476 | |
---|
477 | # Append number of bands to nomlib (new for universal model) |
---|
478 | set nomlib=${nomlib}_${bands_} |
---|
479 | |
---|
480 | # Append 'physique' type, if it is not mars, to nomlib |
---|
481 | if ( "$physique" != "mars" ) then |
---|
482 | set nomlib=${nomlib}_${physique} |
---|
483 | endif |
---|
484 | |
---|
485 | ## M-A-F nomlib trop long sur CRAY pour ar |
---|
486 | if ( $CRAY ) then |
---|
487 | set nomlib=F90_${dim_}_t${ntrac} |
---|
488 | endif |
---|
489 | if ( $NEC || $XNEC ) then |
---|
490 | set nomlib=F90_${dim_}_t${ntrac} |
---|
491 | endif |
---|
492 | |
---|
493 | echo "calcul de la dimension" |
---|
494 | set dimc=`echo $dim | wc -w` |
---|
495 | |
---|
496 | if ( "$dimc" == "2" ) then |
---|
497 | set include="$include "'-I$(LIBF)/dyn2d ' |
---|
498 | set dimh=$dim |
---|
499 | endif |
---|
500 | if ( "$dimc" == "3" ) then |
---|
501 | if ( "$dyntype" == "olddyn" ) then |
---|
502 | set include="$include "'-I$(LIBF)/olddyn3d ' |
---|
503 | set src_dirs="$src_dirs olddyn3d dynphy_lonlat dynphy_lonlat/phy$physique" |
---|
504 | else |
---|
505 | set include="$include "'-I$(LIBF)/dyn3d ' |
---|
506 | set src_dirs="$src_dirs dyn3d dynphy_lonlat dynphy_lonlat/phy$physique" |
---|
507 | endif |
---|
508 | set libdyn_phy="-ldynphy_lonlat" |
---|
509 | set LIBDYN_PHYS='$(LIBO)/libdynphy_lonlat.a' |
---|
510 | set dimh=`echo $dim | awk ' { print $1 "." $2 } '` |
---|
511 | endif |
---|
512 | echo "dimc is $dimc" |
---|
513 | |
---|
514 | ######################################################################## |
---|
515 | # path pour les #include |
---|
516 | ######################################################################## |
---|
517 | |
---|
518 | set include="$include -I$NCDFINC " |
---|
519 | echo $include |
---|
520 | |
---|
521 | ######################################################################## |
---|
522 | # Gestion des dimensions du modele. |
---|
523 | # on cree ou remplace le fichier des dimensions/nombre de traceur |
---|
524 | ######################################################################## |
---|
525 | |
---|
526 | cd $libf/grid |
---|
527 | if ( -f dimensions.h ) then |
---|
528 | echo "WARNING: you are already compiling the model somewhere else" |
---|
529 | echo "Wait until the first compilation is finished before starting." |
---|
530 | echo "If you are sure that you are not compiling elsewhere, you can" |
---|
531 | echo "type [yes] to continue." |
---|
532 | echo "Do you want to continue?" |
---|
533 | if ( $< == "yes" ) then |
---|
534 | #remove old dimensions.h , bands.h and scatterers.h files |
---|
535 | \rm -f $libf/grid/dimensions.h |
---|
536 | \rm -f $libf/grid/bands.h |
---|
537 | \rm -f $libf/phy${physique}/bands.h |
---|
538 | \rm -f $libf/phy${physique}/scatterers.h |
---|
539 | else |
---|
540 | exit |
---|
541 | endif |
---|
542 | endif |
---|
543 | |
---|
544 | # Build the appropriate 'dimensions.h' file |
---|
545 | cd dimension |
---|
546 | ./makdim $dim |
---|
547 | # echo contents of dimensions.h to standard output |
---|
548 | cat $libf/grid/dimensions.h |
---|
549 | |
---|
550 | # Build the appropriate 'bands.h' file |
---|
551 | cd $libf/phy$physique/bands |
---|
552 | ./makbands $bands |
---|
553 | # echo contents of bands.h to standard output |
---|
554 | cat $libf/phy$physique/bands.h |
---|
555 | |
---|
556 | # Build the appropriate 'scatterers.h' file |
---|
557 | cd $libf/phy$physique/scatterers |
---|
558 | ./make_scatterers $scatterers |
---|
559 | # echo contents of scatterers.h to standard output |
---|
560 | cat $libf/phy$physique/scatterers.h |
---|
561 | |
---|
562 | cd $LMDGCM |
---|
563 | # set path to objects directory |
---|
564 | set libo=$libo/$nomlib |
---|
565 | # create objects directory, if it doesn't exist |
---|
566 | if ( ! -d $libo ) then |
---|
567 | mkdir $libo |
---|
568 | cd $model |
---|
569 | endif |
---|
570 | |
---|
571 | ######################################################################## |
---|
572 | # Differentes dynamiques (3d, 2d, 1d) |
---|
573 | ######################################################################## |
---|
574 | |
---|
575 | set dimension=`echo $dim | wc -w` |
---|
576 | echo dimension $dimension dim $dim |
---|
577 | if ( $dimension == 1 ) then |
---|
578 | echo "No dynamics" |
---|
579 | ## set dyn="L_DYN= DYN= L_FILTRE= " |
---|
580 | ## NB: we still need to have L_DYN=libdyn3d to reach routines and module |
---|
581 | ## objects which are located in dyn3d |
---|
582 | set dyntype="" |
---|
583 | set filtre="L_DYN= DYN= FILTRE= L_FILTRE= " |
---|
584 | set dyn="L_DYN= DYN= L_FILTRE= " |
---|
585 | set dirmain="phy$physique/dyn1d" |
---|
586 | set src_dirs="$src_dirs phy$physique/dyn1d " |
---|
587 | set include="$include "' -I$(LIBF)/phy'"$physique"'/dyn1d' |
---|
588 | endif |
---|
589 | endif |
---|
590 | |
---|
591 | cd $model |
---|
592 | if ( $dimension == 3 ) then |
---|
593 | cd libf/grid |
---|
594 | \rm fxyprim.h |
---|
595 | cp -p fxy_${grille}.h fxyprim.h |
---|
596 | endif |
---|
597 | |
---|
598 | ###################################################################### |
---|
599 | # Gestion du filtre qui n'existe qu'en 3d. |
---|
600 | ###################################################################### |
---|
601 | |
---|
602 | # set filtre to 'oldfiltrez' if using -olddyn option |
---|
603 | if ( "$dyntype" == "olddyn" ) then |
---|
604 | set filtre="oldfiltrez" |
---|
605 | endif |
---|
606 | |
---|
607 | if ( `expr $dimc \> 2` == 1 ) then |
---|
608 | set filtre="FILTRE=$filtre" |
---|
609 | if ( "$dyntype" == "olddyn" ) then |
---|
610 | set src_dirs="$src_dirs oldfiltrez" |
---|
611 | else |
---|
612 | set src_dirs="$src_dirs filtrez" |
---|
613 | endif |
---|
614 | else |
---|
615 | set filtre="FILTRE= L_FILTRE= L_DYN= " |
---|
616 | endif |
---|
617 | echo "MACRO FILTRE $filtre" |
---|
618 | |
---|
619 | echo "dimc $dimc" |
---|
620 | |
---|
621 | #cleanup for a full recompilation, if requested |
---|
622 | if ("$full" == "full") then |
---|
623 | # remove makefile and $libo |
---|
624 | cd $model |
---|
625 | \rm -f makefile |
---|
626 | \rm -rf $libo/* |
---|
627 | endif |
---|
628 | |
---|
629 | ######################################################################## |
---|
630 | # Avant de lancer le make, on recree le makefile si necessaire |
---|
631 | ######################################################################## |
---|
632 | # c'est a dire dans 3 cas: |
---|
633 | # 1. si la liste des fichiers .F et .h a ete modifiee depuis la |
---|
634 | # derniere creation du makefile |
---|
635 | # 2. si le fichier contenant cette liste "liste_des_sources" |
---|
636 | # n'existe pas. |
---|
637 | # 3. Si le makefile n'existe pas. |
---|
638 | ######################################################################## |
---|
639 | |
---|
640 | cd $model |
---|
641 | find libf -name '*.[Fh]' -print | sort >! tmp77 |
---|
642 | #find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90 |
---|
643 | find libf -name '*.[Fh]90' -print | sort >> tmp90 |
---|
644 | |
---|
645 | if ( `diff tmp77 liste_des_sources_f77 | wc -w` \ |
---|
646 | || `diff tmp90 liste_des_sources_f90 | wc -w` \ |
---|
647 | || ! -f makefile \ |
---|
648 | || ! -f liste_des_sources_f90 \ |
---|
649 | || ! -f liste_des_sources_f77 ) then |
---|
650 | echo "les fichiers suivants ont ete crees ou detruits" |
---|
651 | echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90" |
---|
652 | diff liste_des_sources_f77 tmp77 |
---|
653 | diff liste_des_sources_f90 tmp90 |
---|
654 | \cp tmp77 liste_des_sources_f77 |
---|
655 | \cp tmp90 liste_des_sources_f90 |
---|
656 | echo "Remaking the makefile!" |
---|
657 | echo "src_dirs: $src_dirs" |
---|
658 | ./create_make_gcm $src_dirs >! tmp |
---|
659 | \mv tmp makefile |
---|
660 | echo "New makefile created." |
---|
661 | endif |
---|
662 | |
---|
663 | ######################################################################## |
---|
664 | # Execution de la comande make |
---|
665 | ######################################################################## |
---|
666 | |
---|
667 | |
---|
668 | echo PHYSIQUE $phys |
---|
669 | echo dynamique $dyn $dimension |
---|
670 | echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code |
---|
671 | echo PATH pour les fichiers INCLUDE $include |
---|
672 | echo OPLINK="$oplink" |
---|
673 | |
---|
674 | if $HP then |
---|
675 | set f77='fort77 +OP' |
---|
676 | set f90='jensaisrien' |
---|
677 | set opt_link="$opt_link -lm" |
---|
678 | else if $VPP then |
---|
679 | set f77=frt |
---|
680 | set f90=$f77 |
---|
681 | else if $CRAY then |
---|
682 | set f77=f90 |
---|
683 | set f90=f90 |
---|
684 | else if $LINUX then |
---|
685 | set f77=ifort |
---|
686 | set f90=ifort |
---|
687 | #### uncomment for double precision |
---|
688 | # set f77="ifort -real-size 64 -DNC_DOUBLE" |
---|
689 | # set f90="ifort -real-size 64 -DNC_DOUBLE" |
---|
690 | set opt_link=" -L$LIBOGCM -L$NCDFLIB -lnetcdf " |
---|
691 | else if $SUN then |
---|
692 | set f77=f90 |
---|
693 | set f90=f90 |
---|
694 | else if $NEC then |
---|
695 | set f77=f90 |
---|
696 | set f90=f90 |
---|
697 | else if $XNEC then |
---|
698 | set f77=sxmpif90 |
---|
699 | set f90=sxmpif90 |
---|
700 | else |
---|
701 | set f77=f77 |
---|
702 | set f90=f90 |
---|
703 | endif |
---|
704 | |
---|
705 | cd $model |
---|
706 | |
---|
707 | if $VPP then |
---|
708 | set make="gmake RANLIB=ls" |
---|
709 | else if $CRAY then |
---|
710 | set make="make RANLIB=ls" |
---|
711 | else if $NEC then |
---|
712 | set make="make RANLIB=ls" |
---|
713 | else if $LINUX then |
---|
714 | set make="make -k RANLIB=ranlib" |
---|
715 | else if $XNEC then |
---|
716 | set make="/usr/local/bin/gmake RANLIB=ls" |
---|
717 | set make="/usr/freeware/bin/gmake RANLIB=ls" |
---|
718 | else |
---|
719 | set make="make RANLIB=ranlib" |
---|
720 | endif |
---|
721 | |
---|
722 | # |
---|
723 | # etat0_netcdf a besoin d'info de la physique |
---|
724 | # A revoir |
---|
725 | set include="$include"" -I$libf/phy$physique" |
---|
726 | |
---|
727 | |
---|
728 | ################################################################# |
---|
729 | # Execution de la comande make... ENFIN! |
---|
730 | ################################################################# |
---|
731 | |
---|
732 | if $VPP then |
---|
733 | set optim90=" $optim90 -Am -M$libo" |
---|
734 | set optimtru90="$optim90" |
---|
735 | else if $SUN then |
---|
736 | set optim90=" $optim90 -M$libo" |
---|
737 | set optimtru90=" $optimtru90 " |
---|
738 | else if $NEC then |
---|
739 | set optim90=" $optim90 -I$libo " |
---|
740 | else if $XNEC then |
---|
741 | set optim90=" $optim90 -I$libo " |
---|
742 | set optimtru90=" $optimtru90 -I$libo " |
---|
743 | else if $LINUX then |
---|
744 | set optim="$optim -module $libo" |
---|
745 | set optim90="$optim90 -module $libo" |
---|
746 | set optimtru90="$optimtru90 -module $libo" |
---|
747 | # Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above) |
---|
748 | # set mod_loc_dir=$libo |
---|
749 | endif |
---|
750 | |
---|
751 | set link="$f90 $optim90" |
---|
752 | |
---|
753 | set ar=ar |
---|
754 | |
---|
755 | if $XNEC then |
---|
756 | set link="sxld $opt_link" |
---|
757 | set link="$f90 " |
---|
758 | # set ar=sxar |
---|
759 | endif |
---|
760 | |
---|
761 | cd $localdir |
---|
762 | |
---|
763 | set source_code=${code}.F |
---|
764 | # handle cases when the main program is in the physics directory |
---|
765 | set dirmain=dyn${dimc}d |
---|
766 | if ( -f $LMDGCM/libf/dyn3d/${code}.F90 ) then |
---|
767 | set source_code=${code}.F90 |
---|
768 | endif |
---|
769 | if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F ) then |
---|
770 | set dirmain=phy${physique}/dyn1d |
---|
771 | set source_code=${code}.F |
---|
772 | endif |
---|
773 | if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F90 ) then |
---|
774 | set dirmain=phy${physique}/dyn1d |
---|
775 | set source_code=${code}.F90 |
---|
776 | endif |
---|
777 | if ( -f $LMDGCM/libf/dynphy_lonlat/phy${physique}/${code}.F ) then |
---|
778 | set dirmain=dynphy_lonlat/phy${physique} |
---|
779 | set source_code=${code}.F |
---|
780 | endif |
---|
781 | if ( -f $LMDGCM/libf/dynphy_lonlat/phy${physique}/${code}.F90 ) then |
---|
782 | set dirmain=dynphy_lonlat/phy${physique} |
---|
783 | set source_code=${code}.F90 |
---|
784 | endif |
---|
785 | |
---|
786 | echo $make -f $LMDGCM/makefile \ |
---|
787 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
788 | OPTIM="$optim" \ |
---|
789 | OPTIM90="$optim90" \ |
---|
790 | OPTIMTRU90="$optimtru90" \ |
---|
791 | INCLUDE="$include" \ |
---|
792 | $filtre \ |
---|
793 | LIBO=$libo \ |
---|
794 | $phys \ |
---|
795 | LIBPHY_COMMON=${LIBPHY_COMMON} \ |
---|
796 | LIBDYN_PHYS=${LIBDYN_PHYS} \ |
---|
797 | DIM=$dimc \ |
---|
798 | DYNTYPE="$dyntype" \ |
---|
799 | L_DYN_PHY="$libdyn_phy" \ |
---|
800 | L_ADJNT="$adjnt" \ |
---|
801 | LOCAL_DIR="$localdir" \ |
---|
802 | F77="$f77" \ |
---|
803 | F90="$f90" \ |
---|
804 | OPLINK="$oplink" \ |
---|
805 | LINK="$link" \ |
---|
806 | GCM="$LMDGCM" \ |
---|
807 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
808 | MOD_SUFFIX=$mod_suffix \ |
---|
809 | AR=$ar \ |
---|
810 | DIRMAIN=$dirmain \ |
---|
811 | SOURCE=$source_code \ |
---|
812 | PROG=$code |
---|
813 | |
---|
814 | |
---|
815 | $make -f $LMDGCM/makefile \ |
---|
816 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
817 | OPTIM="$optim" \ |
---|
818 | OPTIM90="$optim90" \ |
---|
819 | OPTIMTRU90="$optimtru90" \ |
---|
820 | INCLUDE="$include" \ |
---|
821 | $filtre \ |
---|
822 | LIBO=$libo \ |
---|
823 | $phys \ |
---|
824 | LIBPHY_COMMON=${LIBPHY_COMMON} \ |
---|
825 | LIBDYN_PHYS=${LIBDYN_PHYS} \ |
---|
826 | DIM=$dimc \ |
---|
827 | DYNTYPE="$dyntype" \ |
---|
828 | L_DYN_PHY="$libdyn_phy" \ |
---|
829 | L_ADJNT="$adjnt" \ |
---|
830 | LOCAL_DIR="$localdir" \ |
---|
831 | F77="$f77" \ |
---|
832 | F90="$f90" \ |
---|
833 | OPLINK="$oplink" \ |
---|
834 | LINK="$link" \ |
---|
835 | GCM="$LMDGCM" \ |
---|
836 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
837 | MOD_SUFFIX=$mod_suffix \ |
---|
838 | AR=$ar \ |
---|
839 | DIRMAIN=$dirmain \ |
---|
840 | SOURCE=$source_code \ |
---|
841 | PROG=$code |
---|
842 | |
---|
843 | \rm -f $libf/grid/dimensions.h |
---|
844 | \rm -f $libf/grid/bands.h |
---|
845 | \rm -f $libf/phy$physique/bands.h |
---|
846 | \rm -f $libf/phy$physique/scatterers.h |
---|