- Timestamp:
- Mar 21, 2024, 2:04:37 PM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BOL/script_install_amaury/install_lmdz.sh
r4850 r4861 75 75 # or 0: do not install NetCDF and look for it in standard locations; 76 76 # or absolute path: look for NetCDF there 77 check_ linux=177 check_software_linux=1 78 78 ioipsl=1 79 79 bench=1 … … 294 294 arch=local 295 295 296 297 if [[ $compiler = g95 ]]; then echo g95 is not supported anymore; exit 1; fi298 299 296 ################################################################ 300 297 # Specificite des machines … … 312 309 module purge 313 310 module load intel-compilers/19.0.4; 314 #module load intel-mpi/19.0.4;315 #module load intel-mkl/19.0.4;316 311 module load hdf5/1.10.5-mpi; 317 312 module load netcdf/4.7.2-mpi; 318 313 module load netcdf-fortran/4.5.2-mpi; 319 314 module load subversion/1.9.7; 320 module load cmake315 module load cmake 321 316 export NETCDF_LIBDIR=./ 322 317 export NETCDFFORTRAN_INCDIR=./ … … 389 384 fi 390 385 391 #####################################################################392 # Test for old gfortran compilers393 # If the compiler is too old (older than 4.3.x) we test if the394 # temporary gfortran44 patch is available on the computer in which395 # case the compiler is changed from gfortran to gfortran44396 # Must be aware than parallelism can not be activated in this case397 #####################################################################398 399 if [[ "$compiler" = "gfortran" ]]; then400 gfortran=gfortran401 gfortranv=$(gfortran --version | \402 head -1 | awk ' { print $NF } ' | awk -F. ' { print $1 * 10 + $2 } ')403 if [[ $gfortranv -le 43 ]]; then404 \cat <<EOF405 ERROR : Your gfortran compiler is too old406 Please choose a new one (ifort) and change the line407 compiler=xxx408 in the install_lmdz.sh script and rerun it409 EOF410 if [[ $(which gfortran44 | wc -w) -ne 0 ]]; then411 gfortran=gfortran44412 else413 echo gfotran trop vieux; exit 1414 fi415 fi416 compiler=$gfortran417 fi418 #####################################################################419 420 386 ## if also compiling XIOS, parallel must be mpi_omp 421 if [[ "$with_xios" = "y" && "$parallel"!= "mpi_omp" ]]; then387 if [[ $with_xios = "y" && $parallel != "mpi_omp" ]]; then 422 388 echo "Error, you must set -parallel mpi_omp if you want XIOS" 423 389 exit 1 424 390 fi 425 391 426 if [[ "$with_xios"= "y" ]]; then392 if [[ $with_xios = "y" ]]; then 427 393 opt_makelmdz_xios="-io xios" 428 394 fi 429 395 430 if [[ "$cosp" = "v2" && "$with_xios"= "n" ]]; then396 if [[ $cosp = "v2" && $with_xios = "n" ]]; then 431 397 echo "Error, Cospv2 cannot run without Xios" 432 398 exit 1 433 399 fi 434 400 435 echo '################################################################'436 echo Choix des options de compilation437 echo '################################################################'401 echo "################################################################" 402 echo "Choix des options de compilation" 403 echo "################################################################" 438 404 439 405 export FC=$compiler … … 445 411 OPTPREC="$OPT_GPROF" 446 412 ARFLAGS="rs" 447 if [[ "$(lsb_release -i -s)"= "Ubuntu" ]]; then448 if [[ "$(lsb_release -r -s | cut -d. -f1)"-ge 16 ]]; then449 450 fi 451 fi 452 453 if [[ "$compiler" = "$gfortran" ]]; then413 if [[ $(lsb_release -i -s) = "Ubuntu" ]]; then 414 if [[ $(lsb_release -r -s | cut -d. -f1) -ge 16 ]]; then 415 ARFLAGS="rU" 416 fi 417 fi 418 419 if [[ $compiler = "gfortran" ]]; then 454 420 OPTIM="-O3 $allow_arg_mismatch" 455 421 OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all -fbacktrace -finit-real=snan $allow_arg_mismatch" 456 422 OPTDEV="-Wall -fbounds-check $allow_arg_mismatch" 457 fmod= 'I '423 fmod="I " 458 424 OPTPREC="$OPTPREC -cpp -ffree-line-length-0" 459 425 if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE"; fi … … 465 431 466 432 elif [[ $compiler = mpif90 ]]; then 467 OPTIM= '-O3'433 OPTIM="-O3" 468 434 OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all" 469 435 OPTDEV="-Wall -fbounds-check" 470 436 BASE_LD="$BASE_LD -lblas" 471 fmod= 'I '437 fmod="I " 472 438 if [[ $real = r8 ]]; then 473 439 OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE -fcray-pointer" … … 479 445 480 446 elif [[ $compiler = pgf90 ]]; then 481 OPTIM= '-O2 -Mipa -Munroll -Mnoframe -Mautoinline -Mcache_align'482 OPTDEB= '-g -Mdclchk -Mbounds -Mchkfpstk -Mchkptr -Minform=inform -Mstandard -Ktrap=fp -traceback'483 OPTDEV= '-g -Mbounds -Ktrap=fp -traceback'484 fmod= 'module '447 OPTIM="-O2 -Mipa -Munroll -Mnoframe -Mautoinline -Mcache_align" 448 OPTDEB="-g -Mdclchk -Mbounds -Mchkfpstk -Mchkptr -Minform=inform -Mstandard -Ktrap=fp -traceback" 449 OPTDEV="-g -Mbounds -Ktrap=fp -traceback" 450 fmod="module " 485 451 if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -r8 -DNC_DOUBLE"; fi 486 452 export CPPFLAGS="-DpgiFortran" … … 520 486 # If installing on known machines such as Jean-Zay at IDRIS, 521 487 # don't check for available software and don't install netcdf 522 if [[ ${hostname:0:5} = jean-]]; then488 if [[ ${hostname:0:5} = "jean-" ]]; then 523 489 netcdf=0 # no need to recompile netcdf, alreday available 524 check_ linux=0490 check_software_linux=0 525 491 pclinux=0 526 492 ioipsl=0 # no need to recompile ioipsl, already available … … 540 506 541 507 542 if [[ "$check_linux"= 1 ]]; then508 if [[ $check_software_linux = 1 ]]; then 543 509 echo "################################################################" 544 510 echo "Check if required software is available" 545 511 echo "################################################################" 546 547 #### Ehouarn: test if the required shell is available548 #### Maj FH-LF-AS 2021-04 : default=bash; if bash missing, use ksh549 use_shell="bash" # default550 if [[ $(which bash) = "" ]]; then551 echo "no bash; we will use ksh"552 use_shell="ksh"553 if [[ $(which ksh) = "" ]]; then554 echo "bash (or ksh) needed!! Install it!"555 exit 1556 fi557 fi558 512 559 513 for logiciel in wget tar gzip make $compiler gcc cmake m4 c++; do … … 564 518 done 565 519 566 if [[ $pclinux = 1 ]]; then 567 cd "$MODEL" 568 cat <<eod > tt.f90 520 cd "$MODEL" 521 cat <<eod > tt.f90 569 522 print*,'coucou' 570 523 end 571 524 eod 572 $compiler tt.f90 || a.out 573 ./a.out >| tt 574 if [[ $(< tt sed -e 's/ //g' ) != "coucou" ]]; then 575 echo "problem installing with compiler $compiler"; exit 1; fi 576 \rm tt a.out tt.f90 577 fi 525 $compiler tt.f90 || a.out 526 ./a.out >| tt 527 if [[ $(< tt sed -e 's/ //g' ) != "coucou" ]]; then 528 echo "problem installing with compiler $compiler"; exit 1; fi 529 \rm tt a.out tt.f90 578 530 fi 579 531 … … 595 547 596 548 ########################################################################### 597 echo Installing Netcdf549 echo "Installing Netcdf" 598 550 ########################################################################### 599 551 … … 687 639 cp AA_make.gdef AA_make.orig 688 640 F_C="$compiler -c " 689 if [[ $compiler = " $gfortran" || $compiler = "mpif90" ]]641 if [[ $compiler = "gfortran" || $compiler = "mpif90" ]] 690 642 then 691 643 F_C="$compiler -c -cpp " 692 644 fi 693 if [[ "$compiler"= "pgf90" ]]; then F_C="$compiler -c -Mpreprocess"; fi645 if [[ $compiler = "pgf90" ]]; then F_C="$compiler -c -Mpreprocess"; fi 694 646 sed -e 's/^\#.*.g95.*.\#.*.$/\#/' AA_make.gdef > tmp 695 647 sed -e "s:F_L = g95:F_L = $compiler:" \ … … 709 661 fi 710 662 711 712 663 # We use lines for g95 even for the other compilers to run ins_make 713 if [[ "$use_shell" = "ksh" ]]; then 714 ./ins_make "$o_ins_make" 715 else # bash 716 sed -e s:/bin/ksh:/bin/bash:g ins_make > ins_make.bash 717 if [[ $(grep jeanzay AA_make.gdef) = "" ]]; then 718 # Bidouille pour compiler sur ada des vieux modipsl.tar 719 echo 'Warning jean-zay not in AA_make.gdef' 720 echo 'Think about updating' 721 exit 1 722 fi 723 724 chmod u=rwx ins_make.bash 725 ./ins_make.bash "$o_ins_make" 726 fi # of if [[ "$use_shell" = "ksh" ]] 664 sed -e s:/bin/ksh:/bin/bash:g ins_make > ins_make.bash # Note Amaury: the case where the default shell isn't bash should be handled directly in ins_make (via ./ and #! directives) 665 666 chmod u=rwx ins_make.bash 667 # shellcheck disable=SC2086 668 ./ins_make.bash $o_ins_make 727 669 728 670 echo "install_lmdz.sh MODIPSL_OK $(date)" … … 735 677 echo "log file : $ioipsllog $(date)" 736 678 737 if [[ "$use_shell" = "bash" ]]; then 738 cp Makefile Makefile.ksh 739 sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile 740 fi 741 ### if [[ "$pclinux" = 1 ]]; then 679 cp Makefile Makefile.ksh 680 sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile 681 742 682 # Build IOIPSL modules and library 743 683 $make clean 744 684 $make > "$ioipsllog" 2>&1 745 if [[ $compiler = " $gfortran" || $compiler = "mpif90" ]]; then685 if [[ $compiler = "gfortran" || $compiler = "mpif90" ]]; then 746 686 # copy module files to lib 747 687 cp -f -- *.mod ../../../lib … … 752 692 if [[ -f $MODEL/modipsl/modeles/IOIPSL/tools/rebuild ]]; then 753 693 rebuild_dir=$MODEL/modipsl/modeles/IOIPSL/tools 754 elif [[ -d $MODEL/modipsl/modeles/IOIPSL/rebuild ]]; then755 694 elif [[ -d $MODEL/modipsl/modeles/IOIPSL/rebuild ]]; then 695 rebuild_dir=$MODEL/modipsl/modeles/IOIPSL/rebuild 756 696 fi 757 697 if [[ $rebuild_dir != "" ]]; then 758 cd "$rebuild_dir"698 cd "$rebuild_dir" 759 699 # adapt Makefile & rebuild script if in bash 760 if [[ "$use_shell" = "bash" ]]; then 761 cp Makefile Makefile.ksh 762 sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile 763 cp rebuild rebuild.ksh 764 sed -e 's:/bin/ksh:/bin/bash:g' \ 765 -e 's:print -u2:echo:g' \ 766 -e 's:print:echo:g' rebuild.ksh > rebuild 767 fi 700 cp Makefile Makefile.ksh 701 sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile 702 cp rebuild rebuild.ksh 703 sed -e 's:/bin/ksh:/bin/bash:g' \ 704 -e 's:print -u2:echo:g' \ 705 -e 's:print:echo:g' rebuild.ksh > rebuild 768 706 $make clean 769 707 $make > "$ioipsllog" 2>&1 770 708 fi 771 ### fi # of if [[ "$pclinux" = 1 ]] which is commented out772 709 773 710 else # of if [[ $ioipsl = 1 ]] … … 817 754 818 755 if [[ ${hostname:0:5} = jean- ]]; then 819 if [[ $mysvn -ge 4619 ]]; then 820 svn co http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.6 \ 821 XIOS 822 else 823 svn co http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.5 \ 824 XIOS 756 if [[ $mysvn -ge 4619 ]]; then 757 svn co http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.6 XIOS 758 else 759 svn co http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.5 XIOS 825 760 fi 826 761 cd XIOS/arch … … 944 879 cd "$src_d"; \rm -f -- *.mod make; $make clean 945 880 $make > "$orchideelog" 2>&1 946 if [[ "$compiler" = " $gfortran" || "$compiler" = "mpif90" ]]; then881 if [[ "$compiler" = "gfortran" || "$compiler" = "mpif90" ]]; then 947 882 cp -f -- *.mod ../../../lib 948 883 fi … … 956 891 #============================================================================ 957 892 # Ehouarn: the directory name LMDZ* depends on version/tar file... 958 if [[ -d $MODEL/modipsl/modeles/LMD* ]]; then893 if find . -name "$MODEL/modipsl/modeles/LMD*"; then 959 894 echo '###############################################################' 960 895 echo 'Preparing LMDZ compilation : arch file, svn switch if needed...' … … 967 902 fi 968 903 904 969 905 ########################################################### 970 906 # For those who want to use fcm to compile via : … … 1014 950 cat <<EOF > arch-local.path 1015 951 NETCDF_LIBDIR="-L$ncdfdir/lib" 1016 NETCDF_LIB="-lnetcdff -lnetcdf \"952 NETCDF_LIB="-lnetcdff -lnetcdf" 1017 953 NETCDF_INCDIR=-I$ncdfdir/include 1018 954 NETCDF95_INCDIR=-I\$LMDGCM/../../include
Note: See TracChangeset
for help on using the changeset viewer.