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