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