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