Changeset 4849
- Timestamp:
- Mar 18, 2024, 5:53:12 PM (8 months ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
BOL/script_install_new
r4848 r4849 1 1 #!/bin/bash 2 3 #set -vx 2 set -eu # error on command failure, and on unset variables 3 export LC_ALL=C # standardize awk format 4 4 5 5 ########################################################################### … … 36 36 ########################################################################### 37 37 38 echo install_lmdz.sh DEBUT `date` 39 set -e 38 echo install_lmdz.sh DEBUT "$(date)" 40 39 41 40 ################################################################ … … 48 47 function myget { #1st and only argument should be file name 49 48 # Path on local computer where to look for the datafile 50 if [ -f /u/lmdz/WWW/LMDZ/pub/$1 ]; then51 \cp -f -p /u/lmdz/WWW/LMDZ/pub/$1.52 elif [ -f ~/LMDZ/pub/$1 ]; then53 \cp -f -p ~ /LMDZ/pub/$1.49 if [[ -f /u/lmdz/WWW/LMDZ/pub/$1 ]]; then 50 \cp -f -p "/u/lmdz/WWW/LMDZ/pub/$1" . 51 elif [[ -f ~/LMDZ/pub/$1 ]]; then 52 \cp -f -p ~"/LMDZ/pub/$1" . 54 53 else 55 wget --no-check-certificate -nv http://lmdz.lmd.jussieu.fr/pub/$154 wget --no-check-certificate -nv "http://lmdz.lmd.jussieu.fr/pub/$1" 56 55 save_pub_locally=0 57 if [ $save_pub_locally = 1 ]; then # saving wget files on ~/LMDZ/pub58 dir=~ /LMDZ/pub/`dirname $1` ; mkdir -p $dir59 cp -r `basename $1` $dir56 if [[ $save_pub_locally = 1 ]]; then # saving wget files on ~/LMDZ/pub 57 dir=~"/LMDZ/pub/$(dirname "$1")"; mkdir -p "$dir" 58 cp -r "$(basename "$1")" "$dir" 60 59 fi 61 60 fi … … 63 62 64 63 # 04_2021 : tester si r4 marche encore ! 65 #real=r4 66 real=r8 64 real="r8" # ou "r4" 67 65 68 66 … … 71 69 ######################################################################### 72 70 svn="" 73 #version=trunk 74 version=20231022.trunk 71 version="20231022.trunk" 75 72 76 73 getlmdzor=1 … … 83 80 pclinux=1 84 81 pcmac=0 # default: not on a Mac 85 compiler= gfortran86 if [ `gfortran -dumpversion | cut -d. -f1` -ge 10 ] ; then allow_arg_mismatch="-fallow-argument-mismatch"; fi82 compiler="gfortran" 83 if [[ $(gfortran -dumpversion | cut -d. -f1) -ge 10 ]]; then allow_arg_mismatch="-fallow-argument-mismatch"; fi 87 84 SCM=0 88 85 # surface/vegetation scheme treatment … … 91 88 # - CMIP6: orchidee version used in CMIP exercise, rev 5661 92 89 # - number: orchidee version number 93 veget= NONE90 veget="NONE" 94 91 # choose the resolution for the bench runs 95 92 # grid_resolution= 32x24x11 or 48x36x19 for tests (test without ORCHIDEE) 96 93 # 96x71x19 standard configuration 97 grid_resolution= 144x142x7998 grid_resolution= 96x95x3999 grid_resolution= 48x36x19100 grid_resolution= 32x32x3994 grid_resolution="144x142x79" 95 grid_resolution="96x95x39" 96 grid_resolution="48x36x19" 97 grid_resolution="32x32x39" 101 98 # choose the physiq version you want to test 102 99 #physiq=NPv6.0.14splith 103 physiq= 100 physiq="" 104 101 105 102 ## parallel can take the values none/mpi/omp/mpi_omp 106 parallel= mpi_omp107 parallel= none108 idris_acct= lmd109 trusting= testing103 parallel="mpi_omp" 104 parallel="none" 105 idris_acct="lmd" 106 trusting="testing" 110 107 OPT_GPROF="" 111 108 OPT_MAKELMDZ="" … … 117 114 118 115 ## compile with oldrad/rrtm/ecrad radiatif code (Default=rrtm) 119 rad= rrtm116 rad="rrtm" 120 117 121 118 ## compile_with_fcm=1 : use makelmdz_fcm (1) or makelmdz (0) 122 119 compile_with_fcm=1 123 120 124 #Compilation with Cosp (cosp=NONE/v1/v2 125 cosp= NONE121 #Compilation with Cosp (cosp=NONE/v1/v2; default=NONE) 122 cosp="NONE" 126 123 opt_cosp="" 127 124 128 125 # Check if on a Mac 129 if [ `uname` = "Darwin" ] 130 then 126 if [[ $(uname) = "Darwin" ]]; then 131 127 pcmac=1 132 128 export MAKE=make 133 129 fi 134 #echo "pcmac="$pcmac135 130 136 131 env_file="" 132 optim="" 137 133 138 134 ######################################################################### … … 197 193 198 194 ........fin 199 exit ;;200 "-v") version=$2 ; shift ; shift;;201 "-r") svn=$2 ; shift ; shift;;195 exit 1;; 196 "-v") version=$2; shift; shift;; 197 "-r") svn=$2; shift; shift;; 202 198 "-compiler") compiler=$2 203 199 case $compiler in 204 "gfortran"|"ifort"|"pgf90") compiler=$2 205 shift 200 "gfortran"|"ifort"|"pgf90") compiler=$2; shift 201 shift;; 206 202 *) echo "Only gfortran , ifort or pgf90 for the " \ 207 203 "compiler option" 208 exit 209 esac 210 "-d") grid_resolution=$2 ; shift ; shift;;211 "-gprof") OPT_GPROF="-pg" ; shift;;212 "-unstable"|"-testing") trusting= `echo $1 | cut -c2-` ; shift;;204 exit 1 205 esac;; 206 "-d") grid_resolution=$2; shift; shift;; 207 "-gprof") OPT_GPROF="-pg"; shift;; 208 "-unstable"|"-testing") trusting=$(echo "$1" | cut -c2-) ; shift;; 213 209 "-cosp") cosp=$2 214 210 case $cosp in 215 "none"|"v1"|"v2") cosp=$2 ; shift ; shift ;; 216 *) echo Only none v1 v2 for cosp option ; exit 217 esac ;; 218 "-nofcm") compile_with_fcm=0 ; echo This option will be reactivated soon '(promesse du 8dec2022)' ; exit 1 ; shift ;; 219 "-SCM") SCM=1 ; shift ;; 220 "-opt_makelmdz") OPT_MAKELMDZ="$2" ; shift ; shift ;; 221 "-rrtm") rrtm="$2" 222 if [ "$2" = "false" ] ; then 211 "none"|"v1"|"v2") cosp=$2; shift; shift;; 212 *) echo Only none v1 v2 for cosp option; exit 1 213 esac;; 214 "-nofcm") compile_with_fcm=0; echo This option will be reactivated soon '(promesse du 8dec2022)'; exit 1; shift;; 215 "-SCM") SCM=1; shift;; 216 "-opt_makelmdz") OPT_MAKELMDZ="$2"; shift; shift;; 217 "-rrtm") if [[ $2 = "false" ]]; then 223 218 rad="oldrad" 224 219 else 225 220 rad="rrtm" 226 221 fi 227 shift ; shift;;222 shift; shift;; 228 223 "-rad") rad=$2 229 224 case $rad in 230 "oldrad"|"rrtm"|"ecrad") rad=$2 ; shift ; shift;;231 *) echo Only oldrad rrtm ecrad for rad option ; exit232 esac 225 "oldrad"|"rrtm"|"ecrad") rad=$2; shift; shift;; 226 *) echo "Only oldrad rrtm ecrad for rad option"; exit 1 227 esac;; 233 228 "-parallel") parallel=$2 234 229 case $parallel in 235 "none"|"mpi"|"omp"|"mpi_omp") parallel=$2 ; shift 236 shift ;; 237 *) echo Only none mpi omp mpi_omp for the parallel \ 238 option 239 exit 240 esac ;; 241 "-bench") bench=$2 ; shift ; shift ;; 242 "-debug") optim=-debug ; shift ;; 243 "-name") MODEL=$2 ; shift ; shift ;; 244 "-netcdf") netcdf=$2 ; shift ; shift ;; 245 "-physiq") physiq=$2 ; shift ; shift ;; 246 "-xios") with_xios="y" ; shift ;; 247 "-env_file") env_file=$2 ; shift ; shift ;; 248 "-veget") veget=$2 ; shift ; shift ;; 249 *) bash install_lmdz.sh -h ; exit 230 "none"|"mpi"|"omp"|"mpi_omp") parallel=$2; shift 231 shift;; 232 *) echo "Only none mpi omp mpi_omp for the parallel option" 233 exit 1 234 esac;; 235 "-bench") bench=$2; shift; shift;; 236 "-debug") optim=-debug; shift;; 237 "-name") MODEL=$2; shift; shift;; 238 "-netcdf") netcdf=$2; shift; shift;; 239 "-physiq") physiq=$2; shift; shift;; 240 "-xios") with_xios="y"; shift;; 241 "-env_file") env_file=$2; shift; shift;; 242 "-veget") veget=$2; shift; shift;; 243 *) bash install_lmdz.sh -h; exit 1 250 244 esac 251 245 done … … 256 250 #opt_rad="" 257 251 #case $rad in 258 # rrtm) opt_rad="-rad rrtm" 259 # ecrad) opt_rad="-rad ecrad" 252 # rrtm) opt_rad="-rad rrtm";; 253 # ecrad) opt_rad="-rad ecrad";; 260 254 #esac 261 255 … … 264 258 opt_cosp="" 265 259 case $cosp in 266 v1) opt_cosp="-cosp true" 267 v2) opt_cosp="-cospv2 true" 260 v1) opt_cosp="-cosp true";; 261 v2) opt_cosp="-cospv2 true";; 268 262 esac 269 263 270 264 # Check on veget version 271 #if [ "$veget" != 'NONE' -a "$veget" != "CMIP6" -a "$veget" != +([0-9]) ] ; then 272 if [ $veget != 'NONE' -a $veget != "CMIP6" ] ; then 265 if [[ $veget != 'NONE' && $veget != "CMIP6" ]]; then 273 266 re='^[0-9]+$' 274 if ! [[ $veget =~ $re ]] 267 if ! [[ $veget =~ $re ]]; then 275 268 echo 'Valeur de l option veget non valable' 276 exit 269 exit 1 277 270 fi 278 271 fi 279 272 280 273 #Define veget-related suffix for gcm name 281 if [ "$veget" = 'NONE' ]; then274 if [[ $veget = 'NONE' ]]; then 282 275 suff_orc='' 283 276 #For use with tutorial, orchidee_rev is also defined (will be … … 289 282 290 283 291 if [ $parallel = none ]; then284 if [[ $parallel = none ]]; then 292 285 sequential=1; suff_exe='_seq' 293 286 else … … 296 289 297 290 #Chemin pour placer le modele 298 if [ "$MODEL" = "" ] ; then MODEL=./LMDZ$version$svn$optim; fi291 if [[ $MODEL = "" ]]; then MODEL=./LMDZ$version$svn$optim; fi 299 292 300 293 … … 302 295 303 296 304 if [ $compiler = g95 ] ; then echo g95 is not supported anymore ; exit; fi297 if [[ $compiler = g95 ]]; then echo g95 is not supported anymore; exit 1; fi 305 298 306 299 ################################################################ … … 308 301 ################################################################ 309 302 310 hostname= `hostname`311 if [ "$pclinux" = 1 ] ; then o_ins_make="-t g95" ; else o_ins_make=""; fi303 hostname=$(hostname) 304 if [[ $pclinux = 1 ]]; then o_ins_make="-t g95"; else o_ins_make=""; fi 312 305 313 306 case ${hostname:0:5} in 314 307 315 jean-) compiler="mpiifort" 316 par_comp="mpiifort" 317 o_ins_make="-t jeanzay" 318 make=gmake 308 jean-) compiler="mpiifort"; 309 par_comp="mpiifort"; 310 o_ins_make="-t jeanzay"; 311 make=gmake; 319 312 module purge 320 module load intel-compilers/19.0.4 321 #module load intel-mpi/19.0.4 322 #module load intel-mkl/19.0.4 323 module load hdf5/1.10.5-mpi 324 module load netcdf/4.7.2-mpi 325 module load netcdf-fortran/4.5.2-mpi 326 module load subversion/1.9.7 313 module load intel-compilers/19.0.4; 314 #module load intel-mpi/19.0.4; 315 #module load intel-mkl/19.0.4; 316 module load hdf5/1.10.5-mpi; 317 module load netcdf/4.7.2-mpi; 318 module load netcdf-fortran/4.5.2-mpi; 319 module load subversion/1.9.7; 327 320 module load cmake 328 321 export NETCDF_LIBDIR=./ 329 322 export NETCDFFORTRAN_INCDIR=./ 330 323 export NETCDFFORTRAN_LIBDIR=./ 331 arch=X64_JEANZAY 332 333 cicla|camel) compiler="gfortran" 324 arch=X64_JEANZAY;; 325 326 cicla|camel) compiler="gfortran"; 334 327 module purge 335 328 module load gnu/10.2.0 … … 341 334 module load svn/1.14.0 342 335 343 if [ $parallel != none ]; then336 if [[ $parallel != none ]]; then 344 337 root_mpi=/net/nfs/tools/meso-sl6/openmpi/4.0.5-gcc-10.2.0 345 path_mpi=$root_mpi/bin 346 par_comp=${path_mpi}/mpif90 347 mpirun=${path_mpi}/mpirun 348 fi 349 arch= local;350 make= make;351 o_ins_make="-t g95" 352 353 *) if [ $parallel = none -o -f /usr/bin/mpif90 ]; then354 path_mpi= `which mpif90 | sed -e s:/mpif90::`;355 if [ -d /usr/lib64/openmpi ]; then338 path_mpi=$root_mpi/bin; 339 par_comp=${path_mpi}/mpif90; 340 mpirun=${path_mpi}/mpirun; 341 fi; 342 arch="local" ; 343 make="make"; 344 o_ins_make="-t g95";; 345 346 *) if [[ $parallel = none || -f /usr/bin/mpif90 ]]; then 347 path_mpi=$(which mpif90 | sed -e s:/mpif90::); 348 if [[ -d /usr/lib64/openmpi ]]; then 356 349 root_mpi="/usr/lib64/openmpi" 357 350 else … … 359 352 fi 360 353 else 361 echo "Cannot find mpif90" 362 if [ $parallel = none ] ; then exit ; fi;363 fi 364 if [ $parallel != none ]; then354 echo "Cannot find mpif90"; 355 if [[ $parallel = none ]]; then exit 1; fi; 356 fi; 357 if [[ $parallel != none ]]; then 365 358 root_mpi=$(which mpif90 | sed -e s:/bin/mpif90::) 366 359 path_mpi=$(which mpif90 | sed -e s:/mpif90::) 367 360 export LD_LIBRARY_PATH=${root_mpi}/lib:$LD_LIBRARY_PATH 368 361 fi 369 par_comp=${path_mpi}/mpif90 370 mpirun=${path_mpi}/mpirun 371 arch= local;372 make= make;362 par_comp=${path_mpi}/mpif90; 363 mpirun=${path_mpi}/mpirun; 364 arch="local" ; 365 make="make"; 373 366 o_ins_make="-t g95" 374 367 esac 375 368 376 369 # Flags for parallelism: 377 if [ $parallel != none ]; then370 if [[ $parallel != none ]]; then 378 371 # MPI_LD are the flags needed for linking with MPI 379 372 MPI_LD="-L${root_mpi}/lib -lmpi" 380 if [ "$compiler" = "gfortran" ]; then373 if [[ "$compiler" = "gfortran" ]]; then 381 374 # MPI_FLAGS are the flags needed for compilation with MPI 382 375 MPI_FLAGS="-fcray-pointer" … … 385 378 # OMP_LD are the flags needed for linking with OpenMP 386 379 OMP_LD="-fopenmp" 387 elif [ "$compiler" = "ifort" ]; then380 elif [[ "$compiler" = "ifort" ]]; then 388 381 MPI_FLAGS="" 389 382 OMP_FLAGS="-openmp" … … 404 397 ##################################################################### 405 398 406 if [ "$compiler" = "gfortran" ]; then399 if [[ "$compiler" = "gfortran" ]]; then 407 400 gfortran=gfortran 408 gfortranv=`gfortran --version | \ 409 head -1 | awk ' { print $NF } ' | awk -F. ' { print $1 * 10 + $2 } '` 410 if [ $gfortranv -le 43 ] ; then 411 echo ERROR : Your gfortran compiler is too old 412 echo 'Please choose a new one (ifort) and change the line' 413 echo compiler=xxx 414 echo in the install_lmdz.sh script and rerun it 415 if [ `which gfortran44 | wc -w` -ne 0 ] ; then 401 gfortranv=$(gfortran --version | \ 402 head -1 | awk ' { print $NF } ' | awk -F. ' { print $1 * 10 + $2 } ') 403 if [[ $gfortranv -le 43 ]]; then 404 \cat <<EOF 405 ERROR : Your gfortran compiler is too old 406 Please choose a new one (ifort) and change the line 407 compiler=xxx 408 in the install_lmdz.sh script and rerun it 409 EOF 410 if [[ $(which gfortran44 | wc -w) -ne 0 ]]; then 416 411 gfortran=gfortran44 417 412 else 418 echo gfotran trop vieux ; exit413 echo gfotran trop vieux; exit 1 419 414 fi 420 415 fi … … 424 419 425 420 ## if also compiling XIOS, parallel must be mpi_omp 426 if [ "$with_xios" = "y" -a "$parallel" != "mpi_omp" ]; then421 if [[ "$with_xios" = "y" && "$parallel" != "mpi_omp" ]]; then 427 422 echo "Error, you must set -parallel mpi_omp if you want XIOS" 428 exit 429 fi 430 431 if [ "$with_xios" = "y" ]; then423 exit 1 424 fi 425 426 if [[ "$with_xios" = "y" ]]; then 432 427 opt_makelmdz_xios="-io xios" 433 428 fi 434 429 435 if [ "$cosp" = "v2" -a "$with_xios" = "n" ]; then430 if [[ "$cosp" = "v2" && "$with_xios" = "n" ]]; then 436 431 echo "Error, Cospv2 cannot run without Xios" 437 exit 432 exit 1 438 433 fi 439 434 … … 446 441 export F77=$compiler 447 442 export CPPFLAGS= 448 OPTIMNC= $OPTIM443 OPTIMNC="" 449 444 BASE_LD="$OPT_GPROF" 450 445 OPTPREC="$OPT_GPROF" 451 446 ARFLAGS="rs" 452 if [ "`lsb_release -i -s`" = "Ubuntu" ]; then453 if [ "`lsb_release -r -s | cut -d. -f1`" -ge 16 ]; then447 if [[ "$(lsb_release -i -s)" = "Ubuntu" ]]; then 448 if [[ "$(lsb_release -r -s | cut -d. -f1)" -ge 16 ]]; then 454 449 ARFLAGS="rU" 455 450 fi 456 451 fi 457 452 458 if [ "$compiler" = "$gfortran" ]; then453 if [[ "$compiler" = "$gfortran" ]]; then 459 454 OPTIM="-O3 $allow_arg_mismatch" 460 455 OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all -fbacktrace -finit-real=snan $allow_arg_mismatch" … … 462 457 fmod='I ' 463 458 OPTPREC="$OPTPREC -cpp -ffree-line-length-0" 464 if [ $real = r8 ] ; then OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE"; fi459 if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE"; fi 465 460 export F90FLAGS=" -ffree-form $OPTIMNC" 466 461 export FFLAGS=" $OPTIMNC" … … 469 464 export fpp_flags="-P -C -traditional -ffreestanding" 470 465 471 elif [ $compiler = mpif90 ]; then466 elif [[ $compiler = mpif90 ]]; then 472 467 OPTIM='-O3' 473 468 OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all" … … 475 470 BASE_LD="$BASE_LD -lblas" 476 471 fmod='I ' 477 if [ $real = r8 ]; then472 if [[ $real = r8 ]]; then 478 473 OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE -fcray-pointer" 479 474 fi … … 483 478 export CXX=g++ 484 479 485 elif [ $compiler = pgf90 ]; then480 elif [[ $compiler = pgf90 ]]; then 486 481 OPTIM='-O2 -Mipa -Munroll -Mnoframe -Mautoinline -Mcache_align' 487 482 OPTDEB='-g -Mdclchk -Mbounds -Mchkfpstk -Mchkptr -Minform=inform -Mstandard -Ktrap=fp -traceback' 488 483 OPTDEV='-g -Mbounds -Ktrap=fp -traceback' 489 484 fmod='module ' 490 if [ $real = r8 ] ; then OPTPREC="$OPTPREC -r8 -DNC_DOUBLE"; fi485 if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -r8 -DNC_DOUBLE"; fi 491 486 export CPPFLAGS="-DpgiFortran" 492 487 export CC=pgcc … … 498 493 compile_with_fcm=1 499 494 500 elif [[ $compiler = ifort || $compiler = mpiifort ]] 495 elif [[ $compiler = ifort || $compiler = mpiifort ]]; then 501 496 OPTIM="-O2 -fp-model strict -ip -align all " 502 497 OPTDEV="-p -g -O2 -traceback -fp-stack-check -ftrapuv -check" 503 498 OPTDEB="-g -no-ftz -traceback -ftrapuv -fp-stack-check -check" 504 499 fmod='module ' 505 if [ $real = r8 ] ; then OPTPREC="$OPTPREC -real-size 64 -DNC_DOUBLE"; fi500 if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -real-size 64 -DNC_DOUBLE"; fi 506 501 export CPP="icc -E" 507 502 export FFLAGS="-O2 -ip -fpic -mcmodel=large" … … 515 510 #compile_with_fcm=1 516 511 else 517 echo unexpected compiler $compiler ; exit512 echo "unexpected compiler $compiler"; exit 1 518 513 fi 519 514 520 515 OPTIMGCM="$OPTIM $OPTPREC" 521 516 522 hostname= `hostname`517 hostname=$(hostname) 523 518 524 519 ########################################################################## 525 520 # If installing on known machines such as Jean-Zay at IDRIS, 526 521 # don't check for available software and don't install netcdf 527 if [ ${hostname:0:5} = jean- ]; then522 if [[ ${hostname:0:5} = jean- ]]; then 528 523 netcdf=0 # no need to recompile netcdf, alreday available 529 524 check_linux=0 … … 533 528 compiler="mpiifort" 534 529 fmod='module ' 535 if [ $real = r8 ] ; then OPTPREC="$OPTPREC -i4 -r8 -DNC_DOUBLE"; fi530 if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -i4 -r8 -DNC_DOUBLE"; fi 536 531 OPTIM="-auto -align all -O2 -fp-model strict -xHost " 537 532 OPTIMGCM="$OPTIM $OPTPREC" … … 540 535 541 536 542 mkdir -p $MODEL543 echo $MODEL544 MODEL= `( cd $MODEL ; pwd )`# to get absolute path, if necessary545 546 547 if [ "$check_linux" = 1 ]; then548 echo '################################################################'549 echo Check if required software is available550 echo '################################################################'537 mkdir -p "$MODEL" 538 echo "$MODEL" 539 MODEL=$( cd "$MODEL"; pwd ) # to get absolute path, if necessary 540 541 542 if [[ "$check_linux" = 1 ]]; then 543 echo "################################################################" 544 echo "Check if required software is available" 545 echo "################################################################" 551 546 552 547 #### Ehouarn: test if the required shell is available 553 #### Maj FH-LF-AS 2021-04 : default=bash 548 #### Maj FH-LF-AS 2021-04 : default=bash; if bash missing, use ksh 554 549 use_shell="bash" # default 555 if [ "`which bash`" = "" ]; then556 echo "no bash 550 if [[ $(which bash) = "" ]]; then 551 echo "no bash; we will use ksh" 557 552 use_shell="ksh" 558 if [ "`which ksh`" = "" ]; then553 if [[ $(which ksh) = "" ]]; then 559 554 echo "bash (or ksh) needed!! Install it!" 560 exit 561 fi 562 fi 563 564 for logiciel in wget tar gzip make $compiler gcc cmake m4 c++ 565 if [ "`which $logiciel`" = "" ]; then566 echo You must first install $logiciel on your system567 exit 555 exit 1 556 fi 557 fi 558 559 for logiciel in wget tar gzip make $compiler gcc cmake m4 c++; do 560 if [[ $(which $logiciel) = "" ]]; then 561 echo "You must first install $logiciel on your system" 562 exit 1 568 563 fi 569 564 done 570 565 571 if [ $pclinux = 1 ]; then572 cd $MODEL566 if [[ $pclinux = 1 ]]; then 567 cd "$MODEL" 573 568 cat <<eod > tt.f90 574 569 print*,'coucou' 575 570 end 576 571 eod 577 $compiler tt.f90 -oa.out572 $compiler tt.f90 || a.out 578 573 ./a.out >| tt 579 if [ "`cat tt | sed -e 's/ //g' `" != "coucou" ]; then580 echo problem installing with compiler $compiler ; exit; fi574 if [[ $(< tt sed -e 's/ //g' ) != "coucou" ]]; then 575 echo "problem installing with compiler $compiler"; exit 1; fi 581 576 \rm tt a.out tt.f90 582 577 fi … … 584 579 585 580 ########################################################################### 586 if [ $getlmdzor = 1 -a ! -d $MODEL/modipsl ]; then581 if [[ $getlmdzor = 1 && ! -d $MODEL/modipsl ]]; then 587 582 ########################################################################### 588 echo '##########################################################'589 echo Download a slightly modified version of LMDZ590 echo '##########################################################'591 cd $MODEL592 getlog= `pwd`/get.log593 echo logfile : $getlog594 myget src_archives/$trusting/modipsl.$version.tar.gz>> get.log 2>&1595 echo install_lmdz.sh wget_OK `date`596 gunzip modipsl.$version.tar.gz>> get.log 2>&1597 tar xf modipsl.$version.tar>> get.log 2>&1598 \rm modipsl.$version.tar583 echo "##########################################################" 584 echo "Download a slightly modified version of LMDZ" 585 echo "##########################################################" 586 cd "$MODEL" 587 getlog=$(pwd)/get.log 588 echo logfile : "$getlog" 589 myget "src_archives/$trusting/modipsl.$version.tar.gz" >> get.log 2>&1 590 echo install_lmdz.sh wget_OK "$(date)" 591 gunzip "modipsl.$version.tar.gz" >> get.log 2>&1 592 tar xf "modipsl.$version.tar" >> get.log 2>&1 593 \rm "modipsl.$version.tar" 599 594 fi 600 595 … … 603 598 ########################################################################### 604 599 605 if [ $netcdf = 0 ]; then600 if [[ $netcdf = 0 ]]; then 606 601 ncdfdir=/usr 607 602 608 603 else 609 cd $MODEL604 cd "$MODEL" 610 605 611 606 case $compiler in 612 gfortran) opt1="-compiler gnu" ; opt2="-CC gcc -FC gfortran -CXX g++";;613 ifort) opt1="-compiler intel" ; opt2="-CC icc -FC ifort -CXX icpc";;614 pgf90) opt1="-compiler pgf90" ; opt2="-CC pgcc -FC pgf90 -CXX pgCC";;615 *) echo "unexpected compiler $compiler" for netcdf 607 gfortran) opt1="-compiler gnu"; opt2="-CC gcc -FC gfortran -CXX g++";; 608 ifort) opt1="-compiler intel"; opt2="-CC icc -FC ifort -CXX icpc";; 609 pgf90) opt1="-compiler pgf90"; opt2="-CC pgcc -FC pgf90 -CXX pgCC";; 610 *) echo "unexpected compiler $compiler" for netcdf; exit 1 616 611 esac 617 612 … … 619 614 n) script_install_netcdf=install_netcdf4_hdf5_seq.bash 620 615 ncdfdir=netcdf4_hdf5_seq 621 opt_=$opt1 616 opt_=$opt1;; 622 617 y) script_install_netcdf=install_netcdf4_hdf5.bash 623 618 ncdfdir=netcdf4_hdf5 624 opt_="$opt2 -MPI $root_mpi" 625 *) echo with_xios=$with_xios, should be n or y 619 opt_="$opt2 -MPI $root_mpi";; 620 *) echo with_xios=$with_xios, should be n or y; exit 1 626 621 esac 627 if [ $netcdf = 1 ]; then622 if [[ $netcdf = 1 ]]; then 628 623 ncdfdir=$MODEL/$ncdfdir 629 624 else 630 mkdir -p $netcdf 625 mkdir -p $netcdf; ncdfdir=$netcdf/$ncdfdir 631 626 fi 632 627 633 echo Repertoire netcdf $ncdfdir634 if [ ! -d $ncdfdir ]; then635 netcdflog= `pwd`/netcdf.log636 echo '----------------------------------------------------------'637 echo Compiling the Netcdf library638 echo '----------------------------------------------------------'639 echo log file : $netcdflog640 myget script_install/$script_install_netcdf >> $netcdflog2>&1628 echo "Repertoire netcdf $ncdfdir" 629 if [[ ! -d $ncdfdir ]]; then 630 netcdflog=$(pwd)/netcdf.log 631 echo "----------------------------------------------------------" 632 echo "Compiling the Netcdf library" 633 echo "----------------------------------------------------------" 634 echo "log file : $netcdflog" 635 myget script_install/$script_install_netcdf >> "$netcdflog" 2>&1 641 636 chmod u=rwx $script_install_netcdf 642 ./$script_install_netcdf -prefix $ncdfdir $opt_ >> $netcdflog 2>&1 637 # shellcheck disable=SC2086 638 ./$script_install_netcdf -prefix "$ncdfdir" $opt_ >> "$netcdflog" 2>&1 643 639 fi 644 640 645 641 #---------------------------------------------------------------------------- 646 642 # LF rajout d'une verrue, pour une raison non encore expliquee, 647 # la librairie est parfois rang ée dans lib64 et non dans lib643 # la librairie est parfois rang�e dans lib64 et non dans lib 648 644 # par certains compilateurs 649 if [ ! -e lib -a -d lib64 ]; then ln -s lib64 lib; fi645 if [[ ! -e lib && -d lib64 ]]; then ln -s lib64 lib; fi 650 646 #---------------------------------------------------------------------------- 651 647 652 echo install_lmdz.sh netcdf_OK `date`648 echo install_lmdz.sh netcdf_OK "$(date)" 653 649 654 650 fi … … 660 656 EOF 661 657 662 $compiler -I$ncdfdir/include test_netcdf90.f90 -L$ncdfdir/lib -lnetcdff \ 663 -lnetcdf -Wl,-rpath=$ncdfdir/lib && ./a.out 664 665 if (($? == 0)) 658 if $compiler -I"$ncdfdir"/include test_netcdf90.f90 -L"$ncdfdir"/lib -lnetcdff \ 659 -lnetcdf -Wl,-rpath="$ncdfdir"/lib && ./a.out 666 660 then 667 661 rm test_netcdf90.f90 a.out … … 677 671 fi 678 672 679 #=========================================================================680 673 if [[ ! -f $MODEL/modipsl/lib/libioipsl.a ]] 681 674 then 682 if [ $ioipsl = 1 ]; then683 #=====================================================================684 echoOK ioipsl=$ioipsl685 echo '##########################################################' 686 echo 'Installing MODIPSL, the installation package manager for the ' 687 echo 'IPSL models and tools' 688 echo '##########################################################' 689 echo `date` 690 691 cd $MODEL/modipsl675 if [[ $ioipsl = 1 ]]; then 676 cat <<EOF 677 OK ioipsl=$ioipsl 678 ########################################################## 679 Installing MODIPSL, the installation package manager for the 680 IPSL models and tools 681 ########################################################## 682 $(date) 683 EOF 684 cd "$MODEL/modipsl" 692 685 \rm -rf lib/* 693 686 cd util 694 687 cp AA_make.gdef AA_make.orig 695 688 F_C="$compiler -c " 696 if [ "$compiler" = "$gfortran" -o "$compiler" = "mpif90"]689 if [[ $compiler = "$gfortran" || $compiler = "mpif90" ]] 697 690 then 698 691 F_C="$compiler -c -cpp " 699 692 fi 700 if [ "$compiler" = "pgf90" ] ; then F_C="$compiler -c -Mpreprocess"; fi693 if [[ "$compiler" = "pgf90" ]]; then F_C="$compiler -c -Mpreprocess"; fi 701 694 sed -e 's/^\#.*.g95.*.\#.*.$/\#/' AA_make.gdef > tmp 702 695 sed -e "s:F_L = g95:F_L = $compiler:" \ … … 710 703 tmp >| AA_make.gdef 711 704 712 if [ $pcmac == 1]705 if [[ $pcmac == 1 ]] 713 706 then 714 707 cp AA_make.gdef tmp … … 718 711 719 712 # We use lines for g95 even for the other compilers to run ins_make 720 if [ "$use_shell" = "ksh" ]; then721 ./ins_make $o_ins_make713 if [[ "$use_shell" = "ksh" ]]; then 714 ./ins_make "$o_ins_make" 722 715 else # bash 723 716 sed -e s:/bin/ksh:/bin/bash:g ins_make > ins_make.bash 724 if [ "`grep jeanzay AA_make.gdef`" = "" ]; then717 if [[ $(grep jeanzay AA_make.gdef) = "" ]]; then 725 718 # Bidouille pour compiler sur ada des vieux modipsl.tar 726 719 echo 'Warning jean-zay not in AA_make.gdef' … … 730 723 731 724 chmod u=rwx ins_make.bash 732 ./ins_make.bash $o_ins_make733 fi # of if [ "$use_shell" = "ksh"]734 735 echo install_lmdz.sh MODIPSL_OK `date`736 737 cd $MODEL/modipsl/modeles/IOIPSL/src738 ioipsllog= `pwd`/ioipsl.log725 ./ins_make.bash "$o_ins_make" 726 fi # of if [[ "$use_shell" = "ksh" ]] 727 728 echo "install_lmdz.sh MODIPSL_OK $(date)" 729 730 cd "$MODEL/modipsl/modeles/IOIPSL/src" 731 ioipsllog=$(pwd)/ioipsl.log 739 732 echo '##########################################################' 740 733 echo 'Compiling IOIPSL, the interface library with Netcdf' 741 734 echo '##########################################################' 742 echo `date` 743 echo log file : $ioipsllog 744 745 if [ "$use_shell" = "bash" ] ; then 735 echo "log file : $ioipsllog $(date)" 736 737 if [[ "$use_shell" = "bash" ]]; then 746 738 cp Makefile Makefile.ksh 747 739 sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile 748 740 fi 749 ### if [ "$pclinux" = 1 ]; then741 ### if [[ "$pclinux" = 1 ]]; then 750 742 # Build IOIPSL modules and library 751 743 $make clean 752 $make > $ioipsllog2>&1753 if [ "$compiler" = "$gfortran" -o "$compiler" = "mpif90" ]; then744 $make > "$ioipsllog" 2>&1 745 if [[ $compiler = "$gfortran" || $compiler = "mpif90" ]]; then 754 746 # copy module files to lib 755 cp -f *.mod ../../../lib747 cp -f -- *.mod ../../../lib 756 748 fi 757 749 # Build IOIPSL tools (ie: "rebuild", if present) 758 759 760 if [ -f $MODEL/modipsl/modeles/IOIPSL/tools/rebuild ]; then750 # For IOIPSLv_2_2_2, "rebuild" files are in IOIPSL/tools 751 rebuild_dir="" 752 if [[ -f $MODEL/modipsl/modeles/IOIPSL/tools/rebuild ]]; then 761 753 rebuild_dir=$MODEL/modipsl/modeles/IOIPSL/tools 762 elif [ -d $MODEL/modipsl/modeles/IOIPSL/rebuild ]; then754 elif [[ -d $MODEL/modipsl/modeles/IOIPSL/rebuild ]]; then 763 755 rebuild_dir=$MODEL/modipsl/modeles/IOIPSL/rebuild 764 756 fi 765 if [ $rebuild_dir != "" ]; then766 cd $rebuild_dir757 if [[ $rebuild_dir != "" ]]; then 758 cd "$rebuild_dir" 767 759 # adapt Makefile & rebuild script if in bash 768 if [ "$use_shell" = "bash" ]; then760 if [[ "$use_shell" = "bash" ]]; then 769 761 cp Makefile Makefile.ksh 770 762 sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile … … 775 767 fi 776 768 $make clean 777 $make > $ioipsllog2>&1778 fi 779 ### fi # of if [ "$pclinux" = 1] which is commented out780 781 else # of if [ $ioipsl = 1]782 if [ ${hostname:0:5} = jean- ]; then783 cd $MODEL/modipsl769 $make > "$ioipsllog" 2>&1 770 fi 771 ### fi # of if [[ "$pclinux" = 1 ]] which is commented out 772 773 else # of if [[ $ioipsl = 1 ]] 774 if [[ ${hostname:0:5} = jean- ]]; then 775 cd "$MODEL/modipsl" 784 776 cd util 785 if [ "`grep jeanzay AA_make.gdef`" = "" ]; then777 if [[ $(grep jeanzay AA_make.gdef) = "" ]]; then 786 778 echo 'Warning jean-zay not in AA_make.gdef' 787 779 echo 'Think about updating' 788 780 exit 1 789 781 fi 790 ./ins_make $o_ins_make782 ./ins_make "$o_ins_make" 791 783 # Compile IOIPSL on jean-zay 792 cd $MODEL/modipsl/modeles/IOIPSL/src784 cd "$MODEL/modipsl/modeles/IOIPSL/src" 793 785 gmake > ioipsl.log 794 786 # For IOIPSLv_2_2_2, "rebuild" files are in IOIPSL/tools, so "gmake" in IOIPSL/tools is enough 795 787 # For IOIPSLv_2_2_5, "rebuild" files are in a separate IOIPSL/rebuild folder , while "tools" only contains "FCM" 796 if [ -f $MODEL/modipsl/modeles/IOIPSL/tools/Makefile ]; then797 cd $MODEL/modipsl/modeles/IOIPSL/tools788 if [[ -f $MODEL/modipsl/modeles/IOIPSL/tools/Makefile ]]; then 789 cd "$MODEL/modipsl/modeles/IOIPSL/tools" 798 790 gmake > ioipsl.log 799 791 fi 800 if [ -d $MODEL/modipsl/modeles/IOIPSL/rebuild ]; then801 cd $MODEL/modipsl/modeles/IOIPSL/rebuild792 if [[ -d $MODEL/modipsl/modeles/IOIPSL/rebuild ]]; then 793 cd "$MODEL/modipsl/modeles/IOIPSL/rebuild" 802 794 gmake > ioipsl.log 803 795 fi 804 796 805 797 fi 806 echo install_lmdz.sh ioipsl_OK `date`807 fi # of if [ $ioipsl = 1]798 echo "install_lmdz.sh ioipsl_OK $(date)" 799 fi # of if [[ $ioipsl = 1 ]] 808 800 fi # of if [[ ! -f $MODEL/modipsl/lib/libioipsl.a ]] 809 801 810 802 #========================================================================= 811 if [ "$with_xios" = "y" ]; then803 if [[ "$with_xios" = "y" ]]; then 812 804 echo '##########################################################' 813 805 echo 'Compiling XIOS' 814 806 echo '##########################################################' 815 cd $MODEL/modipsl/modeles816 xioslog= `pwd`/xios.log807 cd "$MODEL/modipsl/modeles" 808 xioslog="$(pwd)/xios.log" 817 809 #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/install_xios.bash 818 810 myget script_install/install_xios.bash 819 811 chmod u=rwx install_xios.bash 820 812 # following will be recalculated later on once LMDZ is updated 821 # mysvn=`svnversion LMDZ | egrep -o"[0-9]+" 2>/dev/null`822 mysvn= `grep 'Revision: [0-9]' $MODEL/Read*.md | awk ' { print $2 } ' 2>/dev/null`823 if [ "$svn" != "" ] ; then mysvn=$svn ; fi824 echo mysvn $mysvn825 826 if [ ${hostname:0:5} = jean- ]; then827 if [ $mysvn -ge 4619 ]; then813 # mysvn=`svnversion LMDZ | egrep || "[0-9]+" 2>/dev/null` 814 mysvn=$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null) 815 if [[ $svn != "" ]]; then mysvn=$svn; fi 816 echo "mysvn $mysvn" 817 818 if [[ ${hostname:0:5} = jean- ]]; then 819 if [[ $mysvn -ge 4619 ]]; then 828 820 svn co http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.6 \ 829 821 XIOS … … 835 827 svn update 836 828 cd .. 837 echo "Compiling XIOS, start" `date` \ 838 "(it takes about 20 min on Jean-Zay)" 829 echo "Compiling XIOS, start $(date) (it takes about 20 min on Jean-Zay)" 839 830 echo "log file: $xioslog" 840 831 ./make_xios --prod --arch $arch --job 4 > xios.log 2>&1 841 832 else 842 ./install_xios.bash -prefix $MODEL/modipsl/modeles\843 -netcdf ${ncdfdir} -hdf5 ${ncdfdir}\844 -MPI $root_mpi-arch $arch > xios.log 2>&1833 ./install_xios.bash -prefix "$MODEL/modipsl/modeles" \ 834 -netcdf "$ncdfdir" -hdf5 "$ncdfdir" \ 835 -MPI "$root_mpi" -arch $arch > xios.log 2>&1 845 836 fi # of case Jean-Zay 846 if [ -f XIOS/lib/libxios.a ]; then837 if [[ -f XIOS/lib/libxios.a ]]; then 847 838 echo "XIOS library successfully generated" 848 echo install_lmdz.sh XIOS_OK `date`839 echo install_lmdz.sh XIOS_OK "$(date)" 849 840 fi 850 841 fi … … 852 843 #============================================================================ 853 844 veget_version=false 854 if [ "$veget" != 'NONE' ]; then855 cd $MODEL/modipsl/modeles/ORCHIDEE856 set +e ; svn upgrade; set -e857 if [ "$veget" = "CMIP6" ]; then845 if [[ "$veget" != 'NONE' ]]; then 846 cd "$MODEL/modipsl/modeles/ORCHIDEE" 847 set +e; svn upgrade; set -e 848 if [[ "$veget" = "CMIP6" ]]; then 858 849 veget_version=orchidee2.0 859 850 orchidee_rev=6592 … … 861 852 veget_version=orchidee2.1 862 853 orchidee_rev=$veget 863 if [ $veget -lt 4465 ]; then854 if [[ $veget -lt 4465 ]]; then 864 855 echo 'Stopping, ORCHIDEE version too old, script needs work on ' \ 865 856 'the CPP flags to pass to makelmdz' … … 868 859 set +e 869 860 # which branch is my version on? 870 orcbranch= `svn log -v -q svn://forge.ipsl.jussieu.fr/orchidee/ -r $veget |grep ORCHIDEE |head -1| sed -e 's:ORCHIDEE/.*$:ORCHIDEE:' | awk '{print $2}'`861 orcbranch=$(svn log -v -q svn://forge.ipsl.jussieu.fr/orchidee/ -r "$veget" |grep ORCHIDEE |head -1| sed -e 's:ORCHIDEE/.*$:ORCHIDEE:' | awk '{print $2}') 871 862 # switch to that branch 872 863 echo IF YOU INSTALL ORCHIDEE THE VERY FIRST TIME, ASK for PASSWORD at \ 873 864 orchidee-help@listes.ipsl.fr 874 svn switch -r $veget --accept theirs-full \ 875 svn://forge.ipsl.jussieu.fr/orchidee/$orcbranch 876 svn log -r $veget | grep $veget 877 if [ $? -gt 0 ] ; then 878 echo 'Cannot update ORCHIDEE as not on the right branch for ' \ 879 'ORCHIDEE' 880 exit 865 svn switch -r "$veget" --accept theirs-full "svn://forge.ipsl.jussieu.fr/orchidee/$orcbranch" 866 if ! (svn log -r "$veget" | grep "$veget"); then 867 echo 'Cannot update ORCHIDEE as not on the right branch for ORCHIDEE' 868 exit 1 881 869 fi 882 870 set -e 883 set +e ; svn update -r $veget; set -e871 set +e; svn update -r "$veget"; set -e 884 872 fi 885 873 # Correctif suite debug Jean-Zay 886 874 sed -i -e 's/9010 FORMAT(A52,F17.14)/9010 FORMAT(A52,F20.14)/' \ 887 875 src_stomate/stomate.f90 888 opt_orc="-prod" ; if [ "$optim" = "-debug" ] ; then opt_orc="-debug"; fi889 890 orchideelog= `pwd`/orchidee.log876 opt_orc="-prod"; if [[ "$optim" = "-debug" ]]; then opt_orc="-debug"; fi 877 878 orchideelog=$(pwd)/orchidee.log 891 879 echo '########################################################' 892 880 echo 'Compiling ORCHIDEE, the continental surface model ' 893 881 echo '########################################################' 894 echo Start of the first compilation of orchidee, in sequential mode: `date` 895 echo log file : $orchideelog 896 897 export ORCHPATH=`pwd` 882 echo "Start of the first compilation of orchidee, in sequential mode: $(date)" 883 echo "log file : $orchideelog" 884 885 ORCHPATH=$(pwd) 886 export ORCHPATH=$ORCHPATH 898 887 xios_orchid="-noxios" 899 if [ "$with_xios" = "y" ]; then888 if [[ "$with_xios" = "y" ]]; then 900 889 xios_orchid="-xios" 901 890 fi 902 if [ -d tools ]; then891 if [[ -d tools ]]; then 903 892 ################################################################### 904 893 # Pour les experts qui voudraient changer de version d'orchidee. … … 906 895 907 896 # Correctif suite debug Jean-Zay 908 if [ -f src_global/time.f90 ]; then897 if [[ -f src_global/time.f90 ]]; then 909 898 sed -i -e 's/CALL tlen2itau/\!CALL tlen2itau/' src_global/time.f90 910 899 fi 911 900 ################################################################### 912 if [ "$veget_version" == "false" ]; then901 if [[ "$veget_version" == "false" ]]; then 913 902 veget_version=orchidee2.0 914 903 fi 915 904 cd arch 916 sed -e s:"%COMPILER .*.$ ":"%COMPILER $compiler":1 \917 -e s:"%LINK .*.$ ":"%LINK $compiler":1 \918 -e s:"%FPP_FLAGS .*.$ ":"%FPP_FLAGS $fpp_flags":1 \919 -e s:"%PROD_FFLAGS .*.$ ":"%PROD_FFLAGS $OPTIM":1 \920 -e s:"%DEV_FFLAGS .*.$ ":"%DEV_FFLAGS $OPTDEV":1 \921 -e s:"%DEBUG_FFLAGS .*.$ ":"%DEBUG_FFLAGS $OPTDEB":1 \922 -e s:"%BASE_FFLAGS .*.$ ":"%BASE_FFLAGS $OPTPREC":1 \923 -e s:"%BASE_LD .*.$ ":"%BASE_LD $BASE_LD":1 \924 -e s:"%ARFLAGS .*.$ ":"%ARFLAGS $ARFLAGS":1 \905 sed -e s:"%COMPILER .*.$:%COMPILER $compiler":1 \ 906 -e s:"%LINK .*.$:%LINK $compiler":1 \ 907 -e s:"%FPP_FLAGS .*.$:%FPP_FLAGS $fpp_flags":1 \ 908 -e s:"%PROD_FFLAGS .*.$:%PROD_FFLAGS $OPTIM":1 \ 909 -e s:"%DEV_FFLAGS .*.$:%DEV_FFLAGS $OPTDEV":1 \ 910 -e s:"%DEBUG_FFLAGS .*.$:%DEBUG_FFLAGS $OPTDEB":1 \ 911 -e s:"%BASE_FFLAGS .*.$:%BASE_FFLAGS $OPTPREC":1 \ 912 -e s:"%BASE_LD .*.$:%BASE_LD $BASE_LD":1 \ 913 -e s:"%ARFLAGS .*.$:%ARFLAGS $ARFLAGS":1 \ 925 914 arch-gfortran.fcm > arch-local.fcm 926 echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdff -lnetcdf\"" \ 927 > arch-local.path 928 echo "NETCDF_INCDIR=${ncdfdir}/include" >> arch-local.path 929 echo "IOIPSL_INCDIR=$ORCHPATH/../../lib" >> arch-local.path 930 echo "IOIPSL_LIBDIR=$ORCHPATH/../../lib" >> arch-local.path 931 echo 'XIOS_INCDIR=${ORCHDIR}/../XIOS/inc' >> arch-local.path 932 echo 'XIOS_LIBDIR="${ORCHDIR}/../XIOS/lib -lxios"' >> arch-local.path 915 cat <<EOF > arch-local.path 916 NETCDF_LIBDIR="-L$ncdfdir/lib -lnetcdff -lnetcdf" 917 NETCDF_INCDIR="$ncdfdir/include" 918 IOIPSL_INCDIR="$ORCHPATH/../../lib" 919 IOIPSL_LIBDIR="$ORCHPATH/../../lib" 920 XIOS_INCDIR="\$ORCHDIR/../XIOS/inc" 921 XIOS_LIBDIR="\$ORCHDIR/../XIOS/lib -lxios" 922 EOF 933 923 cd ../ 934 924 … … 936 926 -arch $arch 937 927 ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc -parallel none \ 938 -arch $arch > $orchideelog2>&1928 -arch $arch > "$orchideelog" 2>&1 939 929 pwd 940 else # of "if [ -d tools]"941 if [ -d src_parallel ]; then930 else # of "if [[ -d tools ]]" 931 if [[ -d src_parallel ]]; then 942 932 liste_src="parallel parameters global stomate sechiba driver" 943 if [ "$veget_version" == "false" ]; then933 if [[ "$veget_version" == "false" ]]; then 944 934 veget_version=orchidee2.0 945 935 fi 946 936 fi 947 for d in $liste_src 937 for d in $liste_src; do 948 938 src_d=src_$d 949 echo src_d $src_d950 echo ls 951 if [ ! -d $src_d ]; then952 echo Problem orchidee : no $src_d ; exit939 echo src_d "$src_d" 940 echo ls; ls 941 if [[ ! -d $src_d ]]; then 942 echo "Problem orchidee : no $src_d"; exit 1 953 943 fi 954 cd $src_d ; \rm -f *.mod make; $make clean955 $make > $orchideelog2>&1956 if [ "$compiler" = "$gfortran" -o "$compiler" = "mpif90" ]; then957 cp -f *.mod ../../../lib944 cd "$src_d"; \rm -f -- *.mod make; $make clean 945 $make > "$orchideelog" 2>&1 946 if [[ "$compiler" = "$gfortran" || "$compiler" = "mpif90" ]]; then 947 cp -f -- *.mod ../../../lib 958 948 fi 959 949 cd .. 960 950 done 961 fi # of "if [ -d tools]"962 echo install_lmdz.sh orchidee_compil_seq_OK `date`963 fi # of if [ "$veget" != 'NONE']951 fi # of "if [[ -d tools ]]" 952 echo "install_lmdz.sh orchidee_compil_seq_OK $(date)" 953 fi # of if [[ "$veget" != 'NONE' ]] 964 954 965 955 966 956 #============================================================================ 967 957 # Ehouarn: the directory name LMDZ* depends on version/tar file... 968 if [ -d $MODEL/modipsl/modeles/LMD* ]; then958 if [[ -d $MODEL/modipsl/modeles/LMD* ]]; then 969 959 echo '###############################################################' 970 960 echo 'Preparing LMDZ compilation : arch file, svn switch if needed...' 971 961 echo '###############################################################' 972 cd $MODEL/modipsl/modeles/LMD*973 LMDZPATH= `pwd`962 cd "$MODEL/modipsl/modeles/"LMD* 963 LMDZPATH=$(pwd) 974 964 else 975 965 echo "ERROR: No LMD* directory !!!" 976 exit 966 exit 1 977 967 fi 978 968 … … 984 974 985 975 986 cd $MODEL/modipsl/modeles/LMDZ*987 lmdzlog= `pwd`/lmdz.log976 cd "$MODEL/modipsl/modeles"/LMDZ* 977 lmdzlog=$(pwd)/lmdz.log 988 978 989 979 ################################################################## … … 991 981 ################################################################## 992 982 993 set +e ; svn upgrade ; set -e 994 995 if [ "$svn" = "last" ] ; then svnopt="" ; else svnopt="-r $svn" ; fi 996 if [ "$svn" != "" ] ; then 997 set +e ; svn info | grep -q 'https:' 998 if [ $? = 0 ] ; then 983 set +e; svn upgrade; set -e 984 985 if [[ $svn = "last" ]]; then svnopt=""; else svnopt="-r $svn"; fi 986 if [[ $svn != "" ]]; then 987 if set +e; svn info | grep -q 'https:'; then 999 988 svn switch --relocate https://svn.lmd.jussieu.fr/LMDZ \ 1000 989 http://svn.lmd.jussieu.fr/LMDZ 1001 990 fi 1002 svn update $svnopt991 svn update "$svnopt" 1003 992 set -e 1004 993 fi … … 1012 1001 #--------------------------------------------------------------------- 1013 1002 1014 set +e ; mysvn=`svnversion . | egrep -o "[0-9]+" 2>/dev/null`; set -e1015 if [ "$mysvn" = "" ] ; then mysvn=`grep 'Revision: [0-9]' $MODEL/Read*.md | awk ' { print $2 } ' 2>/dev/null`; fi1016 if [ "$mysvn" = "" ] ; then mysvn=4190; fi1017 1018 if [[ "$pclinux" = "1" && ! -f arch/arch-local.path ]] 1003 set +e; mysvn=$(svnversion . | grep -E || "[0-9]+" 2>/dev/null); set -e 1004 if [[ "$mysvn" = "" ]]; then mysvn=$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null); fi 1005 if [[ "$mysvn" = "" ]]; then mysvn=4190; fi 1006 1007 if [[ "$pclinux" = "1" && ! -f arch/arch-local.path ]]; then 1019 1008 1020 1009 # create local 'arch' files (if on Linux PC): … … 1022 1011 # arch-local.path file 1023 1012 # test for version as arch.pth file changed format with rev 4426 1024 if [ "$mysvn" -gt 4425 ] ; then 1025 echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib \"" > arch-local.path 1026 echo "NETCDF_LIB=\"-lnetcdff -lnetcdf\"" >> arch-local.path 1027 echo "NETCDF_INCDIR=-I${ncdfdir}/include" >> arch-local.path 1028 echo 'NETCDF95_INCDIR=-I$LMDGCM/../../include' >> arch-local.path 1029 echo 'NETCDF95_LIBDIR=-L$LMDGCM/../../lib' >> arch-local.path 1030 echo 'NETCDF95_LIB=-lnetcdf95' >> arch-local.path 1031 echo 'IOIPSL_INCDIR=-I$LMDGCM/../../lib' >> arch-local.path 1032 echo 'IOIPSL_LIBDIR=-L$LMDGCM/../../lib' >> arch-local.path 1033 echo 'IOIPSL_LIB=-lioipsl' >> arch-local.path 1034 echo 'XIOS_INCDIR=-I$LMDGCM/../XIOS/inc' >> arch-local.path 1035 echo 'XIOS_LIBDIR=-L$LMDGCM/../XIOS/lib' >> arch-local.path 1036 echo "XIOS_LIB=\"-lxios -lstdc++\"" >> arch-local.path 1037 echo 'ORCH_INCDIR=-I$LMDGCM/../../lib' >> arch-local.path 1038 echo 'ORCH_LIBDIR=-L$LMDGCM/../../lib' >> arch-local.path 1013 if [[ "$mysvn" -gt 4425 ]]; then 1014 cat <<EOF > arch-local.path 1015 NETCDF_LIBDIR="-L$ncdfdir/lib" 1016 NETCDF_LIB="-lnetcdff -lnetcdf\" 1017 NETCDF_INCDIR=-I$ncdfdir/include 1018 NETCDF95_INCDIR=-I\$LMDGCM/../../include 1019 NETCDF95_LIBDIR=-L\$LMDGCM/../../lib 1020 NETCDF95_LIB=-lnetcdf95 1021 IOIPSL_INCDIR=-I\$LMDGCM/../../lib 1022 IOIPSL_LIBDIR=-L\$LMDGCM/../../lib 1023 IOIPSL_LIB=-lioipsl 1024 XIOS_INCDIR=-I\$LMDGCM/../XIOS/inc 1025 XIOS_LIBDIR=-L\$LMDGCM/../XIOS/lib 1026 XIOS_LIB="-lxios -lstdc++" 1027 ORCH_INCDIR=-I\$LMDGCM/../../lib 1028 ORCH_LIBDIR=-L\$LMDGCM/../../lib 1029 EOF 1039 1030 else 1040 echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdff -lnetcdf\"" \ 1041 > arch-local.path 1042 echo "NETCDF_INCDIR=-I${ncdfdir}/include" >> arch-local.path 1043 echo 'NETCDF95_INCDIR=$LMDGCM/../../include' >> arch-local.path 1044 echo 'NETCDF95_LIBDIR=$LMDGCM/../../lib' >> arch-local.path 1045 echo 'IOIPSL_INCDIR=$LMDGCM/../../lib' >> arch-local.path 1046 echo 'IOIPSL_LIBDIR=$LMDGCM/../../lib' >> arch-local.path 1047 echo 'XIOS_INCDIR=$LMDGCM/../XIOS/inc' >> arch-local.path 1048 echo 'XIOS_LIBDIR=$LMDGCM/../XIOS/lib' >> arch-local.path 1049 echo 'ORCH_INCDIR=$LMDGCM/../../lib' >> arch-local.path 1050 echo 'ORCH_LIBDIR=$LMDGCM/../../lib' >> arch-local.path 1031 cat <<EOF > arch-local.path 1032 NETCDF_LIBDIR="-L$ncdfdir/lib -lnetcdff -lnetcdf" 1033 NETCDF_INCDIR=-I$ncdfdir/include 1034 NETCDF95_INCDIR=\$LMDGCM/../../include 1035 NETCDF95_LIBDIR=\$LMDGCM/../../lib 1036 IOIPSL_INCDIR=\$LMDGCM/../../lib 1037 IOIPSL_LIBDIR=\$LMDGCM/../../lib 1038 XIOS_INCDIR=\$LMDGCM/../XIOS/inc 1039 XIOS_LIBDIR=\$LMDGCM/../XIOS/lib 1040 ORCH_INCDIR=\$LMDGCM/../../lib 1041 ORCH_LIBDIR=\$LMDGCM/../../lib 1042 EOF 1051 1043 fi 1052 1044 1053 if [ $pcmac == 1 ]; then1045 if [[ $pcmac == 1 ]]; then 1054 1046 BASE_LD="$BASE_LD -Wl,-rpath,${ncdfdir}/lib" 1055 1047 else … … 1058 1050 # Arch-local.fcm file (adapted from arch-linux-32bit.fcm) 1059 1051 1060 if [ $real = r8 ] ; then FPP_DEF=NC_DOUBLE ; else FPP_DEF=""; fi1061 sed -e s:"%COMPILER .*.$ ":"%COMPILER $compiler":1 \1062 -e s:"%LINK .*.$ ":"%LINK $compiler":1 \1063 -e s:"%PROD_FFLAGS .*.$ ":"%PROD_FFLAGS $OPTIM":1 \1064 -e s:"%DEV_FFLAGS .*.$ ":"%DEV_FFLAGS $OPTDEV":1 \1065 -e s:"%DEBUG_FFLAGS .*.$ ":"%DEBUG_FFLAGS $OPTDEB":1 \1066 -e s:"%BASE_FFLAGS .*.$ ":"%BASE_FFLAGS $OPTPREC":1 \1067 -e s:"%FPP_DEF .*.$ ":"%FPP_DEF $FPP_DEF":1 \1068 -e s:"%BASE_LD .*.$ ":"%BASE_LD $BASE_LD":1 \1069 -e s:"%ARFLAGS .*.$ ":"%ARFLAGS $ARFLAGS":1 \1052 if [[ $real = r8 ]]; then FPP_DEF=NC_DOUBLE; else FPP_DEF=""; fi 1053 sed -e s:"%COMPILER .*.$:%COMPILER $compiler":1 \ 1054 -e s:"%LINK .*.$:%LINK $compiler":1 \ 1055 -e s:"%PROD_FFLAGS .*.$:%PROD_FFLAGS $OPTIM":1 \ 1056 -e s:"%DEV_FFLAGS .*.$:%DEV_FFLAGS $OPTDEV":1 \ 1057 -e s:"%DEBUG_FFLAGS .*.$:%DEBUG_FFLAGS $OPTDEB":1 \ 1058 -e s:"%BASE_FFLAGS .*.$:%BASE_FFLAGS $OPTPREC":1 \ 1059 -e s:"%FPP_DEF .*.$:%FPP_DEF $FPP_DEF":1 \ 1060 -e s:"%BASE_LD .*.$:%BASE_LD $BASE_LD":1 \ 1061 -e s:"%ARFLAGS .*.$:%ARFLAGS $ARFLAGS":1 \ 1070 1062 arch-linux-32bit.fcm > arch-local.fcm 1071 1063 … … 1075 1067 #echo "bld::tool::SHELL $whereisthatshell" >> bld.cfg 1076 1068 1077 fi # of if [ "$pclinux" = 1]1069 fi # of if [[ "$pclinux" = 1 ]] 1078 1070 #--------------------------------------------------------------------- 1079 1071 # Option de compilation du rayonnement : depend de $mysvn ><= r4185 … … 1082 1074 1083 1075 case $rad in 1084 oldrad) iflag_rrtm=0 ; NSW=2 ; opt_rad="";;1085 rrtm) iflag_rrtm=1 1086 if [ $mysvn -le 4185 ]; then1076 oldrad) iflag_rrtm=0; NSW=2; opt_rad="";; 1077 rrtm) iflag_rrtm=1; NSW=6 1078 if [[ $mysvn -le 4185 ]]; then 1087 1079 opt_rad="-rrtm true" 1088 1080 else 1089 1081 opt_rad="-rad rrtm" 1090 fi 1091 ecrad) iflag_rrtm=2 ; NSW=6 ; opt_rad="-rad ecrad";;1092 *) echo Only oldrad rrtm ecrad for rad option ; exit1082 fi;; 1083 ecrad) iflag_rrtm=2; NSW=6; opt_rad="-rad ecrad";; 1084 *) echo "Only oldrad rrtm ecrad for rad option"; exit 1 1093 1085 esac 1094 1086 1095 if [ $mysvn -le 4185 -a $rad = "ecrad" ]; then1096 echo "ecrad only available for LMDZ rev starting with 4186 " ; exit1087 if [[ $mysvn -le 4185 && $rad = "ecrad" ]]; then 1088 echo "ecrad only available for LMDZ rev starting with 4186 "; exit 1 1097 1089 fi 1098 1090 … … 1100 1092 1101 1093 1102 if [[ ! -f libf/misc/netcdf95.F90 && ! -d $MODEL/NetCDF95-0.3 ]] 1103 then 1104 cd $MODEL 1094 if [[ ! -f libf/misc/netcdf95.F90 && ! -d $MODEL/NetCDF95-0.3 ]]; then 1095 cd "$MODEL" 1105 1096 myget src_archives/netcdf/NetCDF95-0.3.tar.gz 1106 1097 tar -xf NetCDF95-0.3.tar.gz … … 1109 1100 mkdir build 1110 1101 cd build 1111 cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH= $ncdfdir\1112 -DCMAKE_INSTALL_PREFIX= $MODEL/modipsl1102 cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$ncdfdir" \ 1103 -DCMAKE_INSTALL_PREFIX="$MODEL/modipsl" 1113 1104 make install 1114 cd $MODEL/modipsl/modeles/LMDZ*1105 cd "$MODEL/modipsl/modeles/"LMDZ* 1115 1106 fi 1116 1107 … … 1118 1109 echo "Preparing script compile.sh for LMDZ compilation" 1119 1110 echo "It will only be run automatically if bench=1/tuto" 1120 echo Here bench=$bench1111 echo "Here bench=$bench" 1121 1112 echo '##################################################################' 1122 1113 1123 if [ "$env_file" != "" ]; then1114 if [[ $env_file != "" ]]; then 1124 1115 mv arch/arch-${arch}.env arch/arch-${arch}.orig 1125 \cp -f $env_filearch/arch-${arch}.env1126 fi 1127 1128 if [ $compile_with_fcm = 1 ]; then1116 \cp -f "$env_file" arch/arch-${arch}.env 1117 fi 1118 1119 if [[ $compile_with_fcm = 1 ]]; then 1129 1120 makelmdz="makelmdz_fcm $optim -arch $arch -j 8 " 1130 1121 else … … 1133 1124 1134 1125 # sequential compilation 1135 if [ "$sequential" = 1 ]; then1126 if [[ "$sequential" = 1 ]]; then 1136 1127 echo Sequential compilation command, saved in compile.sh: 1137 1128 echo "./$makelmdz $optim $OPT_MAKELMDZ $optim $opt_rad $opt_cosp " \ … … 1140 1131 "-d ${grid_resolution} -v $veget_version gcm " > compile.sh 1141 1132 chmod +x ./compile.sh 1142 if [ $bench = 1 ]; then1143 echo install_lmdz.sh start_lmdz_seq_compilation `date`1144 echo log file: $lmdzlog1145 ./compile.sh > $lmdzlog2>&11146 echo install_lmdz.sh end_lmdz_seq_compilation `date`1133 if [[ $bench = 1 ]]; then 1134 echo "install_lmdz.sh start_lmdz_seq_compilation $(date)" 1135 echo "log file: $lmdzlog" 1136 ./compile.sh > "$lmdzlog" 2>&1 1137 echo "install_lmdz.sh end_lmdz_seq_compilation $(date)" 1147 1138 fi 1148 1139 fi # fin sequential 1149 1140 1150 1141 # compiling in parallel mode 1151 if [ $parallel != "none" ]; then1142 if [[ $parallel != "none" ]]; then 1152 1143 echo '##########################################################' 1153 1144 echo ' Parallel compile ' 1154 1145 echo '##########################################################' 1155 1146 echo "(after saving the sequential libs and binaries)" 1156 cd $MODEL/modipsl1147 cd "$MODEL/modipsl" 1157 1148 tar cf sequential.tar bin/ lib/ 1158 1149 # 1159 1150 # Orchidee 1160 1151 # 1161 cd $ORCHPATH1162 if [ -d src_parallel -a $veget != 'NONE' ]; then1152 cd "$ORCHPATH" 1153 if [[ -d src_parallel && $veget != 'NONE' ]]; then 1163 1154 cd arch 1164 1155 sed \ 1165 -e s:"%COMPILER.*.$ ":"%COMPILER $par_comp":1 \1166 -e s:"%LINK.*.$ ":"%LINK $par_comp":1 \1167 -e s:"%MPI_FFLAG.*.$ ":"%MPI_FFLAGS $MPI_FLAGS":1 \1168 -e s:"%OMP_FFLAG.*.$ ":"%OMP_FFLAGS $OMP_FLAGS":1 \1169 -e s:"%MPI_LD.*.$ ":"%MPI_LD $MPI_LD":1 \1170 -e s:"%OMP_LD.*.$ ":"%OMP_LD $OMP_LD":1 \1156 -e s:"%COMPILER.*.$:%COMPILER $par_comp":1 \ 1157 -e s:"%LINK.*.$:%LINK $par_comp":1 \ 1158 -e s:"%MPI_FFLAG.*.$:%MPI_FFLAGS $MPI_FLAGS":1 \ 1159 -e s:"%OMP_FFLAG.*.$:%OMP_FFLAGS $OMP_FLAGS":1 \ 1160 -e s:"%MPI_LD.*.$:%MPI_LD $MPI_LD":1 \ 1161 -e s:"%OMP_LD.*.$:%OMP_LD $OMP_LD":1 \ 1171 1162 arch-local.fcm > tmp.fcm 1172 1163 1173 1164 mv tmp.fcm arch-local.fcm 1174 1165 cd ../ 1175 echo Compiling ORCHIDEE in parallel mode `date`1176 echo logfile $orchideelog1166 echo "Compiling ORCHIDEE in parallel mode $(date)" 1167 echo "logfile $orchideelog" 1177 1168 echo "NOTE : to recompile it when necessary, use ./compile_orc.sh " \ 1178 1169 "in modipsl/modeles/ORCHIDEE" 1179 1170 echo ./makeorchidee_fcm -j 8 -clean $xios_orchid $opt_orc \ 1180 -parallel $parallel-arch $arch > compile_orc.sh1171 -parallel "$parallel" -arch $arch > compile_orc.sh 1181 1172 echo ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc \ 1182 -parallel $parallel-arch $arch >> compile_orc.sh1173 -parallel "$parallel" -arch $arch >> compile_orc.sh 1183 1174 echo echo Now you must also recompile LMDZ, by running ./compile.sh \ 1184 1175 in modeles/LMDZ >> compile_orc.sh 1185 1176 chmod u+x compile_orc.sh 1186 1177 ./makeorchidee_fcm -j 8 -clean $xios_orchid $opt_orc \ 1187 -parallel $parallel -arch $arch > $orchideelog2>&11188 ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc -parallel $parallel\1189 -arch $arch >> $orchideelog2>&11190 echo End of ORCHIDEE compilation in parallel mode `date`1191 elif [ $veget != 'NONE' ]; then1178 -parallel "$parallel" -arch $arch > "$orchideelog" 2>&1 1179 ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc -parallel "$parallel" \ 1180 -arch $arch >> "$orchideelog" 2>&1 1181 echo "End of ORCHIDEE compilation in parallel mode $(date)" 1182 elif [[ $veget != 'NONE' ]]; then 1192 1183 echo '##########################################################' 1193 1184 echo ' Orchidee version too old ' 1194 1185 echo ' Please update to new version ' 1195 1186 echo '##########################################################' 1196 exit 1197 fi # of [ -d src_parallel -a$veget != 'NONE' ]1187 exit 1 1188 fi #�of [ -d src_parallel && $veget != 'NONE' ] 1198 1189 1199 1190 # LMDZ 1200 cd $LMDZPATH1201 if [ $arch = local ]; then1191 cd "$LMDZPATH" 1192 if [[ $arch = local ]]; then 1202 1193 cd arch 1203 sed -e s:"%COMPILER.*.$ ":"%COMPILER $par_comp":1 \1204 -e s:"%LINK.*.$ ":"%LINK $par_comp":1 \1205 -e s:"%MPI_FFLAG.*.$ ":"%MPI_FFLAGS $MPI_FLAGS":1 \1206 -e s:"%OMP_FFLAG.*.$ ":"%OMP_FFLAGS $OMP_FLAGS":1 \1207 -e s:"%ARFLAGS.*.$ ":"%ARFLAGS $ARFLAGS":1 \1208 -e s@"%BASE_LD.*.$"@"%BASE_LD -Wl,-rpath=${root_mpi}/lib:${ncdfdir}/lib"@1\1209 -e s:"%MPI_LD.*.$ ":"%MPI_LD $MPI_LD":1 \1210 -e s:"%OMP_LD.*.$ ":"%OMP_LD $OMP_LD":1 \1194 sed -e s:"%COMPILER.*.$:%COMPILER $par_comp":1 \ 1195 -e s:"%LINK.*.$:%LINK $par_comp":1 \ 1196 -e s:"%MPI_FFLAG.*.$:%MPI_FFLAGS $MPI_FLAGS":1 \ 1197 -e s:"%OMP_FFLAG.*.$:%OMP_FFLAGS $OMP_FLAGS":1 \ 1198 -e s:"%ARFLAGS.*.$:%ARFLAGS $ARFLAGS":1 \ 1199 -e "s§%BASE_LD.*.$§%BASE_LD -Wl,-rpath=${root_mpi}/lib:${ncdfdir}/lib§1" \ 1200 -e s:"%MPI_LD.*.$:%MPI_LD $MPI_LD":1 \ 1201 -e s:"%OMP_LD.*.$:%OMP_LD $OMP_LD":1 \ 1211 1202 arch-local.fcm > tmp.fcm 1212 1203 mv tmp.fcm arch-local.fcm … … 1214 1205 fi 1215 1206 rm -f compile.sh 1216 echo resol=${grid_resolution} >> compile.sh 1217 if [ ${hostname:0:5} = jean- -a "$cosp" = "v2" ] ; then 1218 1219 echo LMDZ compilation command in parallel mode, saved in compile.sh, \ 1220 is : 1207 echo resol="$grid_resolution" >> compile.sh 1208 if [[ ${hostname:0:5} = jean- && "$cosp" = "v2" ]]; then 1209 1210 echo "LMDZ compilation command in parallel mode, saved in compile.sh, is :" 1221 1211 echo "(ATTENTION le probleme de cospv2 sur jean-zay en mode prod " \ 1222 1212 "n est pas corrige ! )" 1223 1213 # ATTENTION le probleme de cospv2 sur jean-zay en mode prod n 1224 1214 # est pas corrige 1225 echo ./ $makelmdz -dev $optim $OPT_MAKELMDZ $opt_rad $opt_cosp\1226 $opt_makelmdz_xios-d \$resol -v $veget_version -mem \1227 -parallel $parallelgcm >> compile.sh1228 echo ./ $makelmdz -dev $optim $OPT_MAKELMDZ $opt_rad $opt_cosp\1229 $opt_makelmdz_xios-d \$resol -v $veget_version -mem \1230 -parallel $parallelgcm1215 echo ./"$makelmdz" -dev $optim "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ 1216 "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ 1217 -parallel "$parallel" gcm >> compile.sh 1218 echo ./"$makelmdz" -dev $optim "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ 1219 "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ 1220 -parallel "$parallel" gcm 1231 1221 else 1232 echo ./ $makelmdz $optim $OPT_MAKELMDZ $opt_rad $opt_cosp\1233 $opt_makelmdz_xios-d \$resol -v $veget_version -mem \1234 -parallel $parallelgcm >> compile.sh1235 echo ./ $makelmdz $optim $OPT_MAKELMDZ $opt_rad $opt_cosp\1236 $opt_makelmdz_xios-d \$resol -v $veget_version -mem \1237 -parallel $parallelgcm1222 echo ./"$makelmdz" $optim "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ 1223 "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ 1224 -parallel "$parallel" gcm >> compile.sh 1225 echo ./"$makelmdz" $optim "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ 1226 "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ 1227 -parallel "$parallel" gcm 1238 1228 fi 1239 1229 chmod +x ./compile.sh 1240 1230 1241 if [ $bench = 1 ]; then1242 echo Compiling LMDZ in parallel mode `date`, LMDZ log file: $lmdzlog1243 ./compile.sh > $lmdzlog2>&11244 fi 1245 1246 fi # of if [ $parallel != "none"]1231 if [[ $bench = 1 ]]; then 1232 echo "Compiling LMDZ in parallel mode $(date), LMDZ log file: $lmdzlog" 1233 ./compile.sh > "$lmdzlog" 2>&1 1234 fi 1235 1236 fi # of if [[ $parallel != "none" ]] 1247 1237 1248 1238 … … 1253 1243 # Recherche de l'executable dont le nom a change au fil du temps ... 1254 1244 # suffix contains radiative option starting with revision 4186 1255 if [ $mysvn -ge 4186 ] ; then suff_exe=_${rad}${suff_exe}; fi1245 if [[ $mysvn -ge 4186 ]]; then suff_exe=_${rad}${suff_exe}; fi 1256 1246 gcm="" 1257 1247 1258 1248 for exe in gcm.e bin/gcm_${grid_resolution}_phylmd${suff_exe}${suff_orc}.e 1259 1249 do 1260 if [ -f $exe ] ; then gcm=$exe; fi1250 if [[ -f $exe ]]; then gcm=$exe; fi 1261 1251 done 1262 1252 1263 if [ "$gcm" = "" ]; then1264 if [ $bench = 1 ]; then1253 if [[ "$gcm" = "" ]]; then 1254 if [[ $bench = 1 ]]; then 1265 1255 echo 'Compilation failed !! Cannot run the benchmark;' 1266 exit 1256 exit 1 1267 1257 else 1268 1258 echo 'Compilation not done (only done when bench=1)' … … 1270 1260 else 1271 1261 echo '##########################################################' 1272 echo 'Compilation successfull !! ' `date`1262 echo "Compilation successfull !! $(date)" 1273 1263 echo '##########################################################' 1274 echo The executable is $gcm1264 echo "The executable is $gcm" 1275 1265 fi 1276 1266 … … 1279 1269 ################################################################## 1280 1270 1281 if [ $bench = tuto ]; then1282 myget Training/tutorial.tar ; tar xf tutorial.tar; cd TUTORIAL1271 if [[ $bench = tuto ]]; then 1272 myget Training/tutorial.tar; tar xf tutorial.tar; cd TUTORIAL 1283 1273 ./init.sh 1284 1274 1285 elif [[ $bench = 1 && ! -d BENCH${grid_resolution} ]] 1275 elif [[ $bench = 1 && ! -d BENCH${grid_resolution} ]]; then 1286 1276 # TOUTE CETTE SECTION DEVRAIT DISPARAITRE POUR UNE COMMANDE 1287 1277 # OU DES BENCHS PAR MOTS CLES COMME tuto … … 1291 1281 echo '##########################################################' 1292 1282 1293 \rm -rf BENCH${grid_resolution}1283 \rm -rf "BENCH${grid_resolution}" 1294 1284 bench=bench_lmdz_${grid_resolution} 1295 echo install_lmdz.sh before bench download `date`1285 echo "install_lmdz.sh before bench download $(date)" 1296 1286 #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/$bench.tar.gz 1297 myget 3DBenchs/$bench.tar.gz1298 echo install_lmdz.sh after bench download `date`1299 tar xf $bench.tar.gz1300 1301 if [ "$cosp" = "v1" -o "$cosp" = "v2" ]; then1302 cd BENCH${grid_resolution}1287 myget "3DBenchs/$bench.tar.gz" 1288 echo "install_lmdz.sh after bench download $(date)" 1289 tar xf "$bench.tar.gz" 1290 1291 if [[ "$cosp" = "v1" || "$cosp" = "v2" ]]; then 1292 cd "BENCH${grid_resolution}" 1303 1293 # copier les fichiers namelist input et output our COSP 1304 1294 cp ../DefLists/cosp*_input_nl.txt . … … 1310 1300 fi 1311 1301 1312 if [ -n "$physiq"]; then1313 cd BENCH${grid_resolution}1314 if [ -f physiq.def_${physiq}]; then1315 cp physiq.def_${physiq}physiq.def1316 echo using physiq.def_${physiq}1302 if [[ -n "$physiq" ]]; then 1303 cd "BENCH${grid_resolution}" 1304 if [[ -f "physiq.def_${physiq}" ]]; then 1305 cp "physiq.def_${physiq}" physiq.def 1306 echo using "physiq.def_${physiq}" 1317 1307 else 1318 1308 echo using standard physiq.def … … 1323 1313 fi 1324 1314 1325 if [ "$with_xios" = "y" ]; then1326 cd BENCH${grid_resolution}1315 if [[ "$with_xios" = "y" ]]; then 1316 cd "BENCH${grid_resolution}" 1327 1317 cp ../DefLists/iodef.xml . 1328 1318 cp ../DefLists/context_lmdz.xml . 1329 1319 cp ../DefLists/field_def_lmdz.xml . 1330 1320 # A raffiner par la suite 1331 echo A FAIRE : Copier les *xml en fonction de l option cosp1321 echo "A FAIRE : Copier les *xml en fonction de l option cosp" 1332 1322 cp ../DefLists/field_def_cosp*.xml . 1333 1323 cp ../DefLists/file_def_hist*xml . … … 1341 1331 for histfile in file_def_hist*xml 1342 1332 do 1343 if [ "$histfile" = "file_def_histday_lmdz.xml" ]; then1333 if [[ "$histfile" = "file_def_histday_lmdz.xml" ]]; then 1344 1334 sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".TRUE."@' \ 1345 $histfile> tmp1346 \mv -f tmp $histfile1347 sed -e 's@output_level="_AUTO_"@output_level="5"@' $histfile\1335 "$histfile" > tmp 1336 \mv -f tmp "$histfile" 1337 sed -e 's@output_level="_AUTO_"@output_level="5"@' "$histfile" \ 1348 1338 > tmp 1349 \mv -f tmp $histfile1339 \mv -f tmp "$histfile" 1350 1340 sed -e 's@compression_level="2"@compression_level="0"@' \ 1351 $histfile> tmp1352 \mv -f tmp $histfile1341 "$histfile" > tmp 1342 \mv -f tmp "$histfile" 1353 1343 else 1354 1344 sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' \ 1355 $histfile> tmp1356 \mv -f tmp $histfile1345 "$histfile" > tmp 1346 \mv -f tmp "$histfile" 1357 1347 fi 1358 1348 done … … 1362 1352 1363 1353 #activer les sorties pour Cosp 1364 if [ "$cosp" = "v1" ]; then1354 if [[ "$cosp" = "v1" ]]; then 1365 1355 sed -i'' -e 's@enabled=".FALSE."@enabled=".TRUE."@' \ 1366 1356 -e 's@output_level="_AUTO_"@output_level="5"@' \ … … 1368 1358 file_def_histdayCOSP_lmdz.xml 1369 1359 fi 1370 if [ "$cosp" = "v2" ]; then1360 if [[ "$cosp" = "v2" ]]; then 1371 1361 sed -e 's@compression_level="2"@compression_level="0"@' file_def_histdayCOSPv2_lmdz.xml 1372 for type_ in hf day mth 1362 for type_ in hf day mth; do 1373 1363 file=file_def_hist${type_}COSP 1374 1364 sed -i'' -e 's@src="./'${file}'_lmdz.xml"@src="./'${file}'v2_lmdz.xml"@' context_lmdz.xml … … 1381 1371 1382 1372 # Cas Bensh avec ecrad 1383 if [ "$rad" = "ecrad" ]; then1384 cd BENCH${grid_resolution}1373 if [[ "$rad" = "ecrad" ]]; then 1374 cd "BENCH${grid_resolution}" 1385 1375 cp ../DefLists/namelist_ecrad . 1386 1376 cp -r ../libf/phylmd/ecrad/data . … … 1389 1379 1390 1380 # Adjusting bench physiq.def to radiative code chosen 1391 cd BENCH${grid_resolution}1381 cd "BENCH${grid_resolution}" 1392 1382 sed -e 's/iflag_rrtm=.*.$/iflag_rrtm='$iflag_rrtm'/' \ 1393 1383 -e 's/NSW=.*.$/NSW='$NSW'/' physiq.def > tmpdef … … 1395 1385 cd .. 1396 1386 1397 cp $gcm BENCH${grid_resolution}/gcm.e1398 1399 cd BENCH${grid_resolution}1387 cp "$gcm" "BENCH${grid_resolution}/gcm.e" 1388 1389 cd "BENCH${grid_resolution}" 1400 1390 # On cree le fichier bench.sh au besoin 1401 1391 # Dans le cas 48x36x39 le bench.sh existe deja en parallele 1402 1392 1403 if [ "$grid_resolution" = "48x36x39" ]; then1393 if [[ "$grid_resolution" = "48x36x39" ]]; then 1404 1394 echo On ne touche pas au bench.sh 1405 1395 # But we have to adapt "run_local.sh" for $mpirun … … 1407 1397 mv -f tmp run_local.sh 1408 1398 chmod u=rwx run_local.sh 1409 elif [ "${parallel:0:3}" = "mpi" ]; then1399 elif [[ "${parallel:0:3}" = "mpi" ]]; then 1410 1400 # Lancement avec deux procs mpi et 2 openMP 1411 1401 echo "export OMP_STACKSIZE=800M" > bench.sh 1412 if [ "${parallel:4:3}" = "omp" ]; then1402 if [[ "${parallel:4:3}" = "omp" ]]; then 1413 1403 echo "export OMP_NUM_THREADS=2" >> bench.sh 1414 1404 fi 1415 if [ "$cosp" = "v1" -o "$cosp" = "v2" ]; then1416 if [ ${hostname:0:5} = jean- ]; then1405 if [[ "$cosp" = "v1" || "$cosp" = "v2" ]]; then 1406 if [[ ${hostname:0:5} = jean- ]]; then 1417 1407 chmod +x ../arch.env 1418 1408 ../arch.env … … 1424 1414 echo "ulimit -s unlimited" >> bench.sh 1425 1415 fi 1426 if [ ${hostname:0:5} = jean- ]; then1416 if [[ ${hostname:0:5} = jean- ]]; then 1427 1417 . ../arch/arch-${arch}.env 1428 echo "srun -n 2 -A$idris_acct@cpu gcm.e > listing 2>&1" \1418 echo "srun -n 2 && $idris_acct@cpu gcm.e > listing 2>&1" \ 1429 1419 >> bench.sh 1430 1420 else … … 1432 1422 fi 1433 1423 # Add rebuild, using reb.sh if it is there 1434 echo 'if [ -f reb.sh ] ; then' >> bench.sh 1435 echo ' ./reb.sh histday ; ./reb.sh histmth ; ./reb.sh histhf ; ' \ 1436 './reb.sh histins ; ./reb.sh stomate_history ; ' \ 1437 './reb.sh sechiba_history ; ./reb.sh sechiba_out_2 ' >> bench.sh 1438 echo 'fi' >> bench.sh 1424 cat <<EOF >> bench.sh 1425 if [[ -f reb.sh ]]; then 1426 ./reb.sh histday; ./reb.sh histmth; ./reb.sh histhf; 1427 ./reb.sh histins; ./reb.sh stomate_history; 1428 ./reb.sh sechiba_history; ./reb.sh sechiba_out_2 1429 fi 1430 EOF 1439 1431 else 1440 1432 echo "./gcm.e > listing 2>&1" > bench.sh 1441 1433 fi 1442 1434 # Getting orchidee stuff 1443 if [ $veget == 'CMIP6' ]; then1435 if [[ $veget == 'CMIP6' ]]; then 1444 1436 #echo 'myget 3DBenchs/BENCHorch11.tar.gz' 1445 1437 #myget 3DBenchs/BENCHorch11.tar.gz … … 1450 1442 sed -e "s:VEGET=n:VEGET=y:" config.def > tmp 1451 1443 mv -f tmp config.def 1452 if [ "$with_xios" = "y" ]; then1444 if [[ "$with_xios" = "y" ]]; then 1453 1445 cp ../../ORCHIDEE/src_xml/context_orchidee.xml . 1454 1446 echo '<context id="orchidee" src="./context_orchidee.xml"/>' \ … … 1457 1449 cp ../../ORCHIDEE/src_xml/file_def_orchidee.xml . 1458 1450 cp ../../ORCHIDEE/src_xml/file_def_input_orchidee.xml . 1459 if [ -f ../../ORCHIDEE/src_xml/context_input_orchidee.xml ]; then1451 if [[ -f ../../ORCHIDEE/src_xml/context_input_orchidee.xml ]]; then 1460 1452 cp ../../ORCHIDEE/src_xml/context_input_orchidee.xml . 1461 1453 echo '<context id="orchidee" ' \ … … 1492 1484 echo EXECUTION DU BENCH 1493 1485 set +e 1494 date ; ./bench.sh > out.bench 2>&1; date1486 date; ./bench.sh > out.bench 2>&1; date 1495 1487 set -e 1496 1488 tail listing 1497 1489 1498 1490 1499 echo '##########################################################'1500 echo 'Simulation finished in' `pwd`1501 echo 'You have compiled with:'1491 echo "##########################################################" 1492 echo "Simulation finished in $(pwd)" 1493 echo "You have compiled with:" 1502 1494 cat ../compile.sh 1503 if [ $parallel = "none" ]; then1504 echo 'You may re-run it with : cd ' `pwd` ' ; gcm.e'1505 echo 'or ./bench.sh'1495 if [[ $parallel = "none" ]]; then 1496 echo "You may re-run it with : cd $(pwd) ; gcm.e" 1497 echo "or ./bench.sh" 1506 1498 else 1507 echo 'You may re-run it with : '1508 echo 'cd ' `pwd` '; ./bench.sh'1499 echo "You may re-run it with : " 1500 echo "cd $(pwd) ; ./bench.sh" 1509 1501 # echo 'ulimit -s unlimited' 1510 1502 # echo 'export OMP_NUM_THREADS=2' … … 1521 1513 ################################################################# 1522 1514 1523 if [ $SCM = 1 ]; then1524 cd $MODEL1515 if [[ $SCM = 1 ]]; then 1516 cd "$MODEL" 1525 1517 myget 1D/1D.tar.gz 1526 1518 tar xf 1D.tar.gz 1527 1519 cd 1D 1528 if [ $rad = oldrad ]; then1520 if [[ $rad = oldrad ]]; then 1529 1521 sed -i'' -e 's/^rad=.*$/rad=oldrad/' run.sh 1530 1522 sed -i'' -e 's/^rad=.*$/rad=oldrad/' bin/compile 1531 1523 fi 1532 echo Running 1D/run.sh, log in `pwd`/run1d.log1533 ./run.sh > `pwd`/run1d.log2>&11524 echo "Running 1D/run.sh, log in $(pwd)/run1d.log" 1525 ./run.sh > "$(pwd)/run1d.log" 2>&1 1534 1526 fi 1535 1527 … … 1538 1530 # sauvegarde des options veget pour utilisation eventuelle tutorial_prod 1539 1531 ################################################################# 1540 cd $MODEL/modipsl/modeles1532 cd "$MODEL/modipsl/modeles" 1541 1533 #echo surface_env file created in $MODEL 1542 echo 'veget='$veget >surface_env1543 #opt_veget="-v $veget_version" 1544 #echo 'opt_veget="'$opt_veget\" >> surface_env 1545 echo 'opt_veget="'-v $veget_version\" >> surface_env1546 echo 'orchidee_rev='$orchidee_rev >> surface_env 1547 echo 'suforch='$suff_orc >> surface_env 1534 cat <<EOF >surface_env 1535 veget=$veget 1536 opt_veget="-v $veget_version" 1537 orchidee_rev=$orchidee_rev 1538 suforch=$suff_orc 1539 EOF
Note: See TracChangeset
for help on using the changeset viewer.