[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" |
---|
[1403] | 10 | set include='-I$(LIBF)/grid -I$(LIBF)/misc -I. -I$(LIBF)/dynlonlat_phylonlat' |
---|
[135] | 11 | set ntrac = 1 |
---|
| 12 | set filtre=filtrez |
---|
| 13 | set grille=reg |
---|
| 14 | set dyntype="dyn" |
---|
[253] | 15 | set bands="32x36" |
---|
[671] | 16 | set scatterers="1" |
---|
[1216] | 17 | set full="" |
---|
[1403] | 18 | #src_dirs: directories containing source files |
---|
| 19 | set src_dirs="grid misc" |
---|
| 20 | |
---|
[135] | 21 | ######################################################################## |
---|
| 22 | # path a changer contenant les sources et les objets du modele |
---|
| 23 | ######################################################################## |
---|
| 24 | |
---|
| 25 | #### If you want you can set environment variables here |
---|
[371] | 26 | # default LMDGCM is where the makegcm script is: |
---|
| 27 | #setenv LMDGCM `pwd`"/"`dirname $0` # only works for relative paths |
---|
[373] | 28 | set scriptdir=`dirname $0` |
---|
| 29 | setenv LMDGCM `readlink -f $scriptdir` |
---|
[253] | 30 | #setenv LMDGCM "/san/home/rdword/gcm/LMDZ.GENERIC" |
---|
[371] | 31 | setenv LIBOGCM $LMDGCM/libo |
---|
[1403] | 32 | # NetCDF, on LMD computers: |
---|
[371] | 33 | setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_pgi/lib |
---|
| 34 | setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_pgi/include |
---|
[135] | 35 | #### |
---|
| 36 | |
---|
| 37 | setenv localdir "`pwd`" |
---|
| 38 | set MODIPSL=0 |
---|
| 39 | echo $localdir | grep modipsl >& /dev/null |
---|
| 40 | if ( ! $status ) then |
---|
| 41 | set MODIPSL=1 |
---|
| 42 | setenv LMDGCM $localdir |
---|
| 43 | cd ../.. |
---|
| 44 | setenv LIBOGCM "`pwd`/lib" |
---|
| 45 | cd $localdir |
---|
| 46 | if ( `hostname` == rhodes ) then |
---|
| 47 | set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
---|
| 48 | set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
---|
| 49 | else |
---|
| 50 | if ( `hostname` == nymphea0 ) then |
---|
| 51 | set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
---|
| 52 | set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
---|
| 53 | else |
---|
| 54 | echo 'Probleme de definition des variables NCDFINC et NCDFLIB' |
---|
| 55 | endif |
---|
| 56 | endif |
---|
| 57 | else |
---|
| 58 | if ( ! $?LMDGCM ) then |
---|
| 59 | echo You must initialize the variable LMDGCM in your environnement |
---|
| 60 | echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc |
---|
| 61 | exit |
---|
| 62 | endif |
---|
| 63 | if ( ! $?LIBOGCM ) then |
---|
| 64 | set LIBOGCM=$LMDGCM/libo |
---|
| 65 | endif |
---|
| 66 | if ( ! $?NCDFLIB ) then |
---|
| 67 | echo You must initialize the variable NCDFLIB in your environnement |
---|
| 68 | echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc |
---|
| 69 | exit |
---|
| 70 | endif |
---|
| 71 | if ( ! $?NCDFINC ) then |
---|
| 72 | echo You must initialize the variable NCDFINC in your environnement |
---|
| 73 | echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc |
---|
| 74 | exit |
---|
| 75 | endif |
---|
| 76 | endif |
---|
| 77 | set model=$LMDGCM |
---|
| 78 | set libo=$LIBOGCM |
---|
| 79 | |
---|
| 80 | ######################################################################## |
---|
| 81 | # Les differentes platformes reconnues |
---|
| 82 | ######################################################################## |
---|
| 83 | |
---|
| 84 | set HP=0 |
---|
| 85 | set IBM=0 |
---|
| 86 | set SUN=0 |
---|
| 87 | set VPP=0 |
---|
| 88 | set CRAY=0 |
---|
| 89 | set DEC=0 |
---|
| 90 | set LINUX=0 |
---|
| 91 | set NEC=0 |
---|
| 92 | set XNEC=0 |
---|
| 93 | if ( `uname` == HP-UX ) then |
---|
| 94 | set machine=HP |
---|
| 95 | set HP=1 |
---|
| 96 | else if (`uname` == UNIX_System_V ) then |
---|
| 97 | set machine=VPP |
---|
| 98 | set VPP=1 |
---|
| 99 | else if (`uname` == SunOS ) then |
---|
| 100 | set machine=SUN |
---|
| 101 | set SUN=1 |
---|
| 102 | else if ( `uname` == AIX ) then |
---|
| 103 | set machine=IBM |
---|
| 104 | set IBM=1 |
---|
| 105 | else if ( `uname` == OSF1 ) then |
---|
| 106 | set machine=ALPHA |
---|
| 107 | set DEC=1 |
---|
| 108 | else if ( `uname` == Linux ) then |
---|
| 109 | set machine=LINUX |
---|
| 110 | set LINUX=1 |
---|
| 111 | else if ( `hostname` == atlas || `hostname` == axis || `hostname` == etoile ) then |
---|
| 112 | set machine=CRAY |
---|
| 113 | set CRAY=1 |
---|
| 114 | else if ( `uname` == SUPER-UX ) then |
---|
| 115 | set machine=NEC |
---|
| 116 | set NEC=1 |
---|
| 117 | else if ( `hostname` == rhodes) then |
---|
| 118 | set machine=XNEC |
---|
| 119 | set XNEC=1 |
---|
[1403] | 120 | else if ( `uname` == CYGWIN_NT-6.1-WOW64) then |
---|
| 121 | set machine=LINUX |
---|
| 122 | set LINUX=1 |
---|
[135] | 123 | else |
---|
| 124 | echo Vous travaillez sur une machine non prevue par le reglement |
---|
| 125 | exit |
---|
| 126 | endif |
---|
| 127 | |
---|
| 128 | # create $libo directory if it doesn't exist |
---|
| 129 | if ( ! -d $libo ) then |
---|
| 130 | mkdir $libo |
---|
| 131 | endif |
---|
| 132 | |
---|
| 133 | if $VPP then |
---|
| 134 | set netcdf=netcdf_v |
---|
| 135 | else |
---|
| 136 | set netcdf=netcdf |
---|
| 137 | endif |
---|
| 138 | ######################################################################## |
---|
| 139 | # Quelques initialisations de variables du shell. |
---|
| 140 | ######################################################################## |
---|
| 141 | |
---|
| 142 | set dyn= |
---|
| 143 | set opt_link="" |
---|
| 144 | set adjnt="" |
---|
| 145 | set opt_dep="" |
---|
| 146 | |
---|
| 147 | set optim90="" |
---|
| 148 | set oplink="" |
---|
| 149 | |
---|
| 150 | ######################################################################## |
---|
| 151 | # Optimisations par defaut suivant les machines |
---|
| 152 | ######################################################################## |
---|
| 153 | |
---|
| 154 | echo "Optimisations par defaut suivant les machines" |
---|
| 155 | set libf=$model/libf |
---|
| 156 | #setenv localdir "LOCAL_DIR=`pwd`" |
---|
| 157 | #setenv localdir "`pwd`" |
---|
| 158 | cd $model |
---|
| 159 | if $CRAY then |
---|
| 160 | set optim90="-Wp'-P' -DCRAY "'-p$(LIBO) -eiv ' |
---|
| 161 | set oplink="-Wl'-DSTACK=128 -f indef' -L$NCDFLIB -lnetcdf " |
---|
| 162 | set mod_loc_dir=" " |
---|
| 163 | set mod_suffix=" " |
---|
| 164 | else if $SUN then |
---|
| 165 | set optim90=" -fast" |
---|
| 166 | set optimtru90=" -fast -free" |
---|
| 167 | set opt_link="-L$NCDFLIB -lnetcdf" |
---|
| 168 | set mod_loc_dir=$localdir |
---|
| 169 | set mod_suffix=mod |
---|
| 170 | else if $HP then |
---|
| 171 | else if $IBM then |
---|
| 172 | else if $VPP then |
---|
| 173 | set optim90="$optim -X9 -w" |
---|
| 174 | if $COUPLE then |
---|
| 175 | 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" |
---|
| 176 | set oplink="-Wl,-t,-P,-dy " |
---|
| 177 | else |
---|
| 178 | set opt_link="-Wg,-c /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl" |
---|
| 179 | set oplink="-Wl,-t,-dy " |
---|
| 180 | endif |
---|
| 181 | set mod_loc_dir=$IOIPSLDIR |
---|
| 182 | set mod_suffix=mod |
---|
| 183 | else if $DEC then |
---|
| 184 | else if $LINUX then |
---|
[253] | 185 | set optim=" -O2 -Munroll -Mcache_align " |
---|
| 186 | set optim90=" -O2 -Munroll -Mcache_align " |
---|
| 187 | set optimtru90=" -O2 -Munroll -Mcache_align " |
---|
| 188 | set opt_link=" -L$NCDFLIB -lnetcdf" |
---|
[135] | 189 | set mod_loc_dir=$localdir |
---|
| 190 | set mod_suffix=mod |
---|
[253] | 191 | # Ehouarn 'ifort' compiler |
---|
| 192 | # #NB: on gnome -O3 ==> NaNs ... |
---|
| 193 | # set optim=" -O2 -ip -mkl=sequential -align common " |
---|
| 194 | # set optim90=" -O2 -ip -mkl=sequential -align common " |
---|
| 195 | # set optimtru90=" -O2 -ip -mkl=sequential -align common " |
---|
| 196 | # set mod_loc_dir=$LIBOGCM |
---|
| 197 | # set mod_suffix=mod |
---|
[135] | 198 | else if $NEC then |
---|
| 199 | set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
| 200 | set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
| 201 | ### set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lioipsl -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v " |
---|
| 202 | set opt_link=" -C hopt -float0 -ew -P static -L/SX/usr/local/lib -lnetcdf_i8r8 " |
---|
| 203 | set mod_loc_dir="." |
---|
| 204 | set mod_suffix="mod" |
---|
| 205 | else if $XNEC then |
---|
| 206 | set optim90=' -clear -R5 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
| 207 | set optimtru90=' -clear -R5 -f4 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
| 208 | if $MODIPSL then |
---|
| 209 | if $COUPLE then |
---|
| 210 | set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
| 211 | else |
---|
| 212 | set opt_link="-L$IOIPSLDIR -lsxioipsl -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
| 213 | endif |
---|
| 214 | set mod_loc_dir="./" |
---|
| 215 | else |
---|
| 216 | set opt_link=" -C hopt -float0 -ew -P static -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8" |
---|
| 217 | set mod_loc_dir="." |
---|
| 218 | endif |
---|
| 219 | set mod_suffix="mod" |
---|
| 220 | |
---|
| 221 | endif |
---|
| 222 | |
---|
[1403] | 223 | set nomlib=${machine} |
---|
[135] | 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 |
---|
| 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 | |
---|
[253] | 331 | case -d |
---|
[135] | 332 | set dim=$2 ; shift ; shift ; goto top |
---|
| 333 | |
---|
| 334 | case -O: |
---|
[253] | 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 | |
---|
[253] | 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 |
---|
[253] | 380 | set optim="-g -Mbounds -Kieee -Ktrap=fp -traceback" |
---|
| 381 | set optim90="-g -Mbounds -Kieee -Ktrap=fp -traceback" |
---|
| 382 | set optimtru90="-g -Mbounds -Kieee -Ktrap=fp -traceback" |
---|
| 383 | # set optim=" -g -no-ftz -traceback -ftrapuv -fp-stack-check " |
---|
| 384 | # set optim90=" -g -no-ftz -traceback -ftrapuv -fp-stack-check " |
---|
| 385 | # set optimtru90=" -g -no-ftz -traceback -ftrapuv -fp-stack-check " |
---|
[135] | 386 | else |
---|
| 387 | echo "pas d option debug predefinie pour cette machine" |
---|
| 388 | exit |
---|
| 389 | endif |
---|
| 390 | shift ; goto top |
---|
| 391 | |
---|
| 392 | default |
---|
| 393 | set code="$1" ; shift ; goto top |
---|
| 394 | |
---|
| 395 | endsw |
---|
| 396 | endif |
---|
| 397 | |
---|
[253] | 398 | |
---|
[135] | 399 | echo "apres les opts dim $dim" |
---|
| 400 | |
---|
| 401 | ######################################################################## |
---|
| 402 | # cas special sans physique |
---|
| 403 | ######################################################################## |
---|
| 404 | if ( "$physique" == 'nophys' ) then |
---|
| 405 | set phys="L_PHY= LIBPHY=" |
---|
[1403] | 406 | else |
---|
| 407 | set src_dirs="$src_dirs phy$physique" |
---|
| 408 | set include="$include "' -I$(LIBF)/phy'"$physique" |
---|
[135] | 409 | endif |
---|
[1403] | 410 | set libdyn_phy="" |
---|
| 411 | set LIBDYN_PHYS="" |
---|
[135] | 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 |
---|
[1403] | 489 | endif |
---|
| 490 | if ( "$dimc" == "3" ) then |
---|
[135] | 491 | if ( "$dyntype" == "olddyn" ) then |
---|
| 492 | set include="$include "'-I$(LIBF)/olddyn3d ' |
---|
[1403] | 493 | set src_dirs="$src_dirs olddyn3d dynlonlat_phylonlat dynlonlat_phylonlat/phy$physique" |
---|
[135] | 494 | else |
---|
| 495 | set include="$include "'-I$(LIBF)/dyn3d ' |
---|
[1403] | 496 | set src_dirs="$src_dirs dyn3d dynlonlat_phylonlat dynlonlat_phylonlat/phy$physique" |
---|
[135] | 497 | endif |
---|
[1403] | 498 | set libdyn_phy="-ldynlonlat_phylonlat" |
---|
| 499 | set LIBDYN_PHYS='$(LIBO)/libdynlonlat_phylonlat.a' |
---|
[135] | 500 | set dimh=`echo $dim | awk ' { print $1 "." $2 } '` |
---|
| 501 | endif |
---|
| 502 | echo "dimc is $dimc" |
---|
| 503 | |
---|
| 504 | ######################################################################## |
---|
| 505 | # path pour les #include |
---|
| 506 | ######################################################################## |
---|
| 507 | |
---|
| 508 | set include="$include -I$NCDFINC " |
---|
| 509 | echo $include |
---|
| 510 | |
---|
| 511 | ######################################################################## |
---|
| 512 | # Gestion des dimensions du modele. |
---|
| 513 | # on cree ou remplace le fichier des dimensions/nombre de traceur |
---|
| 514 | ######################################################################## |
---|
| 515 | |
---|
| 516 | cd $libf/grid |
---|
| 517 | if ( -f dimensions.h ) then |
---|
[253] | 518 | echo "WARNING: you are already compiling the model somewhere else" |
---|
| 519 | echo "Wait until the first compilation is finished before starting." |
---|
| 520 | echo "If you are sure that you are not compiling elsewhere, you can" |
---|
| 521 | echo "type [yes] to continue." |
---|
| 522 | echo "Do you want to continue?" |
---|
| 523 | if ( $< == "yes" ) then |
---|
[671] | 524 | #remove old dimensions.h , bands.h and scatterers.h files |
---|
| 525 | \rm -f $libf/grid/dimensions.h |
---|
| 526 | \rm -f $libf/grid/bands.h |
---|
[955] | 527 | \rm -f $libf/phy${physique}/bands.h |
---|
[671] | 528 | \rm -f $libf/phy${physique}/scatterers.h |
---|
[135] | 529 | else |
---|
| 530 | exit |
---|
| 531 | endif |
---|
| 532 | endif |
---|
| 533 | |
---|
| 534 | # Build the appropriate 'dimensions.h' file |
---|
| 535 | cd dimension |
---|
[1216] | 536 | ./makdim $dim |
---|
[135] | 537 | # echo contents of dimensions.h to standard output |
---|
| 538 | cat $libf/grid/dimensions.h |
---|
| 539 | |
---|
[253] | 540 | # Build the appropriate 'bands.h' file |
---|
[955] | 541 | cd $libf/phy$physique/bands |
---|
| 542 | ./makbands $bands |
---|
[253] | 543 | # echo contents of bands.h to standard output |
---|
[955] | 544 | cat $libf/phy$physique/bands.h |
---|
[253] | 545 | |
---|
[671] | 546 | # Build the appropriate 'scatterers.h' file |
---|
| 547 | cd $libf/phy$physique/scatterers |
---|
| 548 | ./make_scatterers $scatterers |
---|
| 549 | # echo contents of scatterers.h to standard output |
---|
| 550 | cat $libf/phy$physique/scatterers.h |
---|
| 551 | |
---|
[135] | 552 | cd $LMDGCM |
---|
| 553 | # set path to objects directory |
---|
| 554 | set libo=$libo/$nomlib |
---|
| 555 | # create objects directory, if it doesn't exist |
---|
| 556 | if ( ! -d $libo ) then |
---|
| 557 | mkdir $libo |
---|
| 558 | cd $model |
---|
| 559 | endif |
---|
| 560 | |
---|
| 561 | ######################################################################## |
---|
| 562 | # Differentes dynamiques (3d, 2d, 1d) |
---|
| 563 | ######################################################################## |
---|
| 564 | |
---|
| 565 | set dimension=`echo $dim | wc -w` |
---|
| 566 | echo dimension $dimension dim $dim |
---|
| 567 | if ( $dimension == 1 ) then |
---|
[1216] | 568 | echo "No dynamics" |
---|
| 569 | ## set dyn="L_DYN= DYN= L_FILTRE= " |
---|
| 570 | ## NB: we still need to have L_DYN=libdyn3d to reach routines and module |
---|
| 571 | ## objects which are located in dyn3d |
---|
[1403] | 572 | set dyntype="" |
---|
| 573 | set filtre="L_DYN= DYN= FILTRE= L_FILTRE= " |
---|
| 574 | set dyn="L_DYN= DYN= L_FILTRE= " |
---|
| 575 | set dirmain="phy$physique/dyn1d" |
---|
| 576 | set src_dirs="$src_dirs phy$physique/dyn1d " |
---|
| 577 | set include="$include "' -I$(LIBF)/phy'"$physique"'/dyn1d' |
---|
[135] | 578 | endif |
---|
| 579 | endif |
---|
| 580 | |
---|
| 581 | cd $model |
---|
| 582 | if ( $dimension == 3 ) then |
---|
| 583 | cd libf/grid |
---|
| 584 | \rm fxyprim.h |
---|
| 585 | cp -p fxy_${grille}.h fxyprim.h |
---|
| 586 | endif |
---|
| 587 | |
---|
| 588 | ###################################################################### |
---|
| 589 | # Gestion du filtre qui n'existe qu'en 3d. |
---|
| 590 | ###################################################################### |
---|
| 591 | |
---|
| 592 | # set filtre to 'oldfiltrez' if using -olddyn option |
---|
| 593 | if ( "$dyntype" == "olddyn" ) then |
---|
| 594 | set filtre="oldfiltrez" |
---|
| 595 | endif |
---|
| 596 | |
---|
| 597 | if ( `expr $dimc \> 2` == 1 ) then |
---|
| 598 | set filtre="FILTRE=$filtre" |
---|
[1403] | 599 | if ( "$dyntype" == "olddyn" ) then |
---|
| 600 | set src_dirs="$src_dirs oldfiltrez" |
---|
| 601 | else |
---|
| 602 | set src_dirs="$src_dirs filtrez" |
---|
| 603 | endif |
---|
[135] | 604 | else |
---|
[1403] | 605 | set filtre="FILTRE= L_FILTRE= L_DYN= " |
---|
[135] | 606 | endif |
---|
| 607 | echo "MACRO FILTRE $filtre" |
---|
| 608 | |
---|
| 609 | echo "dimc $dimc" |
---|
| 610 | |
---|
[1216] | 611 | #cleanup for a full recompilation, if requested |
---|
| 612 | if ("$full" == "full") then |
---|
| 613 | # remove makefile and $libo |
---|
| 614 | cd $model |
---|
| 615 | \rm -f makefile |
---|
| 616 | \rm -rf $libo/* |
---|
| 617 | endif |
---|
| 618 | |
---|
[135] | 619 | ######################################################################## |
---|
| 620 | # Avant de lancer le make, on recree le makefile si necessaire |
---|
| 621 | ######################################################################## |
---|
| 622 | # c'est a dire dans 3 cas: |
---|
| 623 | # 1. si la liste des fichiers .F et .h a ete modifiee depuis la |
---|
| 624 | # derniere creation du makefile |
---|
| 625 | # 2. si le fichier contenant cette liste "liste_des_sources" |
---|
| 626 | # n'existe pas. |
---|
| 627 | # 3. Si le makefile n'existe pas. |
---|
| 628 | ######################################################################## |
---|
| 629 | |
---|
| 630 | cd $model |
---|
[646] | 631 | find libf -name '*.[Fh]' -print | sort >! tmp77 |
---|
[135] | 632 | #find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90 |
---|
[646] | 633 | find libf -name '*.[Fh]90' -print | sort >> tmp90 |
---|
[135] | 634 | |
---|
| 635 | if ( `diff tmp77 liste_des_sources_f77 | wc -w` \ |
---|
| 636 | || `diff tmp90 liste_des_sources_f90 | wc -w` \ |
---|
| 637 | || ! -f makefile \ |
---|
| 638 | || ! -f liste_des_sources_f90 \ |
---|
| 639 | || ! -f liste_des_sources_f77 ) then |
---|
| 640 | echo "les fichiers suivants ont ete crees ou detruits" |
---|
| 641 | echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90" |
---|
| 642 | diff liste_des_sources_f77 tmp77 |
---|
| 643 | diff liste_des_sources_f90 tmp90 |
---|
| 644 | \cp tmp77 liste_des_sources_f77 |
---|
| 645 | \cp tmp90 liste_des_sources_f90 |
---|
[253] | 646 | echo "Remaking the makefile!" |
---|
[1403] | 647 | echo "src_dirs: $src_dirs" |
---|
| 648 | create_make_gcm $src_dirs >! tmp |
---|
[135] | 649 | \mv tmp makefile |
---|
[253] | 650 | echo "New makefile created." |
---|
[135] | 651 | endif |
---|
| 652 | |
---|
| 653 | ######################################################################## |
---|
| 654 | # Execution de la comande make |
---|
| 655 | ######################################################################## |
---|
| 656 | |
---|
[253] | 657 | |
---|
[135] | 658 | echo PHYSIQUE $phys |
---|
| 659 | echo dynamique $dyn $dimension |
---|
| 660 | echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code |
---|
| 661 | echo PATH pour les fichiers INCLUDE $include |
---|
| 662 | echo OPLINK="$oplink" |
---|
| 663 | |
---|
| 664 | if $HP then |
---|
| 665 | set f77='fort77 +OP' |
---|
| 666 | set f90='jensaisrien' |
---|
| 667 | set opt_link="$opt_link -lm" |
---|
| 668 | else if $VPP then |
---|
| 669 | set f77=frt |
---|
| 670 | set f90=$f77 |
---|
| 671 | else if $CRAY then |
---|
| 672 | set f77=f90 |
---|
| 673 | set f90=f90 |
---|
| 674 | else if $LINUX then |
---|
[253] | 675 | # set f77=ifort |
---|
| 676 | # set f90=ifort |
---|
| 677 | # set opt_link=" -L$LIBOGCM -L$NCDFLIB -lnetcdf " |
---|
[135] | 678 | set f77=pgf90 |
---|
| 679 | set f90=pgf90 |
---|
| 680 | else if $SUN then |
---|
| 681 | set f77=f90 |
---|
| 682 | set f90=f90 |
---|
| 683 | else if $NEC then |
---|
| 684 | set f77=f90 |
---|
| 685 | set f90=f90 |
---|
| 686 | else if $XNEC then |
---|
| 687 | set f77=sxmpif90 |
---|
| 688 | set f90=sxmpif90 |
---|
| 689 | else |
---|
| 690 | set f77=f77 |
---|
| 691 | set f90=f90 |
---|
| 692 | endif |
---|
| 693 | |
---|
| 694 | cd $model |
---|
| 695 | |
---|
| 696 | if $VPP then |
---|
| 697 | set make="gmake RANLIB=ls" |
---|
| 698 | else if $CRAY then |
---|
| 699 | set make="make RANLIB=ls" |
---|
| 700 | else if $NEC then |
---|
| 701 | set make="make RANLIB=ls" |
---|
| 702 | else if $LINUX then |
---|
| 703 | set make="make -k RANLIB=ranlib" |
---|
| 704 | else if $XNEC then |
---|
| 705 | set make="/usr/local/bin/gmake RANLIB=ls" |
---|
| 706 | set make="/usr/freeware/bin/gmake RANLIB=ls" |
---|
| 707 | else |
---|
| 708 | set make="make RANLIB=ranlib" |
---|
| 709 | endif |
---|
| 710 | |
---|
| 711 | # |
---|
| 712 | # etat0_netcdf a besoin d'info de la physique |
---|
| 713 | # A revoir |
---|
| 714 | set include="$include"" -I$libf/phy$physique" |
---|
| 715 | |
---|
| 716 | |
---|
| 717 | ################################################################# |
---|
| 718 | # Execution de la comande make... ENFIN! |
---|
| 719 | ################################################################# |
---|
| 720 | |
---|
| 721 | if $VPP then |
---|
| 722 | set optim90=" $optim90 -Am -M$libo" |
---|
| 723 | set optimtru90="$optim90" |
---|
| 724 | else if $SUN then |
---|
| 725 | set optim90=" $optim90 -M$libo" |
---|
| 726 | set optimtru90=" $optimtru90 " |
---|
| 727 | else if $NEC then |
---|
| 728 | set optim90=" $optim90 -I$libo " |
---|
| 729 | else if $XNEC then |
---|
| 730 | set optim90=" $optim90 -I$libo " |
---|
| 731 | set optimtru90=" $optimtru90 -I$libo " |
---|
| 732 | else if $LINUX then |
---|
[253] | 733 | # set optim="$optim -I${libo}" |
---|
| 734 | # set optim90="$optim90 -I${libo}" |
---|
| 735 | # set optimtru90="$optimtru90 -ffree-form -I${libo}" |
---|
| 736 | set optim="$optim -module $libo" |
---|
[135] | 737 | set optim90="$optim90 -module $libo" |
---|
| 738 | set optimtru90="$optimtru90 -module $libo" |
---|
| 739 | # Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above) |
---|
| 740 | # set mod_loc_dir=$libo |
---|
| 741 | endif |
---|
| 742 | |
---|
| 743 | set link="$f90 $optim90" |
---|
| 744 | |
---|
| 745 | set ar=ar |
---|
| 746 | |
---|
| 747 | if $XNEC then |
---|
| 748 | set link="sxld $opt_link" |
---|
| 749 | set link="$f90 " |
---|
| 750 | # set ar=sxar |
---|
| 751 | endif |
---|
| 752 | |
---|
| 753 | cd $localdir |
---|
| 754 | |
---|
[371] | 755 | set source_code=${code}.F |
---|
[988] | 756 | # handle cases when the main program is in the physics directory |
---|
[1403] | 757 | set dirmain=dyn${dimc}d |
---|
| 758 | if ( -f $LMDGCM/libf/dyn3d/${code}.F90 ) then |
---|
| 759 | set source_code=${code}.F90 |
---|
[988] | 760 | endif |
---|
[1403] | 761 | if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F ) then |
---|
| 762 | set dirmain=phy${physique}/dyn1d |
---|
| 763 | set source_code=${code}.F |
---|
| 764 | endif |
---|
| 765 | if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F90 ) then |
---|
| 766 | set dirmain=phy${physique}/dyn1d |
---|
[371] | 767 | set source_code=${code}.F90 |
---|
| 768 | endif |
---|
[1403] | 769 | if ( -f $LMDGCM/libf/dynlonlat_phylonlat/phy${physique}/${code}.F ) then |
---|
| 770 | set dirmain=dynlonlat_phylonlat/phy${physique} |
---|
| 771 | set source_code=${code}.F |
---|
| 772 | endif |
---|
| 773 | if ( -f $LMDGCM/libf/dynlonlat_phylonlat/phy${physique}/${code}.F90 ) then |
---|
| 774 | set dirmain=dynlonlat_phylonlat/phy${physique} |
---|
| 775 | set source_code=${code}.F90 |
---|
| 776 | endif |
---|
[253] | 777 | |
---|
[135] | 778 | echo $make -f $LMDGCM/makefile \ |
---|
| 779 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
[253] | 780 | OPTIM="$optim" \ |
---|
[135] | 781 | OPTIM90="$optim90" \ |
---|
| 782 | OPTIMTRU90="$optimtru90" \ |
---|
| 783 | INCLUDE="$include" \ |
---|
| 784 | $filtre \ |
---|
| 785 | LIBO=$libo \ |
---|
| 786 | $phys \ |
---|
[1403] | 787 | LIBDYN_PHYS=${LIBDYN_PHYS} \ |
---|
[135] | 788 | DIM=$dimc \ |
---|
| 789 | DYNTYPE="$dyntype" \ |
---|
[1403] | 790 | L_DYN_PHY="$libdyn_phy" \ |
---|
[135] | 791 | L_ADJNT="$adjnt" \ |
---|
| 792 | LOCAL_DIR="$localdir" \ |
---|
| 793 | F77="$f77" \ |
---|
| 794 | F90="$f90" \ |
---|
| 795 | OPLINK="$oplink" \ |
---|
| 796 | LINK="$link" \ |
---|
| 797 | GCM="$LMDGCM" \ |
---|
| 798 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
| 799 | MOD_SUFFIX=$mod_suffix \ |
---|
| 800 | AR=$ar \ |
---|
[1403] | 801 | DIRMAIN=$dirmain \ |
---|
[371] | 802 | SOURCE=$source_code \ |
---|
[135] | 803 | PROG=$code |
---|
| 804 | |
---|
| 805 | |
---|
| 806 | $make -f $LMDGCM/makefile \ |
---|
| 807 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
[253] | 808 | OPTIM="$optim" \ |
---|
[135] | 809 | OPTIM90="$optim90" \ |
---|
| 810 | OPTIMTRU90="$optimtru90" \ |
---|
| 811 | INCLUDE="$include" \ |
---|
| 812 | $filtre \ |
---|
| 813 | LIBO=$libo \ |
---|
| 814 | $phys \ |
---|
[1403] | 815 | LIBDYN_PHYS=${LIBDYN_PHYS} \ |
---|
[135] | 816 | DIM=$dimc \ |
---|
| 817 | DYNTYPE="$dyntype" \ |
---|
[1403] | 818 | L_DYN_PHY="$libdyn_phy" \ |
---|
[135] | 819 | L_ADJNT="$adjnt" \ |
---|
| 820 | LOCAL_DIR="$localdir" \ |
---|
| 821 | F77="$f77" \ |
---|
| 822 | F90="$f90" \ |
---|
| 823 | OPLINK="$oplink" \ |
---|
| 824 | LINK="$link" \ |
---|
| 825 | GCM="$LMDGCM" \ |
---|
| 826 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
| 827 | MOD_SUFFIX=$mod_suffix \ |
---|
| 828 | AR=$ar \ |
---|
[1403] | 829 | DIRMAIN=$dirmain \ |
---|
[371] | 830 | SOURCE=$source_code \ |
---|
[135] | 831 | PROG=$code |
---|
| 832 | |
---|
[671] | 833 | \rm -f $libf/grid/dimensions.h |
---|
| 834 | \rm -f $libf/grid/bands.h |
---|
[955] | 835 | \rm -f $libf/phy$physique/bands.h |
---|
[671] | 836 | \rm -f $libf/phy$physique/scatterers.h |
---|