Changeset 3044
- Timestamp:
- Oct 26, 2017, 3:12:15 PM (7 years ago)
- Location:
- BOL/script_install
- Files:
-
- 1 deleted
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
BOL/script_install/install_lmdz.sh
r3043 r3044 2 2 3 3 ########################################################################### 4 # Author : Frédéric Hourdin/LMD/hourdin@lmd.jussieu.fr5 # Usage : install .sh4 # Author : Laurent Fairhead et Frédéric Hourdin 5 # Usage : install_lmdz.sh -help 6 6 # 7 7 # bash installation script of the LMDZ model on a Linux PC. … … 22 22 # munimal configuration. 23 23 # 24 # Prerequisites : g95/pgf90/gfortran, ksh, wget , gunzip, tar, ...24 # Prerequisites : pgf90/gfortran, ksh, wget , gunzip, tar, ... 25 25 # 26 26 # Modif 18/11/2011 … … 36 36 set -e 37 37 38 echo '################################################################' 39 echo Choice of installation options 40 echo '################################################################' 38 ################################################################ 39 # Choice of installation options 40 ################################################################ 41 42 # A function to fetch files either locally or on the internet 43 function myget { #1st and only argument should be file name 44 # Path on local computer where to look for the datafile 45 LMDZ_HOME="/u/lmdz/WWW/Distrib" 46 if [ -f $LMDZ_HOME/$1 ] ; then 47 \cp -f -p $LMDZ_HOME/$1 . 48 else 49 wget http://www.lmd.jussieu.fr/~lmdz/Distrib/$1 50 fi 51 } 41 52 42 53 … … 47 58 # install.v2.sh instead of install.sh 48 59 49 version=trunk 50 version=20151130.trunk 60 ######################################################################### 61 # Valeur par défaut des parametres 62 ######################################################################### 63 svn="" 51 64 version=testing 52 53 compilo=gfortran # compilo=pgf90 or g95 or gfortran or ifort sur PC linux54 55 #Chemin pour placer le modele56 MODEL=./LMDZ$version57 58 59 65 getlmdzor=1 60 66 netcdf=1 # 1 for automatic installation … … 67 73 bench=1 68 74 pclinux=1 69 75 SCM=0 76 # use the old orchidee interface without the calculation of z0h 77 no_z0h_orc=1 70 78 # choose the resolution for the bench runs 71 # grid_resolution= 32x24x11, 32x32x39 or 48x36x19 for tests 79 # grid_resolution= 32x24x11 or 48x36x19 for tests (test without ORCHIDEE) 80 # 96x71x19 standard configuration 81 grid_resolution=144x142x79 72 82 grid_resolution=48x36x19 73 83 74 ## compile_with_fcm=1 : use makelmdz_fcm, possible a of version 20111103.trunk (LMDZ5/trunk rev 1578) 75 ## compile_with_fcm=0 : use makelmdz 76 compile_with_fcm=0 77 78 79 80 if [ -d /u/lmdz/WWW/Distrib ] ; then 81 dirget=/u/lmdz/WWW/Distrib 82 elif [ -d ~/LMDZ/Distrib ] ; then 83 dirget=~/LMDZ/Distrib 84 else 85 dirget=NONE 86 fi 87 wget='wget http://www.lmd.jussieu.fr/~lmdz/Distrib' 84 ## parallel can take the values none/mpi/omp/mpi_omp 85 parallel=mpi_omp 86 parallel=none 87 OPT_GPROF="" 88 OPT_MAKELMDZ="" 89 MODEL="" 90 91 ######################################################################### 92 # Options interactives 93 ######################################################################### 94 while (($# > 0)) 95 do 96 case $1 in 97 "-h") cat <<........fin 98 $0 [ -v version ] [ -r svn_release ] 99 [ -parallel PARA ] [ -d GRID_RESOLUTION ] [ -bench 0/1 ] 100 [-name LOCAL_MODEL_NAME] [-gprof] [-opt_makelmdz] 101 102 -v "version" like 20150828.trunk 103 see http://www.lmd.jussieu.fr/~lmdz/Distrib/LISMOI.trunk 104 105 -r "svn_release" : either the svn release number or "last" 106 107 -parallel PARA : can be mpi_omp (mpi with openMP) or none (for sequential) 108 109 -d GRID_RESOLUTION should be among the available benchs if -bench 1 110 among which : 48x36x19, 48x36x39 111 if wanting to run a bench simulation in addition to compilation 112 default : 48x36x19 113 114 -bench activating the bench or not (0/1). Default 1 115 116 -name LOCAL_MODEL_NAME : default = LMDZversion.release 117 118 -gprof to compile with -pg to enable profiling with gprof 119 -SCM install 1D version automatically 120 -opt_makelmdz to call makelmdz or makelmdz_fcm with additional options 121 ........fin 122 exit ;; 123 "-v") version=$2 ; shift ; shift ;; 124 "-r") svn=$2 ; shift ; shift ;; 125 "-d") grid_resolution=$2 ; shift ; shift ;; 126 "-gprof") OPT_GPROF="-pg" ; shift ;; 127 "-SCM") SCM=1 ; shift ;; 128 "-opt_makelmdz") OPT_MAKELMDZ="$2" ; shift ; shift ;; 129 "-parallel") parallel=$2 130 case $parallel in 131 "mpi"|"omp"|"mpi_omp") parallel=$2 ; shift ; shift ;; 132 *) echo Only mpi omp mpi_omp for the parallel option ; exit 133 esac ;; 134 "-bench") bench=$2 ; shift ; shift ;; 135 "-name") MODEL=$2 ; shift ; shift ;; 136 *) ./install_lmdz.sh -h ; exit 137 esac 138 done 139 140 if [ $parallel = none ] ; then sequential=1 ; else sequential=0 ; fi 141 142 143 compilo=gfortran # compilo=pgf90 or gfortran or ifort sur PC linux 144 #Chemin pour placer le modele 145 if [ "$MODEL" = "" ] ; then MODEL=./LMDZ$version$svn ; fi 146 147 148 ## compile_with_fcm=1 : use makelmdz_fcm (1) or makelmdz (0) 149 compile_with_fcm=1 150 arch=local 151 152 153 if [ $compilo = g95 ] ; then echo g95 is not supported anymore ; exit ; fi 154 155 ################################################################ 156 # Specificite des machines 157 ################################################################ 158 159 hostname=`hostname` 160 if [ "$pclinux" = 1 ] ; then o_ins_make="-t g95" ; else o_ins_make="" ; fi 161 162 case ${hostname:0:5} in 163 164 ada33) compilo="ifort" ; 165 par_comp="ifort" ; 166 o_ins_make="-t ada" ; 167 make=gmake ; 168 # module load intel/2013.0 ; 169 arch=X64_ADA ;; 170 171 *) compilo="gfortran" ; 172 if [ $parallel = none -o -f /usr/bin/mpif90 ] ; then 173 path_mpi="" ; 174 # Pour les installations Scientifique Linux LMD ou ciclad : 175 elif [ -f /usr/lib64/openmpi/1.4.5-gfortran/bin/mpif90 ] ; then 176 path_mpi=/usr/lib64/openmpi/1.4.5-gfortran/bin/ ; 177 else 178 echo Je ne trouve pas mpif90 ; 179 exit ; 180 fi ; 181 par_comp=${path_mpi}mpif90 ; 182 mpirun=${path_mpi}mpirun ; 183 arch=local ; 184 make=make ; 185 o_ins_make="-t g95" 186 esac 187 188 189 # MPI_FLAGS are the flags needed for compilation with MPI 190 MPI_FLAGS="-I/usr/include/openmpi-x86_64 -fcray-pointer" 191 MPI_FLAGS="-fcray-pointer" 192 # MPI_LD are the flags needed for linking with MPI 193 MPI_LD="-L/usr/lib64/openmpi/lib -lmpi" 194 # OMP_FLAGS are the flags needed for compilation with OpenMP 195 OMP_FLAGS="-fopenmp -fcray-pointer" 196 # OMP_LD are the flags needed for linking with OpenMP 197 OMP_LD="-fopenmp -L/usr/lib64 -lnuma" 198 OMP_LD="-fopenmp" 88 199 89 200 … … 96 207 ##################################################################### 97 208 98 if [ $compilo = gfortran] ; then209 if [ "$compilo" = "gfortran" ] ; then 99 210 gfortran=gfortran 100 211 gfortranv=`gfortran --version | \ … … 102 213 if [ $gfortranv -le 43 ] ; then 103 214 echo ERROR : Your gfortran compiler is too old 104 echo 'Please choose a new one ( g95,ifort) and change the line'215 echo 'Please choose a new one (ifort) and change the line' 105 216 echo compilo=xxx 106 217 echo in the install.sh script and rerun it … … 117 228 118 229 119 OPTPREC=""120 230 echo '################################################################' 121 231 echo Choix des options de compilation 122 232 echo '################################################################' 123 233 124 OPTIMNC=$OPTIM125 234 export FC=$compilo 126 235 export F90=$compilo 127 236 export F77=$compilo 128 237 export CPPFLAGS= 129 BASE_LD= 130 if [ $compilo = g95 ] ; then 131 # Set the appropriate compilation options 132 OPTIM='-i4 -O3' 133 OPTDEB="-g -O0 -Wall -ftrace=full -fbounds-check -freal=nan" 134 OPTDEV="-g -O1 -Wall" 135 fmod='fmod=' 136 BASE_LD="" 137 if [ $real = r8 ] ; then OPTPREC="-r8 -DNC_DOUBLE" ; fi 138 export F90FLAGS=" -cpp -ffree-form $OPTIMNC" 139 export FFLAGS=" -cpp $OPTIMNC" 140 export CPPFLAGS=-Df2cFortran 141 export CC=gcc 142 export CXX=g++ 143 elif [ $compilo = $gfortran ] ; then 238 OPTIMNC=$OPTIM 239 BASE_LD="$OPT_GPROF" 240 OPTPREC="$OPT_GPROF" 241 242 if [ "$compilo" = "$gfortran" ] ; then 144 243 OPTIM='-O3' 145 OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all -f init-real=nan -fbacktrace"244 OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all -fbacktrace -finit-real=nan" 146 245 OPTDEV="-Wall -fbounds-check" 147 246 fmod='I ' 148 # OPTPREC="-frecursive -ffree-line-length-none" 149 OPTPREC="-ffree-line-length-none" 247 OPTPREC="$OPTPREC -cpp -ffree-line-length-0" 150 248 if [ $real = r8 ] ; then OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE" ; fi 151 249 export F90FLAGS=" -ffree-form $OPTIMNC" … … 153 251 export CC=gcc 154 252 export CXX=g++ 253 export fpp_flags="-P -C -traditional -ffreestanding" 254 155 255 elif [ $compilo = mpif90 ] ; then 156 256 OPTIM='-O3' 157 OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all -finit-real=nan -fbacktrace"257 OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all" 158 258 OPTDEV="-Wall -fbounds-check" 159 BASE_LD=" -lblas"259 BASE_LD="$BASE_LD -lblas" 160 260 fmod='I ' 161 if [ $real = r8 ] ; then OPTPREC=" -fdefault-real-8 -DNC_DOUBLE -fcray-pointer" ; fi261 if [ $real = r8 ] ; then OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE -fcray-pointer" ; fi 162 262 export F90FLAGS=" -ffree-form $OPTIMNC" 163 263 export FFLAGS=" $OPTIMNC" 164 264 export CC=gcc 165 265 export CXX=g++ 266 166 267 elif [ $compilo = pgf90 ] ; then 167 268 OPTIM='-O2 -Mipa -Munroll -Mnoframe -Mautoinline -Mcache_align' … … 169 270 OPTDEV='-g -Mbounds -Ktrap=fp -traceback' 170 271 fmod='module ' 171 if [ $real = r8 ] ; then OPTPREC=" -r8 -DNC_DOUBLE" ; fi272 if [ $real = r8 ] ; then OPTPREC="$OPTPREC -r8 -DNC_DOUBLE" ; fi 172 273 export CPPFLAGS="-DpgiFortran" 173 274 export CC=pgcc … … 178 279 export F90FLAGS="-O2 $OPTIMNC" 179 280 compile_with_fcm=1 281 180 282 elif [ $compilo = ifort ] ; then 181 283 OPTIM="-O2 -fp-model strict -ip -align all " … … 183 285 OPTDEB="-g -no-ftz -traceback -ftrapuv -fp-stack-check -check" 184 286 fmod='module ' 185 if [ $real = r8 ] ; then OPTPREC=" -real-size 64 -DNC_DOUBLE" ; fi287 if [ $real = r8 ] ; then OPTPREC="$OPTPREC -real-size 64 -DNC_DOUBLE" ; fi 186 288 export CPP="icc -E" 187 289 export FFLAGS="-O2 -ip -fpic -mcmodel=large" … … 192 294 export CXXFLAGS="-O2 -ip -fpic -mcmodel=large" 193 295 compile_with_fcm=1 296 194 297 else 195 298 echo unexpected compiler $compilo ; exit … … 207 310 check_linux=0 208 311 pclinux=0 209 ioipsl= 0# no need to recompile ioipsl, already available312 ioipsl=1 # no need to recompile ioipsl, already available 210 313 #netcdf="/smplocal/pub/NetCDF/4.1.3" 211 314 compilo="ifort" 212 315 fmod='module ' 213 if [ $real = r8 ] ; then OPTPREC=" -real-size 64 -DNC_DOUBLE" ; fi316 if [ $real = r8 ] ; then OPTPREC="$OPTPREC -real-size 64 -DNC_DOUBLE" ; fi 214 317 OPTIM="-O2 -fp-model strict -ip -axAVX,SSE4.2 -align all " 215 318 OPTIMGCM="$OPTIM $OPTPREC" 216 319 fi 217 320 ########################################################################## 321 218 322 219 323 … … 247 351 248 352 249 for logiciel in wget tar gzip make $compilo gcc ; do353 for logiciel in csh wget tar gzip make $compilo gcc ; do 250 354 if [ "`which $logiciel`" = "" ] ; then 251 355 echo You must first install $logiciel on your system … … 274 378 echo '##########################################################' 275 379 cd $MODEL 276 if [ -f $dirget/modipsl.$version.tar.gz ] ; then 277 tar xvf $dirget/modipsl.$version.tar.gz 278 else 279 $wget/modipsl.$version.tar.gz 280 tar xvf modipsl.$version.tar.gz 281 \rm modipsl.$version.tar.gz 282 fi 283 284 # We download LMDZ and make some modifications to make it 285 #compatible with $compilo 286 # and we use an old stable but robust and well tested version of ORCHIDEE 287 # That version of ORCHIDEE can be obtained using 288 # wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/getlmdzor.x 380 #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/modipsl.$version.tar.gz 381 myget modipsl.$version.tar.gz 382 echo install.sh wget_OK `date` 383 gunzip modipsl.$version.tar.gz 384 tar xvf modipsl.$version.tar 385 \rm modipsl.$version.tar 386 289 387 fi 290 388 … … 296 394 echo '##########################################################' 297 395 cd $MODEL 298 if [ -f $dirget/netcdf-4.0.1.tar.gz ] ; then 299 tar xvf $dirget/netcdf-4.0.1.tar.gz 300 else 301 $wget/netcdf-4.0.1.tar.gz 302 tar xvf netcdf-4.0.1.tar.gz 303 \rm -f netcdf-4.0.1.tar.gz 304 fi 396 #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/netcdf-4.0.1.tar.gz 397 myget netcdf-4.0.1.tar.gz 398 gunzip netcdf-4.0.1.tar.gz 399 tar xvf netcdf-4.0.1.tar 400 \rm -f netcdf-4.0.1.tar 305 401 306 402 cd netcdf-4.0.1 … … 308 404 sed -e 's/gfortran/'$gfortran'/g' configure >| tmp ; mv -f tmp configure ; chmod +x configure 309 405 localdir=`pwd -P` 310 ./configure --prefix=$localdir -- disable-cxx406 ./configure --prefix=$localdir --enable-shared --disable-cxx 311 407 sed -e 's/gfortran/'$gfortran'/g' Makefile >| tmp ; mv -f tmp Makefile 312 make check313 make install408 $make check 409 $make install 314 410 echo install.sh netcdf_OK `date` 315 411 fi # of if [ $netcdf = 1 ] … … 342 438 -e 's/g95.*.w_w.*.(F_D)/g95 w_w = '"$OPTIMGCM"'/' \ 343 439 -e 's:g95.*.NCDF_INC.*.$:g95 NCDF_INC= '"$ncdfdir"'/include:' \ 344 -e 's:g95.*.NCDF_LIB.*.$:g95 NCDF_LIB= -L'"$ncdfdir"'/lib -lnetcdf :' \440 -e 's:g95.*.NCDF_LIB.*.$:g95 NCDF_LIB= -L'"$ncdfdir"'/lib -lnetcdff -lnetcdf:' \ 345 441 -e "s:-fmod=:-$fmod:" -e 's/-fno-second-underscore//' \ 346 442 -e 's:#-Q- g95 M_K = gmake:#-Q- g95 M_K = make:' \ … … 348 444 349 445 446 # We use lines for g95 even for the other compilers to run ins_make 350 447 if [ "$use_shell" = "ksh" ] ; then 351 if [ "$pclinux" = 1 ] ; then 352 ./ins_make -t g95 # We use lines for g95 even for the other compilers 353 fi 448 ./ins_make $o_ins_make 354 449 else # bash 355 450 sed -e s:/bin/ksh:/bin/bash:g ins_make > ins_make.bash 451 if [ "`grep ada AA_make.gdef`" = "" ] ; then # Bidouille pour compiler sur ada des vieux modipsl.tar 452 \cp -f ~rdzt401/bin/AA_make.gdef . 453 fi 356 454 chmod u=rwx ins_make.bash 357 if [ "$pclinux" = 1 ] ; then 358 ./ins_make.bash -t g95 # We use lines for g95 even for the other compilers 359 else 360 ./ins_make.bash 361 fi 455 ./ins_make.bash $o_ins_make 362 456 fi # of if [ "$use_shell" = "ksh" ] 363 457 … … 372 466 sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile 373 467 fi 374 468 # if [ "$pclinux" = 1 ] ; then 375 469 # Build IOIPSL modules and library 376 if [ $compilo = g95 ] ; then 377 cp restcom.f90 restcom.f90.orig 378 sed -e 's:cmode=or(NF90_NOCLOBBER,NF90_64BIT_OFFSET):cmode=NF90_NOCLOBBER:' restcom.f90.orig > restcom.f90 379 fi 380 make clean 381 make 470 echo EOEOFOOEOOOOOOOOOOOOOOOOOOOOOOOOOOOO 471 $make clean 472 $make 382 473 if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then # copy module files to lib 383 474 cp -f *.mod ../../../lib … … 395 486 -e 's:print:echo:g' rebuild.ksh > rebuild 396 487 fi 397 make clean398 make488 $make clean 489 $make 399 490 fi 400 491 # fi # of if [ "$pclinux" = 1 ] 401 492 402 493 else # of if [ $ioipsl = 1 ] … … 415 506 tmp >| AA_make.gdef 416 507 417 ./ins_make -t g95# We use lines for g95 even for the other compilers508 ./ins_make $o_ins_make # We use lines for g95 even for the other compilers 418 509 419 510 # on Ada, IOIPSL is already installed in ~rpsl035/IOIPSL_PLUS … … 423 514 ln -s ~rpsl035/IOIPSL_PLUS IOIPSL 424 515 cd .. 425 ln -s ~rpsl035/IOIPSL_PLUS/modipsl /bin/* bin/426 ln -s ~rpsl035/IOIPSL_PLUS/modipsl /lib/* lib/516 ln -s ~rpsl035/IOIPSL_PLUS/modipsl_Tagv2_2_3/bin/* bin/ 517 ln -s ~rpsl035/IOIPSL_PLUS/modipsl_Tagv2_2_3/lib/* lib/ 427 518 428 519 fi # of if [ ${hostname:0:5} = ada33 ] 429 520 echo install.sh ioipsl_OK `date` 430 521 fi # of if [ $ioipsl = 1 ] 431 522 # Saving ioipsl lib for possible parallel compile 523 cd $MODEL/modipsl 524 tar cf ioipsl.tar lib/ bin/ 432 525 433 526 #============================================================================ … … 438 531 echo '########################################################' 439 532 cd $MODEL/modipsl/modeles/ORCHIDEE 440 echo OKpwd ; pwd441 442 533 export ORCHPATH=`pwd` 443 534 if [ -d tools ] ; then 444 # orchidee_rev=2247 535 orchidee_rev=2247 445 536 veget_version=orchidee2.0 446 cd arch 447 fpp_flags='-P -traditional' 537 cd arch 448 538 sed -e s:"%COMPILER .*.$":"%COMPILER $compilo":1 \ 449 539 -e s:"%LINK .*.$":"%LINK $compilo":1 \ … … 452 542 -e s:"%DEV_FFLAGS .*.$":"%DEV_FFLAGS $OPTDEV":1 \ 453 543 -e s:"%DEBUG_FFLAGS .*.$":"%DEBUG_FFLAGS $OPTDEB":1 \ 454 -e s:"%BASE_FFLAGS .*.$":"%BASE_FFLAGS $OPTPREC -cpp":1 \ 544 -e s:"%BASE_FFLAGS .*.$":"%BASE_FFLAGS $OPTPREC":1 \ 545 -e s:"%BASE_LD .*.$":"%BASE_LD $BASE_LD":1 \ 455 546 arch-gfortran.fcm > arch-local.fcm 456 echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdf \"" > arch-local.path547 echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdff -lnetcdf\"" > arch-local.path 457 548 echo "NETCDF_INCDIR=${ncdfdir}/include" >> arch-local.path 458 549 echo "IOIPSL_INCDIR=$ORCHPATH/../../lib" >> arch-local.path 459 550 echo "IOIPSL_LIBDIR=$ORCHPATH/../../lib" >> arch-local.path 460 cd ../ 551 cd ../ 461 552 # compiling ORCHIDEE sequential mode 462 ./makeorchidee_fcm -noxios -prod -parallel none -arch local 553 ./makeorchidee_fcm -j 8 -noxios -prod -parallel none -arch $arch 554 echo ./makeorchidee_fcm -j 8 -noxios -prod -parallel none -arch $arch 555 echo Fin de la premiere compilation orchidee ; pwd 463 556 else 464 557 if [ -d src_parallel ] ; then … … 476 569 echo ls ; ls 477 570 if [ ! -d $src_d ] ; then echo Problem orchidee : no $src_d ; exit ; fi 478 cd $src_d ; \rm -f *.mod make ; make clean479 make ; if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then cp -f *.mod ../../../lib ; fi571 cd $src_d ; \rm -f *.mod make ; $make clean 572 $make ; if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then cp -f *.mod ../../../lib ; fi 480 573 cd .. 481 574 done 482 575 fi 483 echo liste_strc $liste_src484 485 for d in $liste_src ; do src_d=src_$d486 echo src_d $src_d487 echo ls ; ls488 if [ ! -d $src_d ] ; then echo Problem orchidee : no $src_d ; exit ; fi489 cd $src_d ; \rm -f *.mod make ; make clean490 make ; if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then cp -f *.mod ../../../lib ; fi491 cd ..492 done493 576 echo install.sh orchidee_OK `date` 494 577 fi # of if [ "$veget" = 1 ] … … 497 580 #============================================================================ 498 581 # Ehouarn: it may be directory LMDZ4 or LMDZ5 depending on tar file... 499 if [ -d $MODEL/modipsl/modeles/LMD Z[45]] ; then582 if [ -d $MODEL/modipsl/modeles/LMD* ] ; then 500 583 echo '##########################################################' 501 584 echo 'Compiling LMDZ' 502 585 echo '##########################################################' 503 cd $MODEL/modipsl/modeles/LMDZ[45] 586 cd $MODEL/modipsl/modeles/LMD* 587 LMDZPATH=`pwd` 504 588 else 505 echo "ERROR: No LMD Z4 (or LMDZ5)directory !!!"589 echo "ERROR: No LMD* directory !!!" 506 590 exit 507 591 fi … … 517 601 cd arch 518 602 # arch-local.path file 519 echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdf \"" > arch-local.path603 echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdff -lnetcdf\"" > arch-local.path 520 604 echo "NETCDF_INCDIR=-I${ncdfdir}/include" >> arch-local.path 521 605 echo 'IOIPSL_INCDIR=$LMDGCM/../../lib' >> arch-local.path 522 606 echo 'IOIPSL_LIBDIR=$LMDGCM/../../lib' >> arch-local.path 607 echo 'XIOS_INCDIR=$LMDGCM/../XIOS/inc' >> arch-local.path 608 echo 'XIOS_LIBDIR=$LMDGCM/../XIOS/lib' >> arch-local.path 523 609 echo 'ORCH_INCDIR=$LMDGCM/../../lib' >> arch-local.path 524 610 echo 'ORCH_LIBDIR=$LMDGCM/../../lib' >> arch-local.path 611 612 BASE_LD="$BASE_LD -Wl,-rpath=${ncdfdir}/lib" 525 613 # arch-local.fcm file (adapted from arch-linux-32bit.fcm) 526 614 … … 533 621 -e s:"%BASE_FFLAGS .*.$":"%BASE_FFLAGS $OPTPREC":1 \ 534 622 -e s:"%FPP_DEF .*.$":"%FPP_DEF $FPP_DEF":1 \ 623 -e s:"%BASE_LD .*.$":"%BASE_LD $BASE_LD":1 \ 535 624 arch-linux-32bit.fcm > arch-local.fcm 536 625 … … 543 632 544 633 545 cd $MODEL/modipsl/modeles/LMDZ? 634 cd $MODEL/modipsl/modeles/LMD* 635 636 ################################################################## 637 # Mise a jour eventuelle de LMDZ en cas de specification de la release svn 638 ################################################################## 639 640 if [ "$svn" = "last" ] ; then svnopt="" ; else svnopt="-r $svn" ; fi 641 if [ "$svn" != "" ] ; then set +e ; svn upgrade ; set -e ; svn update $svnopt ; fi 546 642 547 643 ################################################################## 548 644 # Compile LMDZ 549 645 ################################################################## 646 550 647 echo install.sh avant_compilation `date` 551 if [ $compile_with_fcm = 1 ] ; then makelmdz="makelmdz_fcm -j 8 -arch local" ; else makelmdz=makelmdz ; fi 552 553 ./$makelmdz -d ${grid_resolution} -v $veget_version gcm 648 if [ $compile_with_fcm = 1 ] ; then makelmdz="makelmdz_fcm -arch $arch -j 8" ; else makelmdz="makelmdz -arch $arch" ; fi 649 650 # use the orchidee interface that has no z0h 651 if [ "$no_z0h_orc" = 1 ] ; then 652 veget_version="$veget_version -cpp ORCHIDEE_NOZ0H" 653 fi 654 655 # sequential compilation and bench 656 if [ "$sequential" = 1 ] ; then 657 echo "./$makelmdz $OPT_MAKELMDZ -rrtm true -d ${grid_resolution} -v $veget_version gcm" >> compile.sh 658 chmod +x ./compile.sh ; ./compile.sh 554 659 echo install.sh apres_compilation `date` 555 660 556 661 557 if [ -f gcm.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq_orch.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq.e ] ; then 558 echo '##########################################################' 559 echo 'Compilation successfull !! ' 560 echo '##########################################################' 662 fi # fin sequential 663 664 665 666 # compiling in parallel mode 667 if [ $parallel != "none" ] ; then 668 echo '##########################################################' 669 echo ' Parallel compile ' 670 echo '##########################################################' 671 # saving the sequential libs and binaries 672 cd $MODEL/modipsl 673 tar cf sequential.tar bin/ lib/ 674 \rm -rf bin/ lib/ 675 tar xf ioipsl.tar 676 # 677 # Orchidee 678 # 679 cd $ORCHPATH 680 if [ -d src_parallel ] ; then 681 cd arch 682 sed \ 683 -e s:"%COMPILER.*.$":"%COMPILER $par_comp":1 \ 684 -e s:"%LINK.*.$":"%LINK $par_comp":1 \ 685 -e s:"%MPI_FFLAG.*.$":"%MPI_FFLAGS $MPI_FLAGS":1 \ 686 -e s:"%OMP_FFLAG.*.$":"%OMP_FFLAGS $OMP_FLAGS":1 \ 687 -e s:"%MPI_LD.*.$":"%MPI_LD $MPI_LD":1 \ 688 -e s:"%OMP_LD.*.$":"%OMP_LD $OMP_LD":1 \ 689 arch-local.fcm > tmp.fcm 690 691 mv tmp.fcm arch-local.fcm 692 cd ../ 693 # compiling ORCHIDEE parallel mode 694 ./makeorchidee_fcm -j 8 -clean -noxios -prod -parallel $parallel -arch $arch 695 ./makeorchidee_fcm -j 8 -noxios -prod -parallel $parallel -arch $arch 696 echo ./makeorchidee_fcm -j 8 -clean -noxios -prod -parallel $parallel -arch $arch 697 echo ./makeorchidee_fcm -j 8 -noxios -prod -parallel $parallel -arch $arch 698 echo deuxieme compilation orchidee ; pwd 561 699 else 562 echo 'Compilation failed !!' 563 exit 564 fi 565 566 ################################################################## 567 # Below, we run a benchmark test (if bench=0) 568 ################################################################## 569 if [ $bench = 0 ] ; then 570 exit 571 fi 572 573 echo '##########################################################' 574 echo ' Running a test run ' 575 echo '##########################################################' 576 577 \rm -rf BENCH${grid_resolution} 578 bench=bench_lmdz_${grid_resolution} 579 echo install.sh avant_chargement_bench `date` 580 if [ -f $dirget/$bench.tar.gz ] ; then 581 tar xvf $dirget/$bench.tar.gz 582 else 583 $wget/$bench.tar.gz 584 echo install.sh apres_chargement_bench `date` 585 tar xvf $bench.tar.gz 586 fi 587 588 if [ -f gcm.e ] ; then 589 cp gcm.e BENCH${grid_resolution}/ 590 elif [ -f bin/gcm_${grid_resolution}_phylmd_seq_orch.e ] ; then 591 cp bin/gcm_${grid_resolution}_phylmd_seq_orch.e BENCH${grid_resolution}/gcm.e 592 elif [ -f bin/gcm_${grid_resolution}_phylmd_seq.e ] ; then 593 cp bin/gcm_${grid_resolution}_phylmd_seq.e BENCH${grid_resolution}/gcm.e 594 else 595 echo "No gcm.e found" 596 exit 597 fi 598 599 600 cd BENCH${grid_resolution} 601 ./bench.sh > bench.out 2>&1 602 603 604 echo '##########################################################' 605 echo ' Bench results ' 606 echo '##########################################################' 607 608 cat ./bench.out 609 echo install.sh FIN_du_BENCH `date` 610 611 echo '##########################################################' 612 echo 'Simulation finished in' `pwd` 613 echo 'You may re-run it with : cd ' `pwd` ' ; gcm.e' 614 echo 'or ./bench.sh' 615 echo '##########################################################' 616 700 echo '##########################################################' 701 echo ' Orchidee version too old ' 702 echo ' Please update to new version ' 703 echo '##########################################################' 704 exit 705 fi 706 # LMDZ 707 cd $LMDZPATH 708 if [ $arch = local ] ; then 709 cd arch 710 sed -e s:"%COMPILER.*.$":"%COMPILER $par_comp":1 \ 711 -e s:"%LINK.*.$":"%LINK $par_comp":1 \ 712 -e s:"%MPI_FFLAG.*.$":"%MPI_FFLAGS $MPI_FLAGS":1 \ 713 -e s:"%OMP_FFLAG.*.$":"%OMP_FFLAGS $OMP_FLAGS":1 \ 714 -e s:"%MPI_LD.*.$":"%MPI_LD $MPI_LD":1 \ 715 -e s:"%OMP_LD.*.$":"%OMP_LD $OMP_LD":1 \ 716 arch-local.fcm > tmp.fcm 717 mv tmp.fcm arch-local.fcm 718 cd ../ 719 fi 720 rm -f compile.sh 721 if [ ${hostname:0:5} = ada33 ] ; then echo "module load intel/2013.0" > compile.sh ; fi 722 echo resol=${grid_resolution} >> compile.sh 723 echo ./$makelmdz $OPT_MAKELMDZ -rrtm true -d \$resol -v $veget_version -mem -parallel $parallel gcm >> compile.sh 724 chmod +x ./compile.sh ; ./compile.sh 725 726 echo Compilation finished 727 728 fi 729 730 echo LLLLLLLLLLLLLLLLLLLLLLLLLLL 617 731 if [ "$gfortran" = "gfortran44" ] ; then 618 732 echo Your gfortran compiler was too old so that the model was automatically … … 621 735 echo script and reinstall. 622 736 fi 737 738 ################################################################## 739 # Verification du succes de la compilation 740 ################################################################## 741 742 # Recherche de l'executable dont le nom a change au fil du temps ... 743 gcm="" 744 for exe in gcm.e bin/gcm_${grid_resolution}_phylmd_seq_orch.e bin/gcm_${grid_resolution}_phylmd_seq.e bin/gcm_${grid_resolution}_phylmd_para_mem_orch.e ; do 745 if [ -f $exe ] ; then gcm=$exe ; fi 746 done 747 748 if [ "$gcm" = "" ] ; then 749 echo 'Compilation failed !!' 750 exit 751 else 752 echo '##########################################################' 753 echo 'Compilation successfull !! ' 754 echo '##########################################################' 755 echo The executable is $gcm 756 fi 757 758 ################################################################## 759 # Below, we run a benchmark test (if bench=0) 760 ################################################################## 761 762 if [ $bench != 0 ] ; then 763 764 echo '##########################################################' 765 echo ' Running a test run ' 766 echo '##########################################################' 767 768 \rm -rf BENCH${grid_resolution} 769 bench=bench_lmdz_${grid_resolution} 770 echo install.sh avant_chargement_bench `date` 771 #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/$bench.tar.gz 772 myget $bench.tar.gz 773 echo install.sh after bench download `date` 774 tar xvf $bench.tar.gz 775 776 cp $gcm BENCH${grid_resolution}/gcm.e 777 778 779 cd BENCH${grid_resolution} 780 # On cree le fichier bench.sh au besoin 781 # Dans le cas 48x36x39 le bench.sh existe deja en parallele 782 783 if [ "$grid_resolution" = "48x36x39" ] ; then 784 echo On ne touche pas au bench.sh 785 # But we have to adapt "run_local.sh" for $mpirun 786 sed -e "s@mpirun@$mpirun@g" run_local.sh > tmp 787 mv -f tmp run_local.sh 788 chmod u=rwx run_local.sh 789 elif [ "${parallel:0:3}" = "mpi" ] ; then 790 # Lancement avec deux procs mpi et 2 openMP 791 echo "export OMP_STACKSIZE=800M" > bench.sh 792 if [ "${parallel:4:3}" = "omp" ] ; then 793 echo "export OMP_NUM_THREADS=2" >> bench.sh 794 fi 795 echo "ulimit -s unlimited" >> bench.sh 796 echo "$mpirun -np 2 gcm.e > listing 2>&1" >> bench.sh 797 else 798 echo "./gcm.e > listing 2>&1" > bench.sh 799 fi 800 echo EXECUTION DU BENCH 801 date ; ./bench.sh > out.bench 2>&1 ; date 802 tail listing 803 804 805 echo '##########################################################' 806 echo 'Simulation finished in' `pwd` 807 echo 'You have compiled with:' 808 cat ../compile.sh 809 if [ $parallel = "none" ] ; then 810 echo 'You may re-run it with : cd ' `pwd` ' ; gcm.e' 811 echo 'or ./bench.sh' 812 else 813 echo 'You may re-run it with : ' 814 echo 'cd ' `pwd` '; ./bench.sh' 815 echo 'ulimit -s unlimited' 816 echo 'export OMP_NUM_THREADS=2' 817 echo 'export OMP_STACKSIZE=800M' 818 echo "$mpirun -np 2 gcm.e " 819 fi 820 echo '##########################################################' 821 822 fi 823 824 825 ################################################################# 826 # Installation eventuelle du 1D 827 ################################################################# 828 829 if [ $SCM = 1 ] ; then 830 cd $MODEL 831 #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/1D.tar.gz 832 myget 1D.tar.gz 833 tar xvf 1D.tar.gz 834 cd 1D 835 ./run.sh 836 fi
Note: See TracChangeset
for help on using the changeset viewer.