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