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