[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/libo |
---|
| 26 | #if ( `uname -m` == "x86_64" ) then |
---|
| 27 | # 64 bit machines |
---|
| 28 | # setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_g95/lib |
---|
| 29 | # setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_g95/include |
---|
| 30 | #else |
---|
| 31 | # setenv NCDFLIB /donnees/emlmd/netcdf-4.0.1_g95/lib |
---|
| 32 | # setenv NCDFINC /donnees/emlmd/netcdf-4.0.1_g95/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 | # Ehouarn 'g95' compiler |
---|
| 182 | set optim="-O3 -fstatic -funroll-loops " |
---|
| 183 | set optim90=" -O3 -fstatic -funroll-loops " |
---|
| 184 | set optimtru90=" -O3 -fstatic -funroll-loops " |
---|
| 185 | # set opt_link=" -Mfree -L/usr/local/pgi/linux86/lib -lpgf90 -lpgftnrtl -lpghpf -lpghpf2 -L$NCDFLIB -lnetcdf -Wl,-Bstatic " |
---|
| 186 | # Ehouarn: there is no /usr/local/pgi/linux86/lib, but it doesn't matter |
---|
| 187 | # also changed -Wl,-Bstatic to -Bstatic |
---|
| 188 | set opt_link=" -L$NCDFLIB -lnetcdf " |
---|
| 189 | set mod_loc_dir=$localdir |
---|
| 190 | set mod_suffix=mod |
---|
| 191 | else if $NEC then |
---|
| 192 | set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
| 193 | set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
| 194 | ### set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lioipsl -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v " |
---|
| 195 | set opt_link=" -C hopt -float0 -ew -P static -L/SX/usr/local/lib -lnetcdf_i8r8 " |
---|
| 196 | set mod_loc_dir="." |
---|
| 197 | set mod_suffix="mod" |
---|
| 198 | else if $XNEC then |
---|
| 199 | set optim90=' -clear -R5 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
| 200 | set optimtru90=' -clear -R5 -f4 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
| 201 | if $MODIPSL then |
---|
| 202 | if $COUPLE then |
---|
| 203 | set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
| 204 | else |
---|
| 205 | set opt_link="-L$IOIPSLDIR -lsxioipsl -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
| 206 | endif |
---|
| 207 | set mod_loc_dir="./" |
---|
| 208 | else |
---|
| 209 | #### set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lsxioipsl -L /u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8" |
---|
| 210 | set opt_link=" -C hopt -float0 -ew -P static -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8" |
---|
| 211 | set mod_loc_dir="." |
---|
| 212 | endif |
---|
| 213 | set mod_suffix="mod" |
---|
| 214 | |
---|
| 215 | endif |
---|
| 216 | |
---|
| 217 | # Ehouarn: add 'g95' string to pathname |
---|
| 218 | set nomlib=${machine}_g95 |
---|
| 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_g95 |
---|
| 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 | -t ntrac Selects the number of tracers present in the model |
---|
| 275 | |
---|
| 276 | Options -d and -t overwrite file |
---|
| 277 | $LMDGCM/libf/grid/dimensions.h |
---|
| 278 | which contains the 3 dimensions of the |
---|
| 279 | horizontal grid |
---|
| 280 | im, jm, lm plus the number of tracers passively advected |
---|
| 281 | by the dynamics ntrac, |
---|
| 282 | in 4 PARAMETER FORTRAN format |
---|
| 283 | with a new file: |
---|
| 284 | $LMDGCM/libf/grid/dimension/dimensions.im.jm.lm.tntrac |
---|
| 285 | If the file does not exist already |
---|
| 286 | it is created by the script |
---|
| 287 | $LMDGCM/libf/grid/dimension/makdim |
---|
| 288 | |
---|
| 289 | -p PHYS Selects the set of physical parameterizations |
---|
| 290 | you want to compile the model with. |
---|
| 291 | The model is then compiled using the physical |
---|
| 292 | parameterization sources in directory: |
---|
| 293 | $LMDGCM/libf/phyPHYS |
---|
| 294 | |
---|
| 295 | -g grille Selects the grid type. |
---|
| 296 | This option overwrites file |
---|
| 297 | $LMDGCM/libf/grid/fxyprim.h |
---|
| 298 | with file |
---|
| 299 | $LMDGCM/libf/grid/fxy_grille.h |
---|
| 300 | the grid can take the following values: |
---|
| 301 | 1. reg - the regular grid |
---|
| 302 | 2. sin - to obtain equidistant points in terms of sin(latitude) |
---|
| 303 | 3. new - to zoom into a part of the globe |
---|
| 304 | |
---|
| 305 | -O "compilation options" set of fortran compilation options to use |
---|
| 306 | |
---|
| 307 | -include path |
---|
| 308 | Used if the subroutines contain #include files (ccp) that |
---|
| 309 | are located in directories that are not referenced by default. |
---|
| 310 | |
---|
| 311 | -adjnt Compiles the adjoint model to the dynamical code. |
---|
| 312 | |
---|
| 313 | -olddyn To compile GCM with "old dynamics" |
---|
| 314 | |
---|
| 315 | -filtre filter |
---|
| 316 | To select the longitudinal filter in the polar regions. |
---|
| 317 | "filter" corresponds to the name of a directory located in |
---|
| 318 | $LMDGCM/libf. The standard filter for the model is "filtrez" |
---|
| 319 | which can be used for a regular grid and for a |
---|
| 320 | grid with longitudinal zoom. |
---|
| 321 | |
---|
| 322 | -link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..." |
---|
| 323 | Adds a link to FORTRAN libraries |
---|
| 324 | libfile1.a, libfile2.a ... |
---|
| 325 | located in directories dir1, dir2 ...respectively |
---|
| 326 | If dirn is a directory with an automatic path |
---|
| 327 | (/usr/lib ... for example) |
---|
| 328 | there is no need to specify -Ldirn. |
---|
| 329 | |
---|
| 330 | eod |
---|
| 331 | exit |
---|
| 332 | |
---|
| 333 | ######################################################################## |
---|
| 334 | # Lecture des differentes options |
---|
| 335 | ######################################################################## |
---|
| 336 | |
---|
| 337 | case -d: |
---|
| 338 | set dim=$2 ; shift ; shift ; goto top |
---|
| 339 | |
---|
| 340 | case -O: |
---|
| 341 | set optim="$2" ; set optim90="$2" ; set optimtru90="$2" ; shift ; shift ; goto top |
---|
| 342 | |
---|
| 343 | case -p |
---|
| 344 | set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top |
---|
| 345 | |
---|
| 346 | case -g |
---|
| 347 | set grille="$2" ; shift ; shift ; goto top |
---|
| 348 | |
---|
| 349 | case -t |
---|
| 350 | set ntrac=$2 ; shift ; shift ; goto top |
---|
| 351 | |
---|
| 352 | case -include |
---|
| 353 | set include="$include -I$2" ; shift ; shift ; goto top |
---|
| 354 | |
---|
| 355 | case -adjnt |
---|
| 356 | set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d " |
---|
| 357 | |
---|
| 358 | case -olddyn |
---|
| 359 | set dyntype="olddyn" ; shift; goto top |
---|
| 360 | |
---|
| 361 | case -filtre |
---|
| 362 | set filtre=$2 ; shift ; shift ; goto top |
---|
| 363 | |
---|
| 364 | case -link |
---|
| 365 | set opt_link="$opt_link $2" ; shift ; shift ; goto top |
---|
| 366 | |
---|
| 367 | case -debug |
---|
| 368 | if $HP then |
---|
| 369 | set optim90=" -g " |
---|
| 370 | else if $SUN then |
---|
| 371 | setenv PARALLEL 4 |
---|
| 372 | set optim90=" -g -C " |
---|
| 373 | set optimtru90=" -g -C " |
---|
| 374 | else if $CRAY then |
---|
| 375 | set optim90="$optim90"" -G1 " |
---|
| 376 | else if $LINUX then |
---|
| 377 | set optim90="-g -Mbounds " |
---|
| 378 | else |
---|
| 379 | echo "pas d option debug predefinie pour cette machine" |
---|
| 380 | exit |
---|
| 381 | endif |
---|
| 382 | shift ; goto top |
---|
| 383 | |
---|
| 384 | default |
---|
| 385 | set code="$1" ; shift ; goto top |
---|
| 386 | |
---|
| 387 | endsw |
---|
| 388 | endif |
---|
| 389 | |
---|
| 390 | echo "apres les opts dim $dim" |
---|
| 391 | |
---|
| 392 | ######################################################################## |
---|
| 393 | # cas special sans physique |
---|
| 394 | ######################################################################## |
---|
| 395 | if ( "$physique" == 'nophys' ) then |
---|
| 396 | set phys="L_PHY= LIBPHY=" |
---|
| 397 | endif |
---|
| 398 | |
---|
| 399 | ######################################################################## |
---|
| 400 | # choix du nombre de traceur par defaut si il n'a pas ete choisi, |
---|
| 401 | # suivant la physique |
---|
| 402 | ######################################################################## |
---|
| 403 | |
---|
| 404 | if ( $ntrac == 0 ) then |
---|
| 405 | if ( "$physique" == 'nophys' ) then |
---|
| 406 | set ntrac=1 |
---|
| 407 | else if ( "$physique" == 'lmd' ) then |
---|
| 408 | set ntrac=2 |
---|
| 409 | else if ( "$physique" == 'lmd_test_li' ) then |
---|
| 410 | set ntrac=2 |
---|
| 411 | else if ( "$physique" == 'ec' ) then |
---|
| 412 | set ntrac=1 |
---|
| 413 | else |
---|
| 414 | set ntrac = 1 |
---|
| 415 | endif |
---|
| 416 | endif |
---|
| 417 | |
---|
| 418 | ######################################################################## |
---|
| 419 | #subtilites sur le nom de la librairie |
---|
| 420 | ######################################################################## |
---|
| 421 | |
---|
| 422 | \rm tmp ; touch tmp |
---|
| 423 | \rm tmp90 ; touch tmp90 |
---|
| 424 | foreach i ( $optim90 ) |
---|
| 425 | echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp |
---|
| 426 | end |
---|
| 427 | set suf= |
---|
| 428 | foreach i ( `sort tmp | uniq ` ) |
---|
| 429 | set suf=$suf$i |
---|
| 430 | end |
---|
| 431 | if ( ! $IBM ) then |
---|
| 432 | set nomlib="$nomlib$suf" |
---|
| 433 | endif |
---|
| 434 | if ( $DEC ) then |
---|
| 435 | set nomlib=DEC |
---|
| 436 | endif |
---|
| 437 | |
---|
| 438 | # dimension |
---|
| 439 | |
---|
| 440 | echo "dimension avant sed $dim" |
---|
| 441 | if ( $IBM ) then |
---|
| 442 | set dim=`echo $dim | sed -en 's/[^0-9]/ /g'` |
---|
| 443 | set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'` |
---|
| 444 | else if ( $SUN || $XNEC ) then |
---|
| 445 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
| 446 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
| 447 | else |
---|
| 448 | # set dim=`echo $dim | sed -n -e 's/[^0-9]/ /gp'` |
---|
| 449 | # set dim_=`echo $dim | sed -n -e 's/[^0-9]/_/gp'` |
---|
| 450 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
| 451 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
| 452 | endif |
---|
| 453 | |
---|
| 454 | # build final name of libraries directory: |
---|
| 455 | if ( "$dyntype" == "olddyn" ) then |
---|
| 456 | set nomlib=${nomlib}_${dim_}_t${ntrac}_${grille}_olddyn |
---|
| 457 | else |
---|
| 458 | set nomlib=${nomlib}_${dim_}_t${ntrac}_${grille} |
---|
| 459 | endif |
---|
| 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 "ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs" |
---|
| 505 | echo "Attendez que la premiere compilation soit terminee pour relancer la suivante." |
---|
| 506 | echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs," |
---|
| 507 | echo "vous pouvez continuer en repondant oui." |
---|
| 508 | echo "Voulez-vous vraiment continuer?" |
---|
| 509 | if ( $< == "oui" ) then |
---|
| 510 | #remove old dimensions.h file |
---|
| 511 | \rm -f $libf/grid/dimensions.h |
---|
| 512 | else |
---|
| 513 | exit |
---|
| 514 | endif |
---|
| 515 | endif |
---|
| 516 | |
---|
| 517 | # Build the appropriate 'dimensions.h' file |
---|
| 518 | cd dimension |
---|
| 519 | makdim $ntrac $dim |
---|
| 520 | # echo contents of dimensions.h to standard output |
---|
| 521 | cat $libf/grid/dimensions.h |
---|
| 522 | |
---|
| 523 | cd $LMDGCM |
---|
| 524 | # set path to objects directory |
---|
| 525 | set libo=$libo/$nomlib |
---|
| 526 | # create objects directory, if it doesn't exist |
---|
| 527 | if ( ! -d $libo ) then |
---|
| 528 | mkdir $libo |
---|
| 529 | cd $model |
---|
| 530 | endif |
---|
| 531 | |
---|
| 532 | ######################################################################## |
---|
| 533 | # Differentes dynamiques (3d, 2d, 1d) |
---|
| 534 | ######################################################################## |
---|
| 535 | |
---|
| 536 | set dimension=`echo $dim | wc -w` |
---|
| 537 | echo dimension $dimension dim $dim |
---|
| 538 | if ( $dimension == 1 ) then |
---|
| 539 | echo pas de dynamique |
---|
| 540 | set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique " |
---|
| 541 | endif |
---|
| 542 | endif |
---|
| 543 | |
---|
| 544 | cd $model |
---|
| 545 | if ( $dimension == 3 ) then |
---|
| 546 | cd libf/grid |
---|
| 547 | \rm fxyprim.h |
---|
| 548 | cp -p fxy_${grille}.h fxyprim.h |
---|
| 549 | endif |
---|
| 550 | |
---|
| 551 | ###################################################################### |
---|
| 552 | # Traitement special pour le nouveau rayonnement de Laurent Li. |
---|
| 553 | ###################################################################### |
---|
| 554 | |
---|
| 555 | if ( -f $libf/phy$physique/raddim.h ) then |
---|
| 556 | if ( -f $libf/phy$physique/raddim.$dimh.h ) then |
---|
| 557 | \rm $libf/phy$physique/raddim.h |
---|
| 558 | cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h |
---|
| 559 | echo $libf/phy$physique/raddim.$dimh.h |
---|
| 560 | cat $libf/phy$physique/raddim.$dimh.h |
---|
| 561 | cat $libf/phy$physique/raddim.h |
---|
| 562 | else |
---|
| 563 | echo On peut diminuer la taille de l executable en creant |
---|
| 564 | echo le fichier $libf/phy$physique/raddim.$dimh.h |
---|
| 565 | \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h |
---|
| 566 | endif |
---|
| 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 | ######################################################################## |
---|
| 588 | # Avant de lancer le make, on recree le makefile si necessaire |
---|
| 589 | ######################################################################## |
---|
| 590 | # c'est a dire dans 3 cas: |
---|
| 591 | # 1. si la liste des fichiers .F et .h a ete modifiee depuis la |
---|
| 592 | # derniere creation du makefile |
---|
| 593 | # 2. si le fichier contenant cette liste "liste_des_sources" |
---|
| 594 | # n'existe pas. |
---|
| 595 | # 3. Si le makefile n'existe pas. |
---|
| 596 | ######################################################################## |
---|
| 597 | |
---|
| 598 | cd $model |
---|
| 599 | find libf -name '*.[Fh]' -print >! tmp77 |
---|
| 600 | #find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90 |
---|
| 601 | find libf -name '*.[Fh]90' -print >> tmp90 |
---|
| 602 | |
---|
| 603 | if ( `diff tmp77 liste_des_sources_f77 | wc -w` \ |
---|
| 604 | || `diff tmp90 liste_des_sources_f90 | wc -w` \ |
---|
| 605 | || ! -f makefile \ |
---|
| 606 | || ! -f liste_des_sources_f90 \ |
---|
| 607 | || ! -f liste_des_sources_f77 ) then |
---|
| 608 | echo "les fichiers suivants ont ete crees ou detruits" |
---|
| 609 | echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90" |
---|
| 610 | diff liste_des_sources_f77 tmp77 |
---|
| 611 | diff liste_des_sources_f90 tmp90 |
---|
| 612 | \cp tmp77 liste_des_sources_f77 |
---|
| 613 | \cp tmp90 liste_des_sources_f90 |
---|
| 614 | echo "On recree le makefile" |
---|
| 615 | if ("$dyntype" == "olddyn") then |
---|
| 616 | ./create_make_gcm olddyn3d grid bibio aeronomars phy$physique >! tmp |
---|
| 617 | else |
---|
| 618 | ./create_make_gcm dyn3d grid bibio aeronomars phy$physique >! tmp |
---|
| 619 | endif |
---|
| 620 | \mv tmp makefile |
---|
| 621 | echo "Nouveau makefile cree." |
---|
| 622 | endif |
---|
| 623 | |
---|
| 624 | ######################################################################## |
---|
| 625 | # Execution de la comande make |
---|
| 626 | ######################################################################## |
---|
| 627 | |
---|
| 628 | echo PHYSIQUE $phys |
---|
| 629 | echo dynamique $dyn $dimension |
---|
| 630 | echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code |
---|
| 631 | echo PATH pour les fichiers INCLUDE $include |
---|
| 632 | echo OPLINK="$oplink" |
---|
| 633 | |
---|
| 634 | if $HP then |
---|
| 635 | set f77='fort77 +OP' |
---|
| 636 | set f90='jensaisrien' |
---|
| 637 | set opt_link="$opt_link -lm" |
---|
| 638 | else if $VPP then |
---|
| 639 | set f77=frt |
---|
| 640 | set f90=$f77 |
---|
| 641 | else if $CRAY then |
---|
| 642 | set f77=f90 |
---|
| 643 | set f90=f90 |
---|
| 644 | else if $LINUX then |
---|
| 645 | # set f77=pgf90 |
---|
| 646 | # set f90=pgf90 |
---|
| 647 | set f77=g95 |
---|
| 648 | set f90=g95 |
---|
| 649 | else if $SUN then |
---|
| 650 | set f77=f90 |
---|
| 651 | set f90=f90 |
---|
| 652 | else if $NEC then |
---|
| 653 | set f77=f90 |
---|
| 654 | set f90=f90 |
---|
| 655 | else if $XNEC then |
---|
| 656 | set f77=sxmpif90 |
---|
| 657 | set f90=sxmpif90 |
---|
| 658 | else |
---|
| 659 | set f77=f77 |
---|
| 660 | set f90=f90 |
---|
| 661 | endif |
---|
| 662 | |
---|
| 663 | cd $model |
---|
| 664 | |
---|
| 665 | if $VPP then |
---|
| 666 | set make="gmake RANLIB=ls" |
---|
| 667 | else if $CRAY then |
---|
| 668 | set make="make RANLIB=ls" |
---|
| 669 | else if $NEC then |
---|
| 670 | set make="make RANLIB=ls" |
---|
| 671 | else if $LINUX then |
---|
| 672 | set make="make -k RANLIB=ranlib" |
---|
| 673 | else if $XNEC then |
---|
| 674 | set make="/usr/local/bin/gmake RANLIB=ls" |
---|
| 675 | set make="/usr/freeware/bin/gmake RANLIB=ls" |
---|
| 676 | else |
---|
| 677 | set make="make RANLIB=ranlib" |
---|
| 678 | endif |
---|
| 679 | |
---|
| 680 | |
---|
| 681 | |
---|
| 682 | # |
---|
| 683 | # les deux test suivants sont "temporaires" pour pallier des "faiblesses" du |
---|
| 684 | # compilateur fortran Sun: f90: SC4.0 11 Sep 1995 FORTRAN 90 1.1 |
---|
| 685 | # |
---|
| 686 | #if ($code == 'create_limit' && $SUN) then |
---|
| 687 | # set link=f77 |
---|
| 688 | # set opt_link="-L$NCDFLIB -lnetcdf" |
---|
| 689 | #endif |
---|
| 690 | |
---|
| 691 | #if ($code == 'create_etat0' && $SUN) then |
---|
| 692 | # if ( ! -f $libo/libdyn3d.a ) then |
---|
| 693 | # echo "Priere de compiler gcm en premier pour des raisons d'optimisation" |
---|
| 694 | # \rm $libf/grid/dimensions.h |
---|
| 695 | # exit |
---|
| 696 | # endif |
---|
| 697 | # set optim90=" -dalign -fixed " |
---|
| 698 | # set opt_link="-L$IOIPSLDIR -lioipsl -L$NCDFLIB -lnetcdf" |
---|
| 699 | # set link="$f90 $optim90" |
---|
| 700 | # touch $LMDGCM/libf/dyn3d/startvar.F |
---|
| 701 | # touch $LMDGCM/libf/dyn3d/etat0_netcdf.F |
---|
| 702 | #endif |
---|
| 703 | |
---|
| 704 | # |
---|
| 705 | # Encore un test temporaire: probleme de compilation sur VPP |
---|
| 706 | # l'optimisation de startvar se passe mal |
---|
| 707 | # |
---|
| 708 | #if ($code == 'create_etat0' && $VPP) then |
---|
| 709 | # if ( ! -f $libo/libdyn3d.a ) then |
---|
| 710 | # echo "Priere de compiler gcm en premier pour des raisons d'optimisation" |
---|
| 711 | # \rm $libf/grid/dimensions.h |
---|
| 712 | # exit |
---|
| 713 | # endif |
---|
| 714 | # set optim90="$optim90"" -X9 -w" |
---|
| 715 | # set opt_link="-L$NCDFLIB -lnetcdf" |
---|
| 716 | # touch $LMDGCM/libf/dyn3d/startvar.F |
---|
| 717 | # touch $LMDGCM/libf/dyn3d/etat0_netcdf.F |
---|
| 718 | #endif |
---|
| 719 | |
---|
| 720 | # |
---|
| 721 | # etat0_netcdf a besoin d'info de la physique |
---|
| 722 | # A revoir |
---|
| 723 | set include="$include"" -I$libf/phy$physique" |
---|
| 724 | |
---|
| 725 | |
---|
| 726 | ################################################################# |
---|
| 727 | # Execution de la comande make... ENFIN! |
---|
| 728 | ################################################################# |
---|
| 729 | |
---|
| 730 | if $VPP then |
---|
| 731 | set optim90=" $optim90 -Am -M$libo" |
---|
| 732 | set optimtru90="$optim90" |
---|
| 733 | else if $SUN then |
---|
| 734 | set optim90=" $optim90 -M$libo" |
---|
| 735 | set optimtru90=" $optimtru90 " |
---|
| 736 | else if $NEC then |
---|
| 737 | set optim90=" $optim90 -I$libo " |
---|
| 738 | else if $XNEC then |
---|
| 739 | set optim90=" $optim90 -I$libo " |
---|
| 740 | set optimtru90=" $optimtru90 -I$libo " |
---|
| 741 | else if $LINUX then |
---|
| 742 | # Ehouarn : adapt to g95 |
---|
| 743 | set optim="$optim -fmod=$libo" |
---|
| 744 | set optim90="$optim90 -fmod=$libo" |
---|
| 745 | set optimtru90="$optimtru90 -fmod=$libo" |
---|
| 746 | # Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above) |
---|
| 747 | # set mod_loc_dir=$libo |
---|
| 748 | endif |
---|
| 749 | |
---|
| 750 | set link="$f90 $optim90" |
---|
| 751 | |
---|
| 752 | set ar=ar |
---|
| 753 | |
---|
| 754 | if $XNEC then |
---|
| 755 | set link="sxld $opt_link" |
---|
| 756 | set link="$f90 " |
---|
| 757 | # set ar=sxar |
---|
| 758 | endif |
---|
| 759 | |
---|
| 760 | |
---|
| 761 | cd $localdir |
---|
| 762 | |
---|
| 763 | echo $make -f $LMDGCM/makefile \ |
---|
| 764 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
| 765 | OPTIM="$optim" \ |
---|
| 766 | OPTIM90="$optim90" \ |
---|
| 767 | OPTIMTRU90="$optimtru90" \ |
---|
| 768 | INCLUDE="$include" \ |
---|
| 769 | $filtre \ |
---|
| 770 | LIBO=$libo \ |
---|
| 771 | $dyn \ |
---|
| 772 | $phys \ |
---|
| 773 | DIM=$dimc \ |
---|
| 774 | DYNTYPE="$dyntype" \ |
---|
| 775 | L_ADJNT="$adjnt" \ |
---|
| 776 | LOCAL_DIR="$localdir" \ |
---|
| 777 | F77="$f77" \ |
---|
| 778 | F90="$f90" \ |
---|
| 779 | OPLINK="$oplink" \ |
---|
| 780 | LINK="$link" \ |
---|
| 781 | GCM="$LMDGCM" \ |
---|
| 782 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
| 783 | MOD_SUFFIX=$mod_suffix \ |
---|
| 784 | AR=$ar \ |
---|
| 785 | PROG=$code |
---|
| 786 | |
---|
| 787 | |
---|
| 788 | $make -f $LMDGCM/makefile \ |
---|
| 789 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
| 790 | OPTIM="$optim" \ |
---|
| 791 | OPTIM90="$optim90" \ |
---|
| 792 | OPTIMTRU90="$optimtru90" \ |
---|
| 793 | INCLUDE="$include" \ |
---|
| 794 | $filtre \ |
---|
| 795 | LIBO=$libo \ |
---|
| 796 | $dyn \ |
---|
| 797 | $phys \ |
---|
| 798 | DIM=$dimc \ |
---|
| 799 | DYNTYPE="$dyntype" \ |
---|
| 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 | PROG=$code |
---|
| 811 | |
---|
| 812 | \rm $libf/grid/dimensions.h |
---|