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