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