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