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