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