- Timestamp:
- Apr 5, 2024, 4:33:57 PM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BOL/script_install_amaury/install_lmdz.sh
r4890 r4891 37 37 38 38 ### Functions 39 # TODO add make_j parallel argument -> check what is used for libigcm 39 40 40 41 function myget { # Get a file from LMDZ repository … … 50 51 function set_default_params { 51 52 # Valeur par défaut des parametres 52 53 # 04_2021 : tester si r4 marche encore !54 real="r8" # ou "r4"55 56 53 svn="" 57 54 version="20231022.trunk" 58 55 59 netcdf=1 # 1: for automatic installation; 60 # or 0: do not install NetCDF and look for it in standard locations; 61 # or absolute path: look for NetCDF there 56 netcdf=1 62 57 bench=1 63 pclinux=164 58 pcmac=0 # default: not on a Mac 65 59 SCM=0 66 # surface/vegetation scheme treatment67 # controlled by the single variable veget which can have the following values68 # - none: bucket scheme (default)69 # - CMIP6: orchidee version used in CMIP exercise, rev 566170 # - number: orchidee version number71 60 veget="none" 72 # choose the resolution for the bench runs 73 # grid_resolution= 32x24x11 or 48x36x19 for tests (test without ORCHIDEE) 74 # 96x71x19 standard configuration 75 grid_resolution="32x32x39" # "48x36x19", "96x95x39", "144x142x79" 76 # choose the physiq version you want to test 77 #physiq=NPv6.0.14splith 61 grid_resolution="32x32x39" 78 62 physiq="" 79 63 … … 81 65 xios_rev="2568" 82 66 83 ## parallel can take the values none/mpi/omp/mpi_omp 84 parallel="none" # "mpi_omp" 85 idris_acct="lmd" 67 parallel="none" 86 68 trusting="testing" 87 69 MODEL="" 88 70 89 ## also compile XIOS? (and more recent NetCDF/HDF5 libraries) Default=no 90 with_xios="n" 71 with_xios=0 91 72 opt_makelmdz_xios="" 92 73 93 ## compile with oldrad/rrtm/ecrad radiatif code (Default=rrtm)94 74 rad="rrtm" 95 75 96 ## compile_with_fcm=1 : use makelmdz_fcm (1) or makelmdz (0)97 76 compile_with_fcm=1 98 77 99 #Compilation with Cosp (cosp=none/v1/v2; default=none)100 78 cosp="none" 101 79 opt_cosp="" … … 107 85 fi 108 86 109 env_file=""110 87 optim_debug="" 111 88 arch="local" … … 192 169 "-netcdf") netcdf=$2; shift; shift;; 193 170 "-physiq") physiq=$2; shift; shift;; 194 "-xios") with_xios= "y"; shift;;171 "-xios") with_xios=1; shift;; 195 172 "-arch") arch=$2; shift; shift;; 196 173 "-arch_dir") arch_dir=$2; shift; shift;; … … 227 204 228 205 if [[ $parallel = "none" ]]; then 229 s equential=1; suff_exe='_seq'230 else 231 s equential=0; suff_exe='_para_mem'206 suff_exe='_seq' 207 else 208 suff_exe='_para_mem' 232 209 fi 233 210 … … 236 213 237 214 ## if also compiling XIOS, parallel must be mpi_omp 238 if [[ $with_xios = "y"&& $parallel != "mpi_omp" ]]; then215 if [[ $with_xios = 1 && $parallel != "mpi_omp" ]]; then 239 216 echo "Error, you must set -parallel mpi_omp if you want XIOS"; exit 1 240 217 fi 241 218 242 if [[ $with_xios = "y"]]; then219 if [[ $with_xios = 1 ]]; then 243 220 opt_makelmdz_xios="-io xios" 244 221 fi 245 222 246 if [[ $cosp = "v2" && $with_xios = "n"]]; then223 if [[ $cosp = "v2" && $with_xios = 0 ]]; then 247 224 echo "Error, Cospv2 cannot run without Xios"; exit 1 248 225 fi … … 314 291 315 292 function install_arch { 316 # TODO if [[ $(gfortran -dumpversion | cut -d. -f1) -ge 10 ]]; then allow_arg_mismatch="-fallow-argument-mismatch"; fi317 318 293 if [[ ! -d $arch_dir ]]; then 319 294 echo "Error: no arch dir $arch_dir"; exit 1 … … 337 312 # Copy arch to different components 338 313 # TODO check that this doesn't error if the source and destination are the same 339 \cp -f "$arch_dir/arch-$arch.fcm" "$MODEL/modipsl/modeles/IOIPSL/arch"340 \cp -f "$arch_dir/arch-$arch.path" "$MODEL/modipsl/modeles/IOIPSL/arch"341 \cp -f "$arch_dir/arch-$arch.fcm" "$MODEL/modipsl/modeles/ORCHIDEE/arch"342 \cp -f "$arch_dir/arch-$arch.path" "$MODEL/modipsl/modeles/ORCHIDEE/arch"314 for dir in "IOIPSL" "ORCHIDEE" "LMDZ"; do 315 \cp -f "$arch_dir/arch-$arch.fcm" "$MODEL/modipsl/modeles/$dir/arch" 316 \cp -f "$arch_dir/arch-$arch.path" "$MODEL/modipsl/modeles/$dir/arch" 317 done 343 318 344 319 # TODO TEMP compat w/ old orch version - make a proper case later … … 362 337 363 338 case $with_xios in 364 n) script_install_netcdf="install_netcdf4_hdf5_seq.bash"339 0) script_install_netcdf="install_netcdf4_hdf5_seq.bash" 365 340 ncdfdir="netcdf4_hdf5_seq" 366 341 opt_="$opt1";; 367 y) script_install_netcdf="install_netcdf4_hdf5.bash"342 1) script_install_netcdf="install_netcdf4_hdf5.bash" 368 343 ncdfdir="netcdf4_hdf5" 369 344 opt_="$opt2 -MPI $root_mpi";; 370 *) echo "with_xios=$with_xios, should be n or y"; exit 1345 *) echo "with_xios=$with_xios, should be 0 or 1"; exit 1 371 346 esac 372 347 if [[ $netcdf = 1 ]]; then … … 418 393 exit 1 419 394 fi 395 396 # Compile NetCDF95 397 cd "$MODEL/modipsl/modeles/LMD"* 398 echo "Installing NetCDF95" 399 cd "$MODEL" 400 myget src_archives/netcdf/NetCDF95-0.3.tar.gz 401 tar -xf NetCDF95-0.3.tar.gz 402 \rm NetCDF95-0.3.tar.gz 403 cd NetCDF95-0.3 404 mkdir -p build && cd build 405 netCDF_INCLUDE_DIR=$(nc-config --includedir) netCDF_LIBRARY=$(nc-config --libdir) cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$ncdfdir" -DCMAKE_INSTALL_PREFIX="$MODEL/modipsl" 406 make install 420 407 } 421 408 … … 431 418 echo "IOIPSL compiled $(date)" 432 419 433 export IOIPSL_LIBDIR="$MODEL/modipsl/modeles/IOIPSL/lib"434 export IOIPSL_INCDIR="$MODEL/modipsl/modeles/IOIPSL/inc"420 IOIPSL_LIBDIR_="$MODEL/modipsl/modeles/IOIPSL/lib" 421 IOIPSL_INCDIR_="$MODEL/modipsl/modeles/IOIPSL/inc" 435 422 } 436 423 437 424 function install_XIOS { 438 if [[ $with_xios = "y"]]; then425 if [[ $with_xios = 1 ]]; then 439 426 cd "$MODEL/modipsl/modeles" 440 427 xioslog="$(pwd)/xios.log" … … 467 454 468 455 function get_orchidee_version { # Set / Check ORCHIDEE version 469 if [[ $veget = "none" ]]; then 470 veget_version="false" 471 elif [[ $veget = "CMIP6" ]]; then 472 veget_version=orchidee2.0 473 orchidee_rev=6592 474 else # specific orchidee revision newer than CMIP6, on 2_1 or 2_2 branches 475 veget_version=orchidee2.1 476 orchidee_rev="$veget" 477 if [[ $veget -lt 4465 ]]; then 478 echo 'ORCHIDEE version must be >=4465, exiting' 479 exit 1 480 fi 456 if [[ $veget = "none" ]]; then 457 veget_version="false" 458 elif [[ $veget = "CMIP6" ]]; then 459 veget_version=orchidee2.0 460 orchidee_rev=6592 461 else # specific orchidee revision newer than CMIP6, on 2_1 or 2_2 branches 462 veget_version=orchidee2.1 463 orchidee_rev="$veget" 464 if [[ $veget -lt 4465 ]]; then 465 echo 'ORCHIDEE version must be >=4465, exiting' 466 exit 1 467 fi 468 469 set +e 470 svn upgrade 471 local orcbranch 472 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}') 473 echo "IF YOU INSTALL ORCHIDEE THE VERY FIRST TIME, ASK for PASSWORD at orchidee-help@listes.ipsl.fr" 474 svn switch -r "$veget" --accept theirs-full "svn://forge.ipsl.jussieu.fr/orchidee/$orcbranch" 475 svn log -r "$veget" | grep "$veget" 476 if ! svn log -r "$veget" | grep "$veget"; then 477 echo 'Cannot update ORCHIDEE as not on the right branch for ORCHIDEE' 478 exit 1 479 fi 480 svn update -r "$veget" 481 set -e 482 fi 483 } 484 485 function compile_orchidee { 486 get_orchidee_version 487 ORCHPATH="" 488 489 490 if [[ $veget != "none" ]]; then 491 cd "$MODEL/modipsl/modeles/ORCHIDEE" 492 ORCHPATH=$(pwd) 493 494 orchideelog="$(pwd)/orchidee.log" 495 echo "Compiling ORCHIDEE, the continental surface model (log $orchideelog) $(date)" 496 497 local xios_orchid opt_orc 498 if [[ $with_xios = 1 ]]; then 499 xios_orchid="-xios"; 500 else 501 xios_orchid="-noxios" 502 fi 503 if [[ $optim_debug = "-debug" ]]; then 504 opt_orc="-debug"; 505 else 506 opt_orc="-prod" 507 fi 508 509 # TODO check that this works with old orchidee versions (cf. -d tools) 510 local varenv="IOIPSL_LIBDIR_=$IOIPSL_LIBDIR_ IOIPSL_INCDIR_=$IOIPSL_INCDIR_ ORCHPATH=$ORCHPATH" 511 if [[ $parallel = "none" ]]; then 512 echo "$varenv ./makeorchidee_fcm $xios_orchid $opt_orc -parallel none -arch $arch -j 8" > compile.sh 513 else 514 if [[ ! -d src_parallel ]]; then 515 echo "Orchidee version too old for parallel support"; exit 1 516 fi 517 { 518 echo "$varenv ./makeorchidee_fcm -j 8 -clean $xios_orchid $opt_orc -parallel $parallel -arch $arch" 519 echo "$varenv ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc -parallel $parallel -arch $arch" 520 } > compile.sh 521 fi 522 chmod +x compile.sh 523 echo "Compiling ORCHIDEE using $(\cat compile.sh)" 524 if ! ./compile.sh > "$orchideelog" 2>&1; then 525 echo "ORCHIDEE compilation failed, exiting"; exit 1 526 fi 527 echo "Compiled ORCHIDEE $(date)" 528 fi 529 530 ORCH_LIBDIR_="$MODEL/modipsl/modeles/ORCHIDEE/lib" 531 } 532 533 function get_lmdz_version { 534 LMDZPATH=$(readlink -f "$MODEL/modipsl/modeles/LMD"*) 535 cd "$LMDZPATH" 536 lmdzlog="$(pwd)/lmdz.log" 481 537 482 538 set +e 483 539 svn upgrade 484 local orcbranch485 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}')486 e cho "IF YOU INSTALL ORCHIDEE THE VERY FIRST TIME, ASK for PASSWORD at orchidee-help@listes.ipsl.fr"487 svn switch -r "$veget" --accept theirs-full "svn://forge.ipsl.jussieu.fr/orchidee/$orcbranch"488 svn log -r "$veget" | grep "$veget"489 if ! svn log -r "$veget" | grep "$veget"; then490 echo 'Cannot update ORCHIDEE as not on the right branch for ORCHIDEE'491 exit 1492 fi 493 svn update -r "$veget"540 if [[ $svn = "last" ]]; then 541 svnopt="" 542 else 543 svnopt="-r $svn" 544 fi 545 if [[ $svn != "" ]]; then 546 if svn info | grep -q 'https:'; then svn switch --relocate https://svn.lmd.jussieu.fr/LMDZ http://svn.lmd.jussieu.fr/LMDZ; fi 547 svn update "$svnopt" 548 fi 549 mysvn=$(svnversion . | grep -E -o "[0-9]+" 2>/dev/null) 494 550 set -e 495 fi 496 } 497 498 function compile_orchidee_seq { 499 get_orchidee_version 500 501 if [[ $veget != "none" ]]; then 502 cd "$MODEL/modipsl/modeles/ORCHIDEE" 503 504 orchideelog="$(pwd)/orchidee.log" 505 echo "Compiling ORCHIDEE, the continental surface model (log $orchideelog)" 506 echo "Start of the first compilation of orchidee, in sequential mode: $(date)" 507 508 ORCHPATH=$(pwd) 509 export ORCHPATH=$ORCHPATH 510 511 local xios_orchid opt_orc 512 if [[ $with_xios = "y" ]]; then 513 xios_orchid="-xios"; 514 else 515 xios_orchid="-noxios" 516 fi 517 if [[ $optim_debug = "-debug" ]]; then 518 opt_orc="-debug"; 519 else 520 opt_orc="-prod" 521 fi 522 523 if ! ./makeorchidee_fcm "$xios_orchid" "$opt_orc" -parallel none -arch "$arch" > "$orchideelog" 2>&1; then 524 echo "ORCHIDEE seq compilation failed, exiting"; exit 1 525 fi 526 echo "Compiled ORCHIDEE seq $(date)" 527 fi 551 552 if [[ $mysvn = "" ]]; then mysvn=$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null); fi 553 if [[ $mysvn = "" ]]; then mysvn=4190; fi 554 } 555 556 function compile_lmdz { 557 get_lmdz_version 558 559 exe_name="bin/gcm_${grid_resolution}_phylmd_${rad}${suff_exe}${suff_orc}.e" 560 561 local opt_rad 562 case $rad in 563 oldrad) iflag_rrtm=0; NSW=2; opt_rad="";; 564 rrtm) iflag_rrtm=1; NSW=6 565 if [[ $mysvn -le 4185 ]]; then 566 opt_rad="-rrtm true" 567 else 568 opt_rad="-rad rrtm" 569 fi;; 570 ecrad) iflag_rrtm=2; NSW=6; opt_rad="-rad ecrad";; 571 *) echo "Only oldrad rrtm ecrad for rad option"; exit 1 572 esac 573 if [[ $mysvn -le 4185 && $rad = "ecrad" ]]; then 574 echo "ecrad only available for LMDZ rev starting with 4186 "; exit 1 575 fi 576 577 # Compile 578 local varenv="IOIPSL_LIBDIR_=$IOIPSL_LIBDIR_ IOIPSL_INCDIR_=$IOIPSL_INCDIR_ ORCH_LIBDIR_=$ORCH_LIBDIR_ ORCHPATH=$ORCHPATH" 579 makelmdz="makelmdz_fcm $optim_debug -arch $arch -j 8" 580 if [[ $parallel = "none" ]]; then 581 echo "$varenv ./$makelmdz $opt_rad $opt_cosp -d ${grid_resolution} -v $veget_version gcm " > compile.sh 582 else 583 echo "$varenv ./$makelmdz $opt_rad $opt_cosp $opt_makelmdz_xios -d ${grid_resolution} -v $veget_version -mem -parallel $parallel gcm" > compile.sh 584 fi 585 echo "Compiling lmdz using $(\cat compile.sh) (log: $lmdzlog) $(date)" 586 chmod +x ./compile.sh 587 if ! ./compile.sh > "$lmdzlog" 2>&1; then 588 echo "LMDZ compilation failed, exiting"; exit 1 589 fi 590 echo "Finished LMDZ compilation $(date)" 591 592 # Check executable 593 # TODO $mysev -ge 4186 => other name convention ! check original install 594 if [[ ! -f $exe_name ]]; then 595 echo "Compilation failed, can't find the executable"; exit 1 596 else 597 echo "Compilation successfull, the executable is $exe_name $(date)" 598 fi 599 } 600 601 function run_bench { 602 cd "$MODEL/modipsl/modeles/LMDZ"* 603 604 if [[ $bench = "tuto" ]]; then 605 myget Training/tutorial.tar; tar xf tutorial.tar; cd TUTORIAL 606 ./init.sh 607 elif [[ $bench = 1 ]]; then 608 \rm -rf "BENCH${grid_resolution}" 609 local bench=bench_lmdz_${grid_resolution} 610 myget "3DBenchs/$bench.tar.gz" 611 tar xf "$bench.tar.gz" 612 613 if [[ $cosp = "v1" || $cosp = "v2" ]]; then 614 cd "BENCH${grid_resolution}" 615 # copier les fichiers namelist input et output our COSP 616 cp ../DefLists/cosp*_input_nl.txt . 617 cp ../DefLists/cosp*_output_nl.txt . 618 # Activer la cles ok_cosp pour tourner avec COSP 619 sed -e 's@ok_cosp=n@ok_cosp=y@' config.def > tmp 620 \mv -f tmp config.def 621 cd .. 622 fi 623 624 if [[ -n "$physiq" ]]; then 625 cd "BENCH${grid_resolution}" 626 if [[ -f "physiq.def_${physiq}" ]]; then 627 cp "physiq.def_${physiq}" physiq.def 628 echo "using physiq.def_${physiq}" 629 else 630 echo "using standard physiq.def" 631 fi 632 cd .. 633 else 634 echo "using standard physiq.def" 635 fi 636 637 if [[ $with_xios = 1 ]]; then 638 cd "BENCH${grid_resolution}" 639 cp ../DefLists/iodef.xml . 640 cp ../DefLists/context_lmdz.xml . 641 cp ../DefLists/field_def_lmdz.xml . 642 # A raffiner par la suite 643 echo "A FAIRE : Copier les *xml en fonction de l option cosp" 644 cp ../DefLists/field_def_cosp*.xml . 645 cp ../DefLists/file_def_hist*xml . 646 # adapt iodef.xml to use attached mode 647 sed -e 's@"using_server" type="bool">true@"using_server" type="bool">false@' \ 648 iodef.xml > tmp 649 \mv -f tmp iodef.xml 650 651 # and convert all the enabled="_AUTO_" (for libIGCM) to enabled=.FALSE. 652 # except for histday 653 for histfile in file_def_hist*xml 654 do 655 if [[ "$histfile" = "file_def_histday_lmdz.xml" ]]; then 656 sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".TRUE."@' \ 657 "$histfile" > tmp 658 \mv -f tmp "$histfile" 659 sed -e 's@output_level="_AUTO_"@output_level="5"@' "$histfile" \ 660 > tmp 661 \mv -f tmp "$histfile" 662 sed -e 's@compression_level="2"@compression_level="0"@' \ 663 "$histfile" > tmp 664 \mv -f tmp "$histfile" 665 else 666 sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' \ 667 "$histfile" > tmp 668 \mv -f tmp "$histfile" 669 fi 670 done 671 # and add option "ok_all_xml=y" in config.def 672 echo "### XIOS outputs" >> config.def 673 echo 'ok_all_xml=.true.' >> config.def 674 675 #activer les sorties pour Cosp 676 if [[ "$cosp" = "v1" ]]; then 677 sed -i'' -e 's@enabled=".FALSE."@enabled=".TRUE."@' \ 678 -e 's@output_level="_AUTO_"@output_level="5"@' \ 679 -e 's@compression_level="2"@compression_level="0"@' \ 680 file_def_histdayCOSP_lmdz.xml 681 fi 682 if [[ "$cosp" = "v2" ]]; then 683 sed -e 's@compression_level="2"@compression_level="0"@' file_def_histdayCOSPv2_lmdz.xml 684 for type_ in hf day mth; do 685 file=file_def_hist${type_}COSP 686 sed -i'' -e 's@src="./'${file}'_lmdz.xml"@src="./'${file}'v2_lmdz.xml"@' context_lmdz.xml 687 done 688 sed -i '' -e 's@field_def_cosp1.xml@field_def_cospv2.xml@' field_def_lmdz.xml 689 fi 690 691 cd .. 692 fi 693 694 # Cas Bench avec ecrad 695 if [[ $rad = "ecrad" ]]; then 696 cd "BENCH${grid_resolution}" 697 cp ../DefLists/namelist_ecrad . 698 cp -r ../libf/phylmd/ecrad/data . 699 cd .. 700 fi 701 702 # Adjusting bench physiq.def to radiative code chosen 703 cd "BENCH${grid_resolution}" 704 sed -e 's/iflag_rrtm=.*.$/iflag_rrtm='$iflag_rrtm'/' \ 705 -e 's/NSW=.*.$/NSW='$NSW'/' physiq.def > tmpdef 706 \mv tmpdef physiq.def 707 cd .. 708 709 cp "$exe_name" "BENCH${grid_resolution}/gcm.e" 710 cd "BENCH${grid_resolution}" 711 712 if [[ ${parallel:0:3} = "mpi" ]]; then 713 # Lancement avec deux procs mpi et 2 openMP 714 echo "export OMP_STACKSIZE=800M" > bench.sh 715 if [[ "${parallel:4:3}" = "omp" ]]; then 716 echo "export OMP_NUM_THREADS=2" >> bench.sh 717 fi 718 if [[ "$cosp" = "v1" || "$cosp" = "v2" ]]; then 719 echo "ulimit -s 200000" >> bench.sh 720 else 721 echo "ulimit -s unlimited" >> bench.sh 722 fi 723 echo "mpirun -np 2 gcm.e > listing 2>&1" >> bench.sh 724 # Add rebuild, using reb.sh if it is there 725 cat <<EOF >> bench.sh 726 if [[ -f reb.sh ]]; then 727 ./reb.sh histday; ./reb.sh histmth; ./reb.sh histhf; 728 ./reb.sh histins; ./reb.sh stomate_history; 729 ./reb.sh sechiba_history; ./reb.sh sechiba_out_2 730 fi 731 EOF 732 else 733 echo "./gcm.e > listing 2>&1" > bench.sh 734 fi 735 # Getting orchidee stuff 736 if [[ $veget = 'CMIP6' ]]; then 737 echo 'myget 3DBenchs/BENCHCMIP6.tar.gz' 738 myget 3DBenchs/BENCHCMIP6.tar.gz 739 tar xvzf BENCHCMIP6.tar.gz 740 sed -e "s:VEGET=n:VEGET=y:" config.def > tmp 741 mv -f tmp config.def 742 if [[ $with_xios = 1 ]]; then 743 cp ../../ORCHIDEE/src_xml/context_orchidee.xml . 744 echo '<context id="orchidee" src="./context_orchidee.xml"/>' > add.tmp 745 cp ../../ORCHIDEE/src_xml/field_def_orchidee.xml . 746 cp ../../ORCHIDEE/src_xml/file_def_orchidee.xml . 747 cp ../../ORCHIDEE/src_xml/file_def_input_orchidee.xml . 748 if [[ -f ../../ORCHIDEE/src_xml/context_input_orchidee.xml ]]; then 749 cp ../../ORCHIDEE/src_xml/context_input_orchidee.xml . 750 echo '<context id="orchidee" src="./context_input_orchidee.xml"/>' >> add.tmp 751 fi 752 sed -e '/id="LMDZ"/r add.tmp' iodef.xml > tmp 753 mv tmp iodef.xml 754 sed -e'{/sechiba1/ s/enabled="_AUTO_"/type="one_file" enabled=".TRUE."/}' \ 755 file_def_orchidee.xml > tmp 756 \mv -f tmp file_def_orchidee.xml 757 sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' \ 758 file_def_orchidee.xml > tmp 759 \mv -f tmp file_def_orchidee.xml 760 sed -e 's@output_level="_AUTO_"@output_level="1"@' \ 761 file_def_orchidee.xml > tmp 762 \mv -f tmp file_def_orchidee.xml 763 sed -e 's@output_freq="_AUTO_"@output_freq="1d"@' \ 764 file_def_orchidee.xml > tmp 765 \mv -f tmp file_def_orchidee.xml 766 sed -e 's@compression_level="4"@compression_level="0"@' \ 767 file_def_orchidee.xml > tmp 768 \mv -f tmp file_def_orchidee.xml 769 sed -e 's@XIOS_ORCHIDEE_OK = n@XIOS_ORCHIDEE_OK = y@' \ 770 orchidee.def > tmp 771 \mv -f tmp orchidee.def 772 fi 773 fi 774 775 if [[ -f ../arch.env ]]; then source ../arch.env; fi 776 777 echo "EXECUTION DU BENCH" 778 date 779 if (! ./bench.sh > out.bench 2>&1) || ! (tail -n 1 listing | grep "Everything is cool"); then 780 tail listing 781 echo "Bench FAILED, exiting"; exit 1 782 fi 783 date 784 tail listing 785 fi 786 787 # 1D case 788 if [[ $SCM = 1 ]]; then 789 cd "$MODEL" 790 myget 1D/1D.tar.gz 791 tar xf 1D.tar.gz 792 cd 1D 793 if [[ $rad = "oldrad" ]]; then 794 sed -i'' -e 's/^rad=.*$/rad=oldrad/' run.sh 795 sed -i'' -e 's/^rad=.*$/rad=oldrad/' bin/compile 796 fi 797 echo "Running 1D/run.sh, log in $(pwd)/run1d.log" 798 ./run.sh > "$(pwd)/run1d.log" 2>&1 799 fi 528 800 } 529 801 … … 539 811 install_IOIPSL 540 812 #install_XIOS # TODO disabled for now, did not decide which flags/arch to use for compile 541 compile_orchidee_seq 542 543 exit 0 544 545 546 547 548 ################################################################ 549 # Specificite des machines 550 ################################################################ 551 552 hostname=$(hostname) 553 #case ${hostname:0:5} in 554 # *) if [[ $parallel = none || -f /usr/bin/mpif90 ]]; then 555 # path_mpi=$(which mpif90 | sed -e s:/mpif90::); 556 # if [[ -d /usr/lib64/openmpi ]]; then 557 # root_mpi="/usr/lib64/openmpi" 558 # else 559 # root_mpi="/usr" 560 # fi 561 # else 562 # echo "Cannot find mpif90"; 563 # if [[ $parallel = none ]]; then exit 1; fi; 564 # fi; 565 # if [[ $parallel != none ]]; then 566 # root_mpi=$(which mpif90 | sed -e s:/bin/mpif90::) 567 # path_mpi=$(which mpif90 | sed -e s:/mpif90::) 568 # export LD_LIBRARY_PATH=${root_mpi}/lib:$LD_LIBRARY_PATH 569 # fi 570 # par_comp=${path_mpi}/mpif90; 571 # mpirun=${path_mpi}/mpirun; 572 # arch="local"; 573 # make="make"; 574 # o_ins_make="-t g95" 575 #esac 576 577 ## Flags for parallelism: 578 #if [[ $parallel != none ]]; then 579 # # MPI_LD are the flags needed for linking with MPI 580 # MPI_LD="-L${root_mpi}/lib -lmpi" 581 # if [[ $compiler = "gfortran" ]]; then 582 # # MPI_FLAGS are the flags needed for compilation with MPI 583 # MPI_FLAGS="-fcray-pointer" 584 # # OMP_FLAGS are the flags needed for compilation with OpenMP 585 # OMP_FLAGS="-fopenmp -fcray-pointer" 586 # # OMP_LD are the flags needed for linking with OpenMP 587 # OMP_LD="-fopenmp" 588 # elif [[ $compiler = "ifort" ]]; then 589 # MPI_FLAGS="" 590 # OMP_FLAGS="-openmp" 591 # OMP_LD="-openmp" 592 # else # pgf90 593 # MPI_FLAGS="" 594 # OMP_FLAGS="-mp" 595 # OMP_LD="-mp" 596 # fi 597 #fi 598 # 599 # 600 #echo "################################################################" 601 #echo "Choix des options de compilation" 602 #echo "################################################################" 603 # 604 #export FC=$compiler 605 #export F90=$compiler 606 #export F77=$compiler 607 #export CPPFLAGS= 608 #OPTIMNC="" 609 #BASE_LD="$OPT_GPROF" 610 #OPTPREC="$OPT_GPROF" 611 #ARFLAGS="rs" 612 #if [[ $(lsb_release -i -s) = "Ubuntu" ]]; then 613 # if [[ $(lsb_release -r -s | cut -d. -f1) -ge 16 ]]; then 614 # ARFLAGS="rU" 615 # fi 616 #fi 617 # 618 #if [[ $compiler = "gfortran" ]]; then 619 # OPTIM="-O3 $allow_arg_mismatch" 620 # OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all -fbacktrace -finit-real=snan $allow_arg_mismatch" 621 # OPTDEV="-Wall -fbounds-check $allow_arg_mismatch" 622 # fmod="I " 623 # OPTPREC="$OPTPREC -cpp -ffree-line-length-0" 624 # if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE"; fi 625 # export F90FLAGS=" -ffree-form $OPTIMNC" 626 # export FFLAGS=" $OPTIMNC" 627 # export CC=gcc 628 # export CXX=g++ 629 # export fpp_flags="-P -C -traditional -ffreestanding" 630 # 631 #elif [[ $compiler = mpif90 ]]; then 632 # OPTIM="-O3" 633 # OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all" 634 # OPTDEV="-Wall -fbounds-check" 635 # BASE_LD="$BASE_LD -lblas" 636 # fmod="I " 637 # if [[ $real = r8 ]]; then 638 # OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE -fcray-pointer" 639 # fi 640 # export F90FLAGS=" -ffree-form $OPTIMNC" 641 # export FFLAGS=" $OPTIMNC" 642 # export CC=gcc 643 # export CXX=g++ 644 # 645 #elif [[ $compiler = pgf90 ]]; then 646 # OPTIM="-O2 -Mipa -Munroll -Mnoframe -Mautoinline -Mcache_align" 647 # OPTDEB="-g -Mdclchk -Mbounds -Mchkfpstk -Mchkptr -Minform=inform -Mstandard -Ktrap=fp -traceback" 648 # OPTDEV="-g -Mbounds -Ktrap=fp -traceback" 649 # fmod="module " 650 # if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -r8 -DNC_DOUBLE"; fi 651 # export CPPFLAGS="-DpgiFortran" 652 # export CC=pgcc 653 # export CFLAGS="-O2 -Msignextend" 654 # export CXX=pgCC 655 # export CXXFLAGS="-O2 -Msignextend" 656 # export FFLAGS="-O2 $OPTIMNC" 657 # export F90FLAGS="-O2 $OPTIMNC" 658 # compile_with_fcm=1 659 # 660 #elif [[ $compiler = ifort || $compiler = mpiifort ]]; then 661 # OPTIM="-O2 -fp-model strict -ip -align all " 662 # OPTDEV="-p -g -O2 -traceback -fp-stack-check -ftrapuv -check" 663 # OPTDEB="-g -no-ftz -traceback -ftrapuv -fp-stack-check -check" 664 # fmod='module ' 665 # if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -real-size 64 -DNC_DOUBLE"; fi 666 # export CPP="icc -E" 667 # export FFLAGS="-O2 -ip -fpic -mcmodel=large" 668 # export FCFLAGS="-O2 -ip -fpic -mcmodel=large" 669 # export CC=icc 670 # export CFLAGS="-O2 -ip -fpic -mcmodel=large" 671 # export CXX=icpc 672 # export CXXFLAGS="-O2 -ip -fpic -mcmodel=large" 673 # export fpp_flags="-P -traditional" 674 # # Pourquoi forcer la compilation fcm. Marche mieux sans 675 # #compile_with_fcm=1 676 #else 677 # echo "unexpected compiler $compiler"; exit 1 678 #fi 679 # 680 #OPTIMGCM="$OPTIM $OPTPREC" 681 682 683 veget_version=false 684 if [[ $veget != 'none' ]]; then 685 cd "$MODEL/modipsl/modeles/ORCHIDEE" 686 687 opt_orc="-prod"; if [[ "$optim_debug" = "-debug" ]]; then opt_orc="-debug"; fi 688 689 orchideelog=$(pwd)/orchidee.log 690 echo '########################################################' 691 echo 'Compiling ORCHIDEE, the continental surface model ' 692 echo '########################################################' 693 echo "Start of the first compilation of orchidee, in sequential mode: $(date)" 694 echo "log file : $orchideelog" 695 696 ORCHPATH=$(pwd) 697 export ORCHPATH=$ORCHPATH 698 xios_orchid="-noxios" 699 if [[ "$with_xios" = "y" ]]; then 700 xios_orchid="-xios" 701 fi 702 if [[ -d tools ]]; then 703 ################################################################### 704 # Pour les experts qui voudraient changer de version d'orchidee. 705 # Attention : necessite d'avoir le password pour orchidee 706 ################################################################### 707 if [[ "$veget_version" == "false" ]]; then 708 veget_version=orchidee2.0 709 fi 710 cd arch 711 sed -e s:"%COMPILER .*.$:%COMPILER $compiler":1 \ 712 -e s:"%LINK .*.$:%LINK $compiler":1 \ 713 -e s:"%FPP_FLAGS .*.$:%FPP_FLAGS $fpp_flags":1 \ 714 -e s:"%PROD_FFLAGS .*.$:%PROD_FFLAGS $OPTIM":1 \ 715 -e s:"%DEV_FFLAGS .*.$:%DEV_FFLAGS $OPTDEV":1 \ 716 -e s:"%DEBUG_FFLAGS .*.$:%DEBUG_FFLAGS $OPTDEB":1 \ 717 -e s:"%BASE_FFLAGS .*.$:%BASE_FFLAGS $OPTPREC":1 \ 718 -e s:"%BASE_LD .*.$:%BASE_LD $BASE_LD":1 \ 719 -e s:"%ARFLAGS .*.$:%ARFLAGS $ARFLAGS":1 \ 720 arch-gfortran.fcm > arch-local.fcm 721 cat <<EOF > arch-local.path 722 NETCDF_LIBDIR="-L$ncdfdir/lib -lnetcdff -lnetcdf" 723 NETCDF_INCDIR="$ncdfdir/include" 724 IOIPSL_INCDIR="$ORCHPATH/../../lib" 725 IOIPSL_LIBDIR="$ORCHPATH/../../lib" 726 XIOS_INCDIR="\$ORCHDIR/../XIOS/inc" 727 XIOS_LIBDIR="\$ORCHDIR/../XIOS/lib -lxios" 728 EOF 729 cd ../ 730 731 echo ./makeorchidee_fcm -j $xios_orchid $opt_orc -parallel none \ 732 -arch $arch 733 ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc -parallel none \ 734 -arch $arch > "$orchideelog" 2>&1 735 pwd 736 else # of "if [[ -d tools ]]" 737 if [[ -d src_parallel ]]; then 738 liste_src="parallel parameters global stomate sechiba driver" 739 if [[ "$veget_version" == "false" ]]; then 740 veget_version=orchidee2.0 741 fi 742 fi 743 for d in $liste_src; do 744 src_d=src_$d 745 echo src_d "$src_d" 746 echo ls; ls 747 if [[ ! -d $src_d ]]; then 748 echo "Problem orchidee : no $src_d"; exit 1 749 fi 750 cd "$src_d"; \rm -f -- *.mod make; $make clean 751 $make > "$orchideelog" 2>&1 752 if [[ "$compiler" = "gfortran" || "$compiler" = "mpif90" ]]; then 753 cp -f -- *.mod ../../../lib 754 fi 755 cd .. 756 done 757 fi # of "if [[ -d tools ]]" 758 echo "install_lmdz.sh orchidee_compil_seq_OK $(date)" 759 fi # of if [[ "$veget" != 'none' ]] 760 761 762 #============================================================================ 763 # Ehouarn: the directory name LMDZ* depends on version/tar file... 764 if find . -name "$MODEL/modipsl/modeles/LMD*"; then 765 echo '###############################################################' 766 echo 'Preparing LMDZ compilation : arch file, svn switch if needed...' 767 echo '###############################################################' 768 cd "$MODEL/modipsl/modeles/"LMD* 769 LMDZPATH=$(pwd) 770 else 771 echo "ERROR: No LMD* directory !!!" 772 exit 1 773 fi 774 775 776 ########################################################### 777 # For those who want to use fcm to compile via : 778 # makelmdz_fcm -arch local ..... 779 ############################################################ 780 781 782 783 cd "$MODEL/modipsl/modeles"/LMDZ* 784 lmdzlog=$(pwd)/lmdz.log 785 786 ################################################################## 787 # Possibly update LMDZ if a specific svn release is requested 788 ################################################################## 789 790 set +e; svn upgrade; set -e 791 792 if [[ $svn = "last" ]]; then svnopt=""; else svnopt="-r $svn"; fi 793 if [[ $svn != "" ]]; then 794 if set +e; svn info | grep -q 'https:'; then 795 svn switch --relocate https://svn.lmd.jussieu.fr/LMDZ \ 796 http://svn.lmd.jussieu.fr/LMDZ 797 fi 798 svn update "$svnopt" 799 set -e 800 fi 801 802 #--------------------------------------------------------------------- 803 # Retrieve the final svn release number, and adjust compilation 804 # options accordingly 805 # If svn not available, will use the svn writen in $MODEL/Readm*md 806 # For old version it assumes that it is before 4185 (the version 807 # for which the test was introduced 808 #--------------------------------------------------------------------- 809 810 set +e; mysvn=$(svnversion . | grep -E || "[0-9]+" 2>/dev/null); set -e 811 if [[ "$mysvn" = "" ]]; then mysvn=$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null); fi 812 if [[ "$mysvn" = "" ]]; then mysvn=4190; fi 813 814 if [[ "$pclinux" = "1" && ! -f arch/arch-local.path ]]; then 815 816 # create local 'arch' files (if on Linux PC): 817 cd arch 818 # arch-local.path file 819 # test for version as arch.pth file changed format with rev 4426 820 if [[ "$mysvn" -gt 4425 ]]; then 821 cat <<EOF > arch-local.path 822 NETCDF_LIBDIR="-L$ncdfdir/lib" 823 NETCDF_LIB="-lnetcdff -lnetcdf" 824 NETCDF_INCDIR=-I$ncdfdir/include 825 NETCDF95_INCDIR=-I\$LMDGCM/../../include 826 NETCDF95_LIBDIR=-L\$LMDGCM/../../lib 827 NETCDF95_LIB=-lnetcdf95 828 IOIPSL_INCDIR=-I\$LMDGCM/../../lib 829 IOIPSL_LIBDIR=-L\$LMDGCM/../../lib 830 IOIPSL_LIB=-lioipsl 831 XIOS_INCDIR=-I\$LMDGCM/../XIOS/inc 832 XIOS_LIBDIR=-L\$LMDGCM/../XIOS/lib 833 XIOS_LIB="-lxios -lstdc++" 834 ORCH_INCDIR=-I\$LMDGCM/../../lib 835 ORCH_LIBDIR=-L\$LMDGCM/../../lib 836 EOF 837 else 838 cat <<EOF > arch-local.path 839 NETCDF_LIBDIR="-L$ncdfdir/lib -lnetcdff -lnetcdf" 840 NETCDF_INCDIR=-I$ncdfdir/include 841 NETCDF95_INCDIR=\$LMDGCM/../../include 842 NETCDF95_LIBDIR=\$LMDGCM/../../lib 843 IOIPSL_INCDIR=\$LMDGCM/../../lib 844 IOIPSL_LIBDIR=\$LMDGCM/../../lib 845 XIOS_INCDIR=\$LMDGCM/../XIOS/inc 846 XIOS_LIBDIR=\$LMDGCM/../XIOS/lib 847 ORCH_INCDIR=\$LMDGCM/../../lib 848 ORCH_LIBDIR=\$LMDGCM/../../lib 849 EOF 850 fi 851 852 if [[ $pcmac == 1 ]]; then 853 BASE_LD="$BASE_LD -Wl,-rpath,${ncdfdir}/lib" 854 else 855 BASE_LD="$BASE_LD -Wl,-rpath=${ncdfdir}/lib" 856 fi 857 # Arch-local.fcm file (adapted from arch-linux-32bit.fcm) 858 859 if [[ $real = r8 ]]; then FPP_DEF=NC_DOUBLE; else FPP_DEF=""; fi 860 sed -e s:"%COMPILER .*.$:%COMPILER $compiler":1 \ 861 -e s:"%LINK .*.$:%LINK $compiler":1 \ 862 -e s:"%PROD_FFLAGS .*.$:%PROD_FFLAGS $OPTIM":1 \ 863 -e s:"%DEV_FFLAGS .*.$:%DEV_FFLAGS $OPTDEV":1 \ 864 -e s:"%DEBUG_FFLAGS .*.$:%DEBUG_FFLAGS $OPTDEB":1 \ 865 -e s:"%BASE_FFLAGS .*.$:%BASE_FFLAGS $OPTPREC":1 \ 866 -e s:"%FPP_DEF .*.$:%FPP_DEF $FPP_DEF":1 \ 867 -e s:"%BASE_LD .*.$:%BASE_LD $BASE_LD":1 \ 868 -e s:"%ARFLAGS .*.$:%ARFLAGS $ARFLAGS":1 \ 869 arch-linux-32bit.fcm > arch-local.fcm 870 871 cd .. 872 ### Adapt "bld.cfg" (add the shell): 873 #whereisthatshell=$(which ${use_shell}) 874 #echo "bld::tool::SHELL $whereisthatshell" >> bld.cfg 875 876 fi # of if [[ "$pclinux" = 1 ]] 877 #--------------------------------------------------------------------- 878 # Option de compilation du rayonnement : depend de $mysvn ><= r4185 879 #--------------------------------------------------------------------- 880 opt_rad="" 881 882 case $rad in 883 oldrad) iflag_rrtm=0; NSW=2; opt_rad="";; 884 rrtm) iflag_rrtm=1; NSW=6 885 if [[ $mysvn -le 4185 ]]; then 886 opt_rad="-rrtm true" 887 else 888 opt_rad="-rad rrtm" 889 fi;; 890 ecrad) iflag_rrtm=2; NSW=6; opt_rad="-rad ecrad";; 891 *) echo "Only oldrad rrtm ecrad for rad option"; exit 1 892 esac 893 894 if [[ $mysvn -le 4185 && $rad = "ecrad" ]]; then 895 echo "ecrad only available for LMDZ rev starting with 4186 "; exit 1 896 fi 897 898 ################################################################## 899 900 901 if [[ ! -f libf/misc/netcdf95.F90 && ! -d $MODEL/NetCDF95-0.3 ]]; then 902 cd "$MODEL" 903 myget src_archives/netcdf/NetCDF95-0.3.tar.gz 904 tar -xf NetCDF95-0.3.tar.gz 905 rm NetCDF95-0.3.tar.gz 906 cd NetCDF95-0.3 907 mkdir build 908 cd build 909 cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$ncdfdir" \ 910 -DCMAKE_INSTALL_PREFIX="$MODEL/modipsl" 911 make install 912 cd "$MODEL/modipsl/modeles/"LMDZ* 913 fi 914 915 echo '##################################################################' 916 echo "Preparing script compile.sh for LMDZ compilation" 917 echo "It will only be run automatically if bench=1/tuto" 918 echo "Here bench=$bench" 919 echo '##################################################################' 920 921 if [[ $env_file != "" ]]; then 922 mv arch/arch-${arch}.env arch/arch-${arch}.orig 923 \cp -f "$env_file" arch/arch-${arch}.env 924 fi 925 926 if [[ $compile_with_fcm = 1 ]]; then 927 makelmdz="makelmdz_fcm $optim_debug -arch $arch -j 8 " 928 else 929 makelmdz="makelmdz $optim_debug -arch $arch" 930 fi 931 932 # sequential compilation 933 if [[ "$sequential" = 1 ]]; then 934 echo Sequential compilation command, saved in compile.sh: 935 echo "./$makelmdz $optim_debug $OPT_MAKELMDZ $optim_debug $opt_rad $opt_cosp " \ 936 "-d ${grid_resolution} -v $veget_version gcm " 937 echo "./$makelmdz $optim_debug $OPT_MAKELMDZ $optim_debug $opt_rad $opt_cosp " \ 938 "-d ${grid_resolution} -v $veget_version gcm " > compile.sh 939 chmod +x ./compile.sh 940 if [[ $bench = 1 ]]; then 941 echo "install_lmdz.sh start_lmdz_seq_compilation $(date)" 942 echo "log file: $lmdzlog" 943 ./compile.sh > "$lmdzlog" 2>&1 944 echo "install_lmdz.sh end_lmdz_seq_compilation $(date)" 945 fi 946 fi # fin sequential 947 948 # compiling in parallel mode 949 if [[ $parallel != "none" ]]; then 950 echo '##########################################################' 951 echo ' Parallel compile ' 952 echo '##########################################################' 953 echo "(after saving the sequential libs and binaries)" 954 cd "$MODEL/modipsl" 955 tar cf sequential.tar bin/ lib/ 956 # 957 # Orchidee 958 # 959 cd "$ORCHPATH" 960 if [[ -d src_parallel && $veget != 'none' ]]; then 961 cd arch 962 sed \ 963 -e s:"%COMPILER.*.$:%COMPILER $par_comp":1 \ 964 -e s:"%LINK.*.$:%LINK $par_comp":1 \ 965 -e s:"%MPI_FFLAG.*.$:%MPI_FFLAGS $MPI_FLAGS":1 \ 966 -e s:"%OMP_FFLAG.*.$:%OMP_FFLAGS $OMP_FLAGS":1 \ 967 -e s:"%MPI_LD.*.$:%MPI_LD $MPI_LD":1 \ 968 -e s:"%OMP_LD.*.$:%OMP_LD $OMP_LD":1 \ 969 arch-local.fcm > tmp.fcm 970 971 mv tmp.fcm arch-local.fcm 972 cd ../ 973 echo "Compiling ORCHIDEE in parallel mode $(date)" 974 echo "logfile $orchideelog" 975 echo "NOTE : to recompile it when necessary, use ./compile_orc.sh " \ 976 "in modipsl/modeles/ORCHIDEE" 977 echo ./makeorchidee_fcm -j 8 -clean $xios_orchid $opt_orc \ 978 -parallel "$parallel" -arch $arch > compile_orc.sh 979 echo ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc \ 980 -parallel "$parallel" -arch $arch >> compile_orc.sh 981 echo echo Now you must also recompile LMDZ, by running ./compile.sh \ 982 in modeles/LMDZ >> compile_orc.sh 983 chmod u+x compile_orc.sh 984 ./makeorchidee_fcm -j 8 -clean $xios_orchid $opt_orc \ 985 -parallel "$parallel" -arch $arch > "$orchideelog" 2>&1 986 ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc -parallel "$parallel" \ 987 -arch $arch >> "$orchideelog" 2>&1 988 echo "End of ORCHIDEE compilation in parallel mode $(date)" 989 elif [[ $veget != 'none' ]]; then 990 echo '##########################################################' 991 echo ' Orchidee version too old ' 992 echo ' Please update to new version ' 993 echo '##########################################################' 994 exit 1 995 fi #�of [ -d src_parallel && $veget != 'none' ] 996 997 # LMDZ 998 cd "$LMDZPATH" 999 if [[ $arch = local ]]; then 1000 cd arch 1001 sed -e s:"%COMPILER.*.$:%COMPILER $par_comp":1 \ 1002 -e s:"%LINK.*.$:%LINK $par_comp":1 \ 1003 -e s:"%MPI_FFLAG.*.$:%MPI_FFLAGS $MPI_FLAGS":1 \ 1004 -e s:"%OMP_FFLAG.*.$:%OMP_FFLAGS $OMP_FLAGS":1 \ 1005 -e s:"%ARFLAGS.*.$:%ARFLAGS $ARFLAGS":1 \ 1006 -e "s§%BASE_LD.*.$§%BASE_LD -Wl,-rpath=${root_mpi}/lib:${ncdfdir}/lib§1" \ 1007 -e s:"%MPI_LD.*.$:%MPI_LD $MPI_LD":1 \ 1008 -e s:"%OMP_LD.*.$:%OMP_LD $OMP_LD":1 \ 1009 arch-local.fcm > tmp.fcm 1010 mv tmp.fcm arch-local.fcm 1011 cd ../ 1012 fi 1013 rm -f compile.sh 1014 echo resol="$grid_resolution" >> compile.sh 1015 if [[ ${hostname:0:5} = jean- && "$cosp" = "v2" ]]; then 1016 1017 echo "LMDZ compilation command in parallel mode, saved in compile.sh, is :" 1018 echo "(ATTENTION le probleme de cospv2 sur jean-zay en mode prod " \ 1019 "n est pas corrige ! )" 1020 # ATTENTION le probleme de cospv2 sur jean-zay en mode prod n 1021 # est pas corrige 1022 echo ./"$makelmdz" -dev $optim_debug "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ 1023 "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ 1024 -parallel "$parallel" gcm >> compile.sh 1025 echo ./"$makelmdz" -dev $optim_debug "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ 1026 "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ 1027 -parallel "$parallel" gcm 1028 else 1029 echo ./"$makelmdz" $optim_debug "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ 1030 "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ 1031 -parallel "$parallel" gcm >> compile.sh 1032 echo ./"$makelmdz" $optim_debug "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ 1033 "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ 1034 -parallel "$parallel" gcm 1035 fi 1036 chmod +x ./compile.sh 1037 1038 if [[ $bench = 1 ]]; then 1039 echo "Compiling LMDZ in parallel mode $(date), LMDZ log file: $lmdzlog" 1040 ./compile.sh > "$lmdzlog" 2>&1 1041 fi 1042 1043 fi # of if [[ $parallel != "none" ]] 1044 1045 1046 ################################################################## 1047 # Verification du succes de la compilation 1048 ################################################################## 1049 1050 # Recherche de l'executable dont le nom a change au fil du temps ... 1051 # suffix contains radiative option starting with revision 4186 1052 if [[ $mysvn -ge 4186 ]]; then suff_exe=_${rad}${suff_exe}; fi 1053 gcm="" 1054 1055 for exe in gcm.e bin/gcm_${grid_resolution}_phylmd${suff_exe}${suff_orc}.e 1056 do 1057 if [[ -f $exe ]]; then gcm=$exe; fi 1058 done 1059 1060 if [[ "$gcm" = "" ]]; then 1061 if [[ $bench = 1 ]]; then 1062 echo 'Compilation failed !! Cannot run the benchmark;' 1063 exit 1 1064 else 1065 echo 'Compilation not done (only done when bench=1)' 1066 fi 1067 else 1068 echo '##########################################################' 1069 echo "Compilation successfull !! $(date)" 1070 echo '##########################################################' 1071 echo "The executable is $gcm" 1072 fi 1073 1074 ################################################################## 1075 # Below, we run a benchmark if bench=1 or tuto 1076 ################################################################## 1077 1078 if [[ $bench = tuto ]]; then 1079 myget Training/tutorial.tar; tar xf tutorial.tar; cd TUTORIAL 1080 ./init.sh 1081 1082 elif [[ $bench = 1 && ! -d BENCH${grid_resolution} ]]; then 1083 # TOUTE CETTE SECTION DEVRAIT DISPARAITRE POUR UNE COMMANDE 1084 # OU DES BENCHS PAR MOTS CLES COMME tuto 1085 1086 echo '##########################################################' 1087 echo ' Running a test run ' 1088 echo '##########################################################' 1089 1090 \rm -rf "BENCH${grid_resolution}" 1091 bench=bench_lmdz_${grid_resolution} 1092 echo "install_lmdz.sh before bench download $(date)" 1093 #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/$bench.tar.gz 1094 myget "3DBenchs/$bench.tar.gz" 1095 echo "install_lmdz.sh after bench download $(date)" 1096 tar xf "$bench.tar.gz" 1097 1098 if [[ "$cosp" = "v1" || "$cosp" = "v2" ]]; then 1099 cd "BENCH${grid_resolution}" 1100 # copier les fichiers namelist input et output our COSP 1101 cp ../DefLists/cosp*_input_nl.txt . 1102 cp ../DefLists/cosp*_output_nl.txt . 1103 # Activer la cles ok_cosp pour tourner avec COSP 1104 sed -e 's@ok_cosp=n@ok_cosp=y@' config.def > tmp 1105 \mv -f tmp config.def 1106 cd .. 1107 fi 1108 1109 if [[ -n "$physiq" ]]; then 1110 cd "BENCH${grid_resolution}" 1111 if [[ -f "physiq.def_${physiq}" ]]; then 1112 cp "physiq.def_${physiq}" physiq.def 1113 echo using "physiq.def_${physiq}" 1114 else 1115 echo using standard physiq.def 1116 fi 1117 cd .. 1118 else 1119 echo using standard physiq.def 1120 fi 1121 1122 if [[ "$with_xios" = "y" ]]; then 1123 cd "BENCH${grid_resolution}" 1124 cp ../DefLists/iodef.xml . 1125 cp ../DefLists/context_lmdz.xml . 1126 cp ../DefLists/field_def_lmdz.xml . 1127 # A raffiner par la suite 1128 echo "A FAIRE : Copier les *xml en fonction de l option cosp" 1129 cp ../DefLists/field_def_cosp*.xml . 1130 cp ../DefLists/file_def_hist*xml . 1131 # adapt iodef.xml to use attached mode 1132 sed -e 's@"using_server" type="bool">true@"using_server" type="bool">false@' \ 1133 iodef.xml > tmp 1134 \mv -f tmp iodef.xml 1135 1136 # and convert all the enabled="_AUTO_" (for libIGCM) to enabled=.FALSE. 1137 # except for histday 1138 for histfile in file_def_hist*xml 1139 do 1140 if [[ "$histfile" = "file_def_histday_lmdz.xml" ]]; then 1141 sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".TRUE."@' \ 1142 "$histfile" > tmp 1143 \mv -f tmp "$histfile" 1144 sed -e 's@output_level="_AUTO_"@output_level="5"@' "$histfile" \ 1145 > tmp 1146 \mv -f tmp "$histfile" 1147 sed -e 's@compression_level="2"@compression_level="0"@' \ 1148 "$histfile" > tmp 1149 \mv -f tmp "$histfile" 1150 else 1151 sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' \ 1152 "$histfile" > tmp 1153 \mv -f tmp "$histfile" 1154 fi 1155 done 1156 # and add option "ok_all_xml=y" in config.def 1157 echo "### XIOS outputs" >> config.def 1158 echo 'ok_all_xml=.true.' >> config.def 1159 1160 #activer les sorties pour Cosp 1161 if [[ "$cosp" = "v1" ]]; then 1162 sed -i'' -e 's@enabled=".FALSE."@enabled=".TRUE."@' \ 1163 -e 's@output_level="_AUTO_"@output_level="5"@' \ 1164 -e 's@compression_level="2"@compression_level="0"@' \ 1165 file_def_histdayCOSP_lmdz.xml 1166 fi 1167 if [[ "$cosp" = "v2" ]]; then 1168 sed -e 's@compression_level="2"@compression_level="0"@' file_def_histdayCOSPv2_lmdz.xml 1169 for type_ in hf day mth; do 1170 file=file_def_hist${type_}COSP 1171 sed -i'' -e 's@src="./'${file}'_lmdz.xml"@src="./'${file}'v2_lmdz.xml"@' context_lmdz.xml 1172 done 1173 sed -i '' -e 's@field_def_cosp1.xml@field_def_cospv2.xml@' field_def_lmdz.xml 1174 fi 1175 1176 cd .. 1177 fi 1178 1179 # Cas Bensh avec ecrad 1180 if [[ "$rad" = "ecrad" ]]; then 1181 cd "BENCH${grid_resolution}" 1182 cp ../DefLists/namelist_ecrad . 1183 cp -r ../libf/phylmd/ecrad/data . 1184 cd .. 1185 fi 1186 1187 # Adjusting bench physiq.def to radiative code chosen 1188 cd "BENCH${grid_resolution}" 1189 sed -e 's/iflag_rrtm=.*.$/iflag_rrtm='$iflag_rrtm'/' \ 1190 -e 's/NSW=.*.$/NSW='$NSW'/' physiq.def > tmpdef 1191 \mv tmpdef physiq.def 1192 cd .. 1193 1194 cp "$gcm" "BENCH${grid_resolution}/gcm.e" 1195 1196 cd "BENCH${grid_resolution}" 1197 # On cree le fichier bench.sh au besoin 1198 # Dans le cas 48x36x39 le bench.sh existe deja en parallele 1199 1200 if [[ "$grid_resolution" = "48x36x39" ]]; then 1201 echo On ne touche pas au bench.sh 1202 # But we have to adapt "run_local.sh" for $mpirun 1203 sed -e "s@mpirun@$mpirun@g" run_local.sh > tmp 1204 mv -f tmp run_local.sh 1205 chmod u=rwx run_local.sh 1206 elif [[ "${parallel:0:3}" = "mpi" ]]; then 1207 # Lancement avec deux procs mpi et 2 openMP 1208 echo "export OMP_STACKSIZE=800M" > bench.sh 1209 if [[ "${parallel:4:3}" = "omp" ]]; then 1210 echo "export OMP_NUM_THREADS=2" >> bench.sh 1211 fi 1212 if [[ "$cosp" = "v1" || "$cosp" = "v2" ]]; then 1213 if [[ ${hostname:0:5} = jean- ]]; then 1214 chmod +x ../arch.env 1215 ../arch.env 1216 echo "ulimit -s 2000000" >> bench.sh 1217 else 1218 echo "ulimit -s 200000" >> bench.sh 1219 fi 1220 else 1221 echo "ulimit -s unlimited" >> bench.sh 1222 fi 1223 if [[ ${hostname:0:5} = jean- ]]; then 1224 . ../arch/arch-${arch}.env 1225 echo "srun -n 2 && $idris_acct@cpu gcm.e > listing 2>&1" \ 1226 >> bench.sh 1227 else 1228 echo "$mpirun -np 2 gcm.e > listing 2>&1" >> bench.sh 1229 fi 1230 # Add rebuild, using reb.sh if it is there 1231 cat <<EOF >> bench.sh 1232 if [[ -f reb.sh ]]; then 1233 ./reb.sh histday; ./reb.sh histmth; ./reb.sh histhf; 1234 ./reb.sh histins; ./reb.sh stomate_history; 1235 ./reb.sh sechiba_history; ./reb.sh sechiba_out_2 1236 fi 1237 EOF 1238 else 1239 echo "./gcm.e > listing 2>&1" > bench.sh 1240 fi 1241 # Getting orchidee stuff 1242 if [[ $veget == 'CMIP6' ]]; then 1243 #echo 'myget 3DBenchs/BENCHorch11.tar.gz' 1244 #myget 3DBenchs/BENCHorch11.tar.gz 1245 #tar xvzf BENCHorch11.tar.gz 1246 echo 'myget 3DBenchs/BENCHCMIP6.tar.gz' 1247 myget 3DBenchs/BENCHCMIP6.tar.gz 1248 tar xvzf BENCHCMIP6.tar.gz 1249 sed -e "s:VEGET=n:VEGET=y:" config.def > tmp 1250 mv -f tmp config.def 1251 if [[ "$with_xios" = "y" ]]; then 1252 cp ../../ORCHIDEE/src_xml/context_orchidee.xml . 1253 echo '<context id="orchidee" src="./context_orchidee.xml"/>' \ 1254 > add.tmp 1255 cp ../../ORCHIDEE/src_xml/field_def_orchidee.xml . 1256 cp ../../ORCHIDEE/src_xml/file_def_orchidee.xml . 1257 cp ../../ORCHIDEE/src_xml/file_def_input_orchidee.xml . 1258 if [[ -f ../../ORCHIDEE/src_xml/context_input_orchidee.xml ]]; then 1259 cp ../../ORCHIDEE/src_xml/context_input_orchidee.xml . 1260 echo '<context id="orchidee" ' \ 1261 'src="./context_input_orchidee.xml"/>' >> add.tmp 1262 fi 1263 sed -e '/id="LMDZ"/r add.tmp' iodef.xml > tmp 1264 mv tmp iodef.xml 1265 sed -e'{/sechiba1/ s/enabled="_AUTO_"/type="one_file" enabled=".TRUE."/}' \ 1266 file_def_orchidee.xml > tmp 1267 \mv -f tmp file_def_orchidee.xml 1268 sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' \ 1269 file_def_orchidee.xml > tmp 1270 \mv -f tmp file_def_orchidee.xml 1271 sed -e 's@output_level="_AUTO_"@output_level="1"@' \ 1272 file_def_orchidee.xml > tmp 1273 \mv -f tmp file_def_orchidee.xml 1274 sed -e 's@output_freq="_AUTO_"@output_freq="1d"@' \ 1275 file_def_orchidee.xml > tmp 1276 \mv -f tmp file_def_orchidee.xml 1277 sed -e 's@compression_level="4"@compression_level="0"@' \ 1278 file_def_orchidee.xml > tmp 1279 \mv -f tmp file_def_orchidee.xml 1280 sed -e 's@XIOS_ORCHIDEE_OK = n@XIOS_ORCHIDEE_OK = y@' \ 1281 orchidee.def > tmp 1282 \mv -f tmp orchidee.def 1283 fi 1284 fi 1285 1286 if [[ -f ../arch.env ]] 1287 then 1288 source ../arch.env 1289 fi 1290 1291 echo EXECUTION DU BENCH 1292 set +e 1293 date; ./bench.sh > out.bench 2>&1; date 1294 set -e 1295 tail listing 1296 1297 1298 echo "##########################################################" 1299 echo "Simulation finished in $(pwd)" 1300 echo "You have compiled with:" 1301 cat ../compile.sh 1302 if [[ $parallel = "none" ]]; then 1303 echo "You may re-run it with : cd $(pwd); gcm.e" 1304 echo "or ./bench.sh" 1305 else 1306 echo "You may re-run it with : " 1307 echo "cd $(pwd); ./bench.sh" 1308 # echo 'ulimit -s unlimited' 1309 # echo 'export OMP_NUM_THREADS=2' 1310 # echo 'export OMP_STACKSIZE=800M' 1311 # echo "$mpirun -np 2 gcm.e " 1312 fi 1313 echo '##########################################################' 1314 1315 fi # bench 1316 1317 1318 ################################################################# 1319 # Installation eventuelle du 1D 1320 ################################################################# 1321 1322 if [[ $SCM = 1 ]]; then 1323 cd "$MODEL" 1324 myget 1D/1D.tar.gz 1325 tar xf 1D.tar.gz 1326 cd 1D 1327 if [[ $rad = oldrad ]]; then 1328 sed -i'' -e 's/^rad=.*$/rad=oldrad/' run.sh 1329 sed -i'' -e 's/^rad=.*$/rad=oldrad/' bin/compile 1330 fi 1331 echo "Running 1D/run.sh, log in $(pwd)/run1d.log" 1332 ./run.sh > "$(pwd)/run1d.log" 2>&1 1333 fi 1334 1335 1336 ################################################################# 1337 # sauvegarde des options veget pour utilisation eventuelle tutorial_prod 1338 ################################################################# 1339 cd "$MODEL/modipsl/modeles" 1340 #echo surface_env file created in $MODEL 1341 cat <<EOF >surface_env 1342 veget=$veget 1343 opt_veget="-v $veget_version" 1344 orchidee_rev=$orchidee_rev 1345 suforch=$suff_orc 1346 EOF 813 compile_orchidee 814 compile_lmdz 815 run_bench
Note: See TracChangeset
for help on using the changeset viewer.