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