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