| 1 | #!/bin/bash |
|---|
| 2 | |
|---|
| 3 | ########################################################################### |
|---|
| 4 | # Auteur : Frédéric Hourdin/LMD/hourdin@lmd.jussieu.fr |
|---|
| 5 | # Usage : install.sh |
|---|
| 6 | # |
|---|
| 7 | # Script bash d'installation du modele LMDZ sur un ordinateur PC/Linux |
|---|
| 8 | # en utilisant le compilateur g95. |
|---|
| 9 | # Le modele est récupéré dans une arborescence |
|---|
| 10 | # $MODEL/modipsl/modeles/... |
|---|
| 11 | # en utilisant l'infrastructure "modipsl" mise au point à l'"IPSL" pour |
|---|
| 12 | #les besoins de la modélisation couplée du climat |
|---|
| 13 | #(atmosphere/ocean/vegetation/chimie) |
|---|
| 14 | # On ne récupère ici que les composantes atmosphériques (LMDZ4) |
|---|
| 15 | # et végétation (ORCHIDEE). |
|---|
| 16 | # |
|---|
| 17 | # Sous le répertoire "modeles", on trouve en fait les sources de différents |
|---|
| 18 | # modèles. Ici, LMDZ4, ORCHIDEEet IOIPSL, ensemble de programmes |
|---|
| 19 | # d'entrée/sortie faisant appel à la librairie netcdf. |
|---|
| 20 | # |
|---|
| 21 | # Le script récupères les différents jeux de sources (y compris une |
|---|
| 22 | # version de netcdf) et utilitaires, compile le modèle, et lance une |
|---|
| 23 | # simulation de test dans une configuration très légère sur |
|---|
| 24 | # $MODEL/modipsl/modeles/LMDZ4/INI |
|---|
| 25 | # |
|---|
| 26 | # Pré-requis : g95/pgf90/gfortran, ksh, wget , gunzip, tar, ... (à compléter) |
|---|
| 27 | # |
|---|
| 28 | # Modif 18/11/2011 |
|---|
| 29 | # changement pour l'option real 8. |
|---|
| 30 | # On compile avec -r8 (ou équivalent) et -DNC_DOUBLE pour le GCM |
|---|
| 31 | # mais avec -r4 netcdf. La variable real est initialisée à |
|---|
| 32 | # r4 ou r8 en début de script. |
|---|
| 33 | # |
|---|
| 34 | ########################################################################### |
|---|
| 35 | |
|---|
| 36 | echo '################################################################' |
|---|
| 37 | echo Choix des options d installation |
|---|
| 38 | echo '################################################################' |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | real=r4 |
|---|
| 42 | real=r8 |
|---|
| 43 | |
|---|
| 44 | # ATTENTION !!!! Pour des versions anterieures a octobre 2009, utiliser |
|---|
| 45 | # install.v2.sh au lieu de install.sh |
|---|
| 46 | |
|---|
| 47 | version=20110921.trunk |
|---|
| 48 | #Chemin pour placer le modele |
|---|
| 49 | MODEL=./LMDZ$version |
|---|
| 50 | |
|---|
| 51 | getlmdzor=1 |
|---|
| 52 | netcdf=1 # 1 for automatic installation |
|---|
| 53 | # 0 for no installation |
|---|
| 54 | # /.../../netcdf-4.0.1 if wanting to link with an already |
|---|
| 55 | # compiled netcdf library (implies to check option compatibility) |
|---|
| 56 | check_linux=1 |
|---|
| 57 | ioipsl=1 |
|---|
| 58 | veget=0 |
|---|
| 59 | bench=1 |
|---|
| 60 | ## compilo=pgf90 ou g95 ou gfortran sur PC linux |
|---|
| 61 | compilo=gfortran |
|---|
| 62 | pclinux=1 |
|---|
| 63 | |
|---|
| 64 | ## compile_with_fcm=1 : utilise makelmdz_fcm, possible a partir de la version 20111103.trunk (LMDZ5/trunk rev 1578) |
|---|
| 65 | ## compile_with_fcm=0 : utilise makegcm (default) |
|---|
| 66 | compile_with_fcm=0 |
|---|
| 67 | |
|---|
| 68 | OPTPREC="" |
|---|
| 69 | echo '################################################################' |
|---|
| 70 | echo Choix des options de compilation |
|---|
| 71 | echo '################################################################' |
|---|
| 72 | |
|---|
| 73 | if [ $compilo = g95 ] ; then |
|---|
| 74 | if [ $real = r8 ] ; then OPTPREC="-r8 -DNC_DOUBLE" ; fi |
|---|
| 75 | OPTIM='-i4 -O3' |
|---|
| 76 | elif [ $compilo = gfortran ] ; then |
|---|
| 77 | if [ $real = r8 ] ; then OPTPREC="-fdefault-real-8 -DNC_DOUBLE" ; fi |
|---|
| 78 | OPTIM='-O3' |
|---|
| 79 | else #pgf90 |
|---|
| 80 | if [ $real = r8 ] ; then echo "Option real 8 non disponible pour pgf90" ; exit ; fi |
|---|
| 81 | OPTIM='-O2 -Munroll -Mnoframe -Mautoinline -Mcache_align' |
|---|
| 82 | fi |
|---|
| 83 | OPTIMGCM="$OPTIM $OPTPREC" |
|---|
| 84 | |
|---|
| 85 | # choix de la resolution pour le bench |
|---|
| 86 | # grid_resolution= 32x24x11 for test (test without ORCHIDEE) |
|---|
| 87 | # 96x71x19 standard configuration |
|---|
| 88 | grid_resolution=48x36x19 |
|---|
| 89 | |
|---|
| 90 | hostname=`hostname` |
|---|
| 91 | |
|---|
| 92 | ########################################################################## |
|---|
| 93 | # Dans le cas où on installe sur des machines connues comme la NEC |
|---|
| 94 | # brodie |
|---|
| 95 | # de l'IDRIS, on ne verifie pas les logiciels existants et on n'installe |
|---|
| 96 | # pas netcdf. |
|---|
| 97 | if [ $hostname = brodie ] ; then |
|---|
| 98 | netcdf=0 |
|---|
| 99 | check_linux=0 |
|---|
| 100 | pclinux=0 |
|---|
| 101 | fi |
|---|
| 102 | ########################################################################## |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | mkdir -p $MODEL |
|---|
| 106 | echo $MODEL |
|---|
| 107 | MODEL=`( cd $MODEL ; pwd )` # transformation en chemin absolu si necessaire |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | # Le -fendian=big n'est à utiliser vraiment utile que pour ARPEGE1D. |
|---|
| 112 | # Le -r8 doit sans doute être éviter si on veut tourner rapidement sur |
|---|
| 113 | # des machines 32 bits. |
|---|
| 114 | # L'option r8 n'est pas forcement indispensable et elle produit |
|---|
| 115 | # des executables plus gros. |
|---|
| 116 | # Elles est indispensable cependant pour ARPEGE1D |
|---|
| 117 | # On doit pouvoir aussi utiliser des optimisations plus fortes (-O3 par |
|---|
| 118 | # exemple). |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | echo '################################################################' |
|---|
| 122 | if [ "$check_linux" = 1 ] ; then |
|---|
| 123 | echo Test sur les logiciels requis |
|---|
| 124 | echo '################################################################' |
|---|
| 125 | |
|---|
| 126 | #### Ehouarn: test if ksh and/or bash are available |
|---|
| 127 | use_shell="ksh" # default: use ksh |
|---|
| 128 | if [ "`which ksh`" = "" ] ; then |
|---|
| 129 | echo "pas de ksh ... on va utiliser bash" |
|---|
| 130 | use_shell="bash" |
|---|
| 131 | if [ "`which bash`" = "" ] ; then |
|---|
| 132 | echo "Il faut d\'abord installer ksh (ou bash)" |
|---|
| 133 | fi |
|---|
| 134 | fi |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | for logiciel in csh wget tar gzip make $compilo gcc ; do |
|---|
| 138 | if [ "`which $logiciel`" = "" ] ; then |
|---|
| 139 | echo Il faut installer d\'abord $logiciel |
|---|
| 140 | exit |
|---|
| 141 | fi |
|---|
| 142 | done |
|---|
| 143 | |
|---|
| 144 | if [ $pclinux = 1 ] ; then |
|---|
| 145 | cd $MODEL |
|---|
| 146 | cat <<eod> tt.f90 |
|---|
| 147 | print*,'coucou' |
|---|
| 148 | end |
|---|
| 149 | eod |
|---|
| 150 | $compilo tt.f90 |
|---|
| 151 | ./a.out >| tt |
|---|
| 152 | if [ "`cat tt | sed -e 's/ //g' `" != "coucou" ] ; then |
|---|
| 153 | echo probleme avec installation de $compilo ; exit ; fi |
|---|
| 154 | \rm tt a.out tt.f90 |
|---|
| 155 | fi |
|---|
| 156 | fi |
|---|
| 157 | |
|---|
| 158 | ########################################################################### |
|---|
| 159 | |
|---|
| 160 | |
|---|
| 161 | |
|---|
| 162 | if [ $getlmdzor = 1 ] ; then |
|---|
| 163 | echo '##########################################################' |
|---|
| 164 | echo On recupere une version un peu modifiee de LMDZ |
|---|
| 165 | echo '##########################################################' |
|---|
| 166 | cd $MODEL |
|---|
| 167 | wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/modipsl.$version.tar.gz |
|---|
| 168 | gunzip modipsl.$version.tar.gz |
|---|
| 169 | tar xvf modipsl.$version.tar |
|---|
| 170 | \rm modipsl.$version.tar |
|---|
| 171 | |
|---|
| 172 | # On recupere en fait une version du 01 10 2006 obtenue |
|---|
| 173 | # Par un cvs get |
|---|
| 174 | # Puis modifiees pour etre compatible avec la compilation $compilo. |
|---|
| 175 | # et pour betoner ORCHIDEE |
|---|
| 176 | # Cette version est recuperable avec le script |
|---|
| 177 | # wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/getlmdzor.x |
|---|
| 178 | fi |
|---|
| 179 | |
|---|
| 180 | echo OK1 |
|---|
| 181 | |
|---|
| 182 | if [ $netcdf = 1 ] ; then |
|---|
| 183 | echo '##########################################################' |
|---|
| 184 | echo Compilation de netcdf |
|---|
| 185 | echo '##########################################################' |
|---|
| 186 | cd $MODEL |
|---|
| 187 | wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/netcdf-4.0.1.tar.gz |
|---|
| 188 | gunzip netcdf-4.0.1.tar.gz |
|---|
| 189 | tar xvf netcdf-4.0.1.tar |
|---|
| 190 | \rm -f netcdf-4.0.1.tar |
|---|
| 191 | |
|---|
| 192 | cd netcdf-4.0.1 |
|---|
| 193 | |
|---|
| 194 | OPTIMNC=$OPTIM |
|---|
| 195 | if [ $compilo = g95 ] ; then |
|---|
| 196 | # On modifie les options de compilation |
|---|
| 197 | export FC=g95 |
|---|
| 198 | export F90=g95 |
|---|
| 199 | export F90FLAGS=" -cpp -ffree-form $OPTIMNC" |
|---|
| 200 | export FFLAGS=" -cpp $OPTIMNC" |
|---|
| 201 | export CPPFLAGS=-Df2cFortran |
|---|
| 202 | export CC=gcc |
|---|
| 203 | export CXX=g++ |
|---|
| 204 | elif [ $compilo = gfortran ] ; then |
|---|
| 205 | export FC=gfortran |
|---|
| 206 | export F90=gfortran |
|---|
| 207 | export F90FLAGS=" -ffree-form $OPTIMNC" |
|---|
| 208 | export FFLAGS=" $OPTIMNC" |
|---|
| 209 | export CPPFLAGS= |
|---|
| 210 | export CC=gcc |
|---|
| 211 | export CXX=g++ |
|---|
| 212 | elif [ $compilo = pgf90 ] ; then |
|---|
| 213 | export CPPFLAGS="-DNDEBUG -DpgiFortran" |
|---|
| 214 | export CC=pgcc |
|---|
| 215 | export CFLAGS="-Msignextend" |
|---|
| 216 | export CXX=pgCC |
|---|
| 217 | export CXXFLAGS="-Msignextend" |
|---|
| 218 | export FC=pgf90 |
|---|
| 219 | export FFLAGS="$OPTIMNC" |
|---|
| 220 | export F90=pgf90 |
|---|
| 221 | export F90FLAGS="$OPTIMNC" |
|---|
| 222 | else |
|---|
| 223 | echo Le compilateur $compilo pas prevu ; exit |
|---|
| 224 | fi |
|---|
| 225 | ## end of if [ $netcdf = 1 ] |
|---|
| 226 | cd src |
|---|
| 227 | |
|---|
| 228 | ### Correction d'un petit probleme de netcdf |
|---|
| 229 | ##sed -e '83s/^$/\#define f2cFortran/' cfortran.h >| tmp ; \mv tmp cfortran.h |
|---|
| 230 | |
|---|
| 231 | # Compilation |
|---|
| 232 | # Modif du 6 juillet 2009. Plantage quand on essaie de compiler netcdf avec |
|---|
| 233 | # gcc plutôt que c++ |
|---|
| 234 | ##sed -e 's/ c++/ gcc/g' configure >| tmp ; mv -f tmp configure ; chmod +x configure |
|---|
| 235 | localdir=`pwd -P` |
|---|
| 236 | ./configure --prefix=$localdir |
|---|
| 237 | make check |
|---|
| 238 | make install |
|---|
| 239 | fi |
|---|
| 240 | |
|---|
| 241 | echo OK2 ioipsl=$ioipsl |
|---|
| 242 | echo '##########################################################' |
|---|
| 243 | echo Installation de MODIPSL, la procedure d\'installation des |
|---|
| 244 | echo modeles de l\'IPSL |
|---|
| 245 | echo '##########################################################' |
|---|
| 246 | |
|---|
| 247 | if [ $netcdf = 0 -o $netcdf = 1 ] ; then |
|---|
| 248 | ncdfdir=$MODEL/netcdf-4.0.1 |
|---|
| 249 | else |
|---|
| 250 | ncdfdir=$netcdf |
|---|
| 251 | fi |
|---|
| 252 | |
|---|
| 253 | if [ $ioipsl = 1 ] ; then |
|---|
| 254 | cd $MODEL/modipsl |
|---|
| 255 | \rm -r lib/* |
|---|
| 256 | |
|---|
| 257 | cd util |
|---|
| 258 | |
|---|
| 259 | if [ $compilo = pgf90 ] ; then |
|---|
| 260 | fmod='module ' |
|---|
| 261 | elif [ $compilo = g95 ] ; then |
|---|
| 262 | fmod='fmod=' |
|---|
| 263 | else # gfortran |
|---|
| 264 | fmod='I ' |
|---|
| 265 | fi |
|---|
| 266 | cp AA_make.gdef AA_make.orig |
|---|
| 267 | sed -e 's/^\#.*.g95.*.\#.*.$/\#/' AA_make.gdef > tmp |
|---|
| 268 | sed -e "s:F_L = g95:F_L = $compilo:" -e "s:F_C = g95 -c:F_C = $compilo -c": \ |
|---|
| 269 | -e 's/g95.*.w_w.*.(F_D)/g95 w_w = '"$OPTIMGCM"'/' \ |
|---|
| 270 | -e 's:g95.*.NCDF_INC.*.$:g95 NCDF_INC='"$ncdfdir"'/include:' \ |
|---|
| 271 | -e 's:g95.*.NCDF_LIB.*.$:g95 NCDF_LIB='"$ncdfdir"'/lib:' \ |
|---|
| 272 | -e "s:-fmod=:-$fmod:" -e 's/-fno-second-underscore//' \ |
|---|
| 273 | -e 's:#-Q- g95 M_K = gmake:#-Q- g95 M_K = make:' \ |
|---|
| 274 | tmp >| AA_make.gdef |
|---|
| 275 | |
|---|
| 276 | |
|---|
| 277 | if [ "$use_shell" = "ksh" ] ; then |
|---|
| 278 | if [ "$pclinux" = 1 ] ; then |
|---|
| 279 | ./ins_make -t g95 # On utilise les lignes g95 meme pour les autres compilo |
|---|
| 280 | fi |
|---|
| 281 | else # bash |
|---|
| 282 | sed -e s:/bin/ksh:/bin/bash:g ins_make > ins_make.bash |
|---|
| 283 | chmod u=rwx ins_make.bash |
|---|
| 284 | if [ "$pclinux" = 1 ] ; then |
|---|
| 285 | ./ins_make.bash -t g95 # On utilise les lignes g95 meme pour les autres compilo |
|---|
| 286 | else |
|---|
| 287 | ./ins_make.bash |
|---|
| 288 | fi |
|---|
| 289 | fi |
|---|
| 290 | |
|---|
| 291 | echo '##########################################################' |
|---|
| 292 | echo Compilation de IOIPSL, bibliotheque d\'interface avec Netcd |
|---|
| 293 | echo '##########################################################' |
|---|
| 294 | |
|---|
| 295 | cd $MODEL/modipsl/modeles/IOIPSL/src |
|---|
| 296 | if [ "$use_shell" = "bash" ] ; then |
|---|
| 297 | cp Makefile Makefile.ksh |
|---|
| 298 | sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile |
|---|
| 299 | fi |
|---|
| 300 | if [ "$pclinux" = 1 ] ; then |
|---|
| 301 | make clean |
|---|
| 302 | make |
|---|
| 303 | if [ $compilo = gfortran ] ; then # copy module files to lib |
|---|
| 304 | cp -f *.mod ../../../lib |
|---|
| 305 | fi |
|---|
| 306 | else |
|---|
| 307 | # we're on brodie |
|---|
| 308 | sxgmake clean |
|---|
| 309 | sxgmake |
|---|
| 310 | fi |
|---|
| 311 | |
|---|
| 312 | if [ "$veget" = 1 ] ; then |
|---|
| 313 | echo '########################################################' |
|---|
| 314 | echo Compilation de ORCHIDEE, modele des surface continentales |
|---|
| 315 | echo '########################################################' |
|---|
| 316 | cd $MODEL/modipsl/modeles/ORCHIDEE |
|---|
| 317 | cd src_parameters |
|---|
| 318 | # Une petite astuce pour ORCHIDEE suivant qu'on est en real*4 ou real*8 |
|---|
| 319 | |
|---|
| 320 | |
|---|
| 321 | \cp reqdprec.$real reqdprec.f90 |
|---|
| 322 | make |
|---|
| 323 | if [ $compilo = gfortran ] ; then # copy module files to lib |
|---|
| 324 | cp -f *.mod ../../../lib |
|---|
| 325 | fi |
|---|
| 326 | cd ../src_stomate |
|---|
| 327 | make |
|---|
| 328 | if [ $compilo = gfortran ] ; then # copy module files to lib |
|---|
| 329 | cp -f *.mod ../../../lib |
|---|
| 330 | fi |
|---|
| 331 | cd ../src_sechiba |
|---|
| 332 | make |
|---|
| 333 | if [ $compilo = gfortran ] ; then # copy module files to lib |
|---|
| 334 | cp -f *.mod ../../../lib |
|---|
| 335 | fi |
|---|
| 336 | fi |
|---|
| 337 | fi |
|---|
| 338 | |
|---|
| 339 | |
|---|
| 340 | # Ehouarn: it may be directory LMDZ4 or LMDZ5 depending on tar file... |
|---|
| 341 | if [[ -d $MODEL/modipsl/modeles/LMDZ4 ]] ; then |
|---|
| 342 | echo '##########################################################' |
|---|
| 343 | echo 'Compilation de LMDZ4' |
|---|
| 344 | echo '##########################################################' |
|---|
| 345 | cd $MODEL/modipsl/modeles/LMDZ4 |
|---|
| 346 | else |
|---|
| 347 | if [[ -d $MODEL/modipsl/modeles/LMDZ5 ]] ; then |
|---|
| 348 | echo '##########################################################' |
|---|
| 349 | echo 'Compilation de LMDZ5' |
|---|
| 350 | echo '##########################################################' |
|---|
| 351 | cd $MODEL/modipsl/modeles/LMDZ5 |
|---|
| 352 | else |
|---|
| 353 | echo "ERROR: No LMDZ4 (or LMDZ5) directory !!!" |
|---|
| 354 | exit |
|---|
| 355 | fi |
|---|
| 356 | fi |
|---|
| 357 | |
|---|
| 358 | if [ "$pclinux" = 1 ] ; then |
|---|
| 359 | if [ $compilo = gfortran ] ; then |
|---|
| 360 | sed \ |
|---|
| 361 | -e 's:\#setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \ |
|---|
| 362 | -e 's:\#setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \ |
|---|
| 363 | -e 's:setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \ |
|---|
| 364 | -e 's:setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \ |
|---|
| 365 | -e 's/set FC_LINUX.*.$/set FC_LINUX='$compilo'/' \ |
|---|
| 366 | -e 's/g95/gfortran/g' \ |
|---|
| 367 | -e 's/-fmod=/-I/g' \ |
|---|
| 368 | -e 's/-fno-second-underscore//' -e 's/-fstatic//' \ |
|---|
| 369 | -e 's/-lparallel//' \ |
|---|
| 370 | -e 's/-lorglob//' \ |
|---|
| 371 | -e 's/-ffixed-form//' -e 's/-ffree-form//' \ |
|---|
| 372 | -e 's/set OPT_LINUX.*.$/set OPT_LINUX=\"'"$OPTIMGCM"\"'/' makegcm.orig >| makegcm |
|---|
| 373 | else # g95 or pgf90 |
|---|
| 374 | sed \ |
|---|
| 375 | -e 's:\#setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \ |
|---|
| 376 | -e 's:\#setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \ |
|---|
| 377 | -e 's:setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \ |
|---|
| 378 | -e 's:setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \ |
|---|
| 379 | -e 's/set FC_LINUX.*.$/set FC_LINUX='$compilo'/' \ |
|---|
| 380 | -e 's/-fno-second-underscore//' -e 's/-fstatic//' \ |
|---|
| 381 | -e 's/-lparallel//' \ |
|---|
| 382 | -e 's/-lorglob//' \ |
|---|
| 383 | -e 's/-ffixed-form//' -e 's/-ffree-form//' \ |
|---|
| 384 | -e 's/set OPT_LINUX.*.$/set OPT_LINUX=\"'"$OPTIMGCM"\"'/' makegcm.orig >| makegcm |
|---|
| 385 | fi |
|---|
| 386 | else |
|---|
| 387 | sed \ |
|---|
| 388 | -e 's/-lparallel//' \ |
|---|
| 389 | -e 's/-lorglob//' \ |
|---|
| 390 | -e 's/-lsxorglob//' \ |
|---|
| 391 | -e 's/-lsxparallel//' \ |
|---|
| 392 | -e 's/-lsxioipsl/-lioipsl/g' \ |
|---|
| 393 | makegcm.orig >| makegcm |
|---|
| 394 | fi |
|---|
| 395 | |
|---|
| 396 | chmod +x makegcm |
|---|
| 397 | |
|---|
| 398 | ########################################################### |
|---|
| 399 | # Pour ceux qui voudraient utiliser fcm et pouvoir faire : |
|---|
| 400 | # makelmdz_fcm -arch local ..... |
|---|
| 401 | ############################################################ |
|---|
| 402 | |
|---|
| 403 | if [ "$pclinux" = 1 ] ; then |
|---|
| 404 | # creation de fichiers 'arch' locaux (si sur PC Linx): |
|---|
| 405 | cd arch |
|---|
| 406 | # fichier arch-local.path |
|---|
| 407 | echo "NETCDF_LIBDIR=\"-L/${ncdfdir}/lib -lnetcdf\"" > arch-local.path |
|---|
| 408 | echo "NETCDF_INCDIR=-I/${ncdfdir}/include" >> arch-local.path |
|---|
| 409 | echo 'IOIPSL_INCDIR=$LMDGCM/../../lib' >> arch-local.path |
|---|
| 410 | echo 'IOIPSL_LIBDIR=$LMDGCM/../../lib' >> arch-local.path |
|---|
| 411 | echo 'ORCH_INCDIR=$LMDGCM/../../lib' >> arch-local.path |
|---|
| 412 | echo 'ORCH_LIBDIR=$LMDGCM/../../lib' >> arch-local.path |
|---|
| 413 | # fichier arch-local.fcm (adaptation de arch-linux-32bit.fcm) |
|---|
| 414 | if [ $compilo = g95 ] ; then |
|---|
| 415 | sed -e s:"%COMPILER pgf95":"%COMPILER g95":1 \ |
|---|
| 416 | -e s:"%LINK pgf95":"%LINK g95":1 \ |
|---|
| 417 | -e s:"%PROD_FFLAGS -fast":"%PROD_FFLAGS ":1 \ |
|---|
| 418 | -e s:"%BASE_FFLAGS ":"%BASE_FFLAGS $OPTIMGCM":1 \ |
|---|
| 419 | arch-linux-32bit.fcm > arch-local.fcm |
|---|
| 420 | if [ $real = r8 ] ; then |
|---|
| 421 | sed -e s:"%FPP_DEF ":"%FPP_DEF NC_DOUBLE":1 \ |
|---|
| 422 | arch-local.fcm > arch-local.fcm.new |
|---|
| 423 | mv -f arch-local.fcm.new arch-local.fcm |
|---|
| 424 | fi |
|---|
| 425 | elif [ $compilo = gfortran ] ; then |
|---|
| 426 | sed -e s:"%COMPILER pgf95":"%COMPILER gfortran":1 \ |
|---|
| 427 | -e s:"%LINK pgf95":"%LINK gfortran":1 \ |
|---|
| 428 | -e s:"%PROD_FFLAGS -fast":"%PROD_FFLAGS ":1 \ |
|---|
| 429 | -e s:"%BASE_FFLAGS ":"%BASE_FFLAGS $OPTIMGCM":1 \ |
|---|
| 430 | arch-linux-32bit.fcm > arch-local.fcm |
|---|
| 431 | if [ $real = r8 ] ; then |
|---|
| 432 | sed -e s:"%FPP_DEF ":"%FPP_DEF NC_DOUBLE":1 \ |
|---|
| 433 | arch-local.fcm > arch-local.fcm.new |
|---|
| 434 | mv -f arch-local.fcm.new arch-local.fcm |
|---|
| 435 | fi |
|---|
| 436 | elif [ $compilo = pgf90 ] ; then |
|---|
| 437 | sed -e s:"-Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.2":" ":1 \ |
|---|
| 438 | -e s:"%PROD_FFLAGS -fast":"%PROD_FFLAGS ":1 \ |
|---|
| 439 | -e s:"%BASE_FFLAGS ":"%BASE_FFLAGS $OPTIMGCM":1 \ |
|---|
| 440 | arch-linux-32bit.fcm > arch-local.fcm |
|---|
| 441 | if [ $real = r8] ; then |
|---|
| 442 | sed -e s:"%FPP_DEF ":"%FPP_DEF NC_DOUBLE":1 \ |
|---|
| 443 | arch-local.fcm > arch-local.fcm.new |
|---|
| 444 | mv -f arch-local.fcm.new arch-local.fcm |
|---|
| 445 | fi |
|---|
| 446 | else |
|---|
| 447 | echo Le compilateur $compilo pas prevu ; exit |
|---|
| 448 | fi # of if [ $compilo = g95 ] elif [ $compilo = pgf90 ] |
|---|
| 449 | cd .. |
|---|
| 450 | ### Adaptation de "bld.cfg" (ajout du shell): |
|---|
| 451 | whereisthatshell=$(which ${use_shell}) |
|---|
| 452 | echo "bld::tool::SHELL $whereisthatshell" >> bld.cfg |
|---|
| 453 | |
|---|
| 454 | ### Modification de makelmdz_fcm pour utilisation de ORCHIDEE dans cette bench: |
|---|
| 455 | ### on enleve liborglob.a et libparallel.a |
|---|
| 456 | cp makelmdz_fcm makelmdz_fcm.orig |
|---|
| 457 | sed -e "s/-l\${LIBPREFIX}parallel//" \ |
|---|
| 458 | sed -e "s/-l\${LIBPREFIX}orglob//" \ |
|---|
| 459 | makelmdz_fcm.orig > makelmdz_fcm |
|---|
| 460 | |
|---|
| 461 | fi # of if [ "$pclinux" = 1 ] |
|---|
| 462 | |
|---|
| 463 | ################################################################## |
|---|
| 464 | # Lance compilation de LMDZ |
|---|
| 465 | ################################################################## |
|---|
| 466 | ok_veget=false |
|---|
| 467 | if [ "$veget" = 1 ] ; then ok_veget = true; fi |
|---|
| 468 | if [ $compile_with_fcm = 1 ] ; then |
|---|
| 469 | # Compilation avec makelmdz_fcm |
|---|
| 470 | ./makelmdz_fcm -d ${grid_resolution} -arch local -v $ok_veget gcm |
|---|
| 471 | else |
|---|
| 472 | # Compilation avec makegcm |
|---|
| 473 | ./makegcm -d ${grid_resolution} -v $ok_veget gcm |
|---|
| 474 | ./makegcm -d ${grid_resolution} -v $ok_veget gcm |
|---|
| 475 | ./makegcm -d ${grid_resolution} -v $ok_veget gcm |
|---|
| 476 | fi |
|---|
| 477 | |
|---|
| 478 | if [ -f gcm.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq_orch.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq.e ] ; then |
|---|
| 479 | echo '##########################################################' |
|---|
| 480 | echo Compilation reussie |
|---|
| 481 | echo '##########################################################' |
|---|
| 482 | else |
|---|
| 483 | echo Probleme de compilation |
|---|
| 484 | exit |
|---|
| 485 | fi |
|---|
| 486 | |
|---|
| 487 | ################################################################## |
|---|
| 488 | # Ci dessous le lancement eventuel d'un cas test (si bench=0) |
|---|
| 489 | ################################################################## |
|---|
| 490 | if [ $bench = 0 ] ; then |
|---|
| 491 | exit |
|---|
| 492 | fi |
|---|
| 493 | |
|---|
| 494 | echo '##########################################################' |
|---|
| 495 | echo Lancement d\'une simulation de test |
|---|
| 496 | echo '##########################################################' |
|---|
| 497 | |
|---|
| 498 | \rm -r BENCH${grid_resolution} |
|---|
| 499 | bench=bench_lmdz_${grid_resolution} |
|---|
| 500 | wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/$bench.tar.gz |
|---|
| 501 | gunzip $bench.tar.gz |
|---|
| 502 | tar xvf $bench.tar |
|---|
| 503 | |
|---|
| 504 | if [ -f gcm.e ] ; then |
|---|
| 505 | cp gcm.e BENCH${grid_resolution}/ |
|---|
| 506 | elif [ -f bin/gcm_${grid_resolution}_phylmd_seq_orch.e ] ; then |
|---|
| 507 | cp bin/gcm_${grid_resolution}_phylmd_seq_orch.e BENCH${grid_resolution}/gcm.e |
|---|
| 508 | elif [ -f bin/gcm_${grid_resolution}_phylmd_seq.e ] ; then |
|---|
| 509 | cp bin/gcm_${grid_resolution}_phylmd_seq.e BENCH${grid_resolution}/gcm.e |
|---|
| 510 | else |
|---|
| 511 | echo "No gcm.e found" |
|---|
| 512 | exit |
|---|
| 513 | fi |
|---|
| 514 | |
|---|
| 515 | if [ $hostname = brodie ] ; then |
|---|
| 516 | echo POUR LANCER LE BENCH, IL FAUT SE LOGUER SUR BRODIE01 |
|---|
| 517 | echo puis aller sur `pwd`/BENCH${grid_resolution} |
|---|
| 518 | echo et lancer le gcm |
|---|
| 519 | exit |
|---|
| 520 | fi |
|---|
| 521 | |
|---|
| 522 | cd BENCH${grid_resolution} |
|---|
| 523 | ./bench.sh > bench.out 2>&1 |
|---|
| 524 | |
|---|
| 525 | echo '##########################################################' |
|---|
| 526 | echo ' Resultat du bench ' |
|---|
| 527 | echo '##########################################################' |
|---|
| 528 | |
|---|
| 529 | cat ./bench.out |
|---|
| 530 | |
|---|
| 531 | echo '##########################################################' |
|---|
| 532 | echo 'La simulation test est terminee sur' `pwd` |
|---|
| 533 | echo 'vous pouvez la relancer : cd ' `pwd` ' ; gcm.e' |
|---|
| 534 | echo 'ou ./bench.sh' |
|---|
| 535 | echo '##########################################################' |
|---|
| 536 | |
|---|