Changeset 4861


Ignore:
Timestamp:
Mar 21, 2024, 2:04:37 PM (7 weeks ago)
Author:
abarral
Message:

remove ksh support
correct indentation
fix build typo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/script_install_amaury/install_lmdz.sh

    r4850 r4861  
    7575#          or 0: do not install NetCDF and look for it in standard locations;
    7676#          or absolute path: look for NetCDF there
    77 check_linux=1
     77check_software_linux=1
    7878ioipsl=1
    7979bench=1
     
    294294arch=local
    295295
    296 
    297 if [[ $compiler = g95 ]]; then echo g95 is not supported anymore; exit 1; fi
    298 
    299296################################################################
    300297# Specificite des machines
     
    312309             module purge
    313310             module load intel-compilers/19.0.4;
    314              #module load intel-mpi/19.0.4;
    315              #module load intel-mkl/19.0.4;
    316311             module load hdf5/1.10.5-mpi;
    317312             module load netcdf/4.7.2-mpi;
    318313             module load netcdf-fortran/4.5.2-mpi;
    319314             module load subversion/1.9.7;
    320              module load cmake
     315                   module load cmake
    321316             export NETCDF_LIBDIR=./
    322317             export NETCDFFORTRAN_INCDIR=./
     
    389384fi
    390385
    391 #####################################################################
    392 # Test for old gfortran compilers
    393 # If the compiler is too old (older than 4.3.x) we test if the
    394 # temporary gfortran44 patch is available on the computer in which
    395 # case the compiler is changed from gfortran to gfortran44
    396 # Must be aware than parallelism can not be activated in this case
    397 #####################################################################
    398 
    399 if [[ "$compiler" = "gfortran" ]]; then
    400     gfortran=gfortran
    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
    411             gfortran=gfortran44
    412         else
    413             echo gfotran trop vieux; exit 1
    414         fi
    415     fi
    416     compiler=$gfortran
    417 fi
    418 #####################################################################
    419 
    420386## if also compiling XIOS, parallel must be mpi_omp
    421 if [[ "$with_xios" = "y" && "$parallel" != "mpi_omp" ]]; then
     387if [[ $with_xios = "y" && $parallel != "mpi_omp" ]]; then
    422388    echo "Error, you must set -parallel mpi_omp if you want XIOS"
    423389    exit 1
    424390fi
    425391
    426 if [[ "$with_xios" = "y" ]]; then
     392if [[ $with_xios = "y" ]]; then
    427393    opt_makelmdz_xios="-io xios"
    428394fi
    429395
    430 if [[ "$cosp" = "v2" && "$with_xios" = "n" ]]; then
     396if [[ $cosp = "v2" && $with_xios = "n" ]]; then
    431397    echo "Error, Cospv2 cannot run without Xios"
    432398    exit 1
    433399fi
    434400
    435 echo '################################################################'
    436 echo  Choix des options de compilation
    437 echo '################################################################'
     401echo "################################################################"
     402echo  "Choix des options de compilation"
     403echo "################################################################"
    438404
    439405export FC=$compiler
     
    445411OPTPREC="$OPT_GPROF"
    446412ARFLAGS="rs"
    447 if [[ "$(lsb_release -i -s)" = "Ubuntu" ]]; then
    448     if [[ "$(lsb_release -r -s | cut -d. -f1)" -ge 16 ]]; then
    449             ARFLAGS="rU"
    450     fi
    451 fi
    452 
    453 if [[ "$compiler" = "$gfortran" ]]; then
     413if [[ $(lsb_release -i -s) = "Ubuntu" ]]; then
     414    if [[ $(lsb_release -r -s | cut -d. -f1) -ge 16 ]]; then
     415        ARFLAGS="rU"
     416    fi
     417fi
     418
     419if [[ $compiler = "gfortran" ]]; then
    454420   OPTIM="-O3 $allow_arg_mismatch"
    455421   OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all -fbacktrace -finit-real=snan  $allow_arg_mismatch"
    456422   OPTDEV="-Wall -fbounds-check  $allow_arg_mismatch"
    457    fmod='I '
     423   fmod="I "
    458424   OPTPREC="$OPTPREC -cpp -ffree-line-length-0"
    459425   if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE"; fi
     
    465431
    466432elif [[ $compiler = mpif90 ]]; then
    467     OPTIM='-O3'
     433    OPTIM="-O3"
    468434    OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all"
    469435    OPTDEV="-Wall -fbounds-check"
    470436    BASE_LD="$BASE_LD -lblas"
    471     fmod='I '
     437    fmod="I "
    472438    if [[ $real = r8 ]]; then
    473439        OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE -fcray-pointer"
     
    479445
    480446elif [[ $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 "
    485451    if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -r8 -DNC_DOUBLE"; fi
    486452    export CPPFLAGS="-DpgiFortran"
     
    520486# If installing on known machines such as Jean-Zay at IDRIS,
    521487# don't check for available software and don't install netcdf
    522 if [[ ${hostname:0:5} = jean- ]]; then
     488if [[ ${hostname:0:5} = "jean-" ]]; then
    523489    netcdf=0 # no need to recompile netcdf, alreday available
    524     check_linux=0
     490    check_software_linux=0
    525491    pclinux=0
    526492    ioipsl=0 # no need to recompile ioipsl, already available
     
    540506
    541507
    542 if [[ "$check_linux" = 1 ]]; then
     508if [[ $check_software_linux = 1 ]]; then
    543509    echo "################################################################"
    544510    echo "Check if required software is available"
    545511    echo "################################################################"
    546 
    547     #### Ehouarn: test if the required shell is available
    548     #### Maj FH-LF-AS 2021-04 : default=bash; if bash missing, use ksh
    549     use_shell="bash" # default
    550     if [[ $(which bash) = "" ]]; then
    551         echo "no bash; we will use ksh"
    552         use_shell="ksh"
    553         if [[ $(which ksh) = "" ]]; then
    554             echo "bash (or ksh) needed!! Install it!"
    555             exit 1
    556         fi
    557     fi
    558512
    559513    for logiciel in wget tar gzip make $compiler gcc cmake m4 c++; do
     
    564518    done
    565519
    566     if [[ $pclinux = 1 ]]; then
    567         cd "$MODEL"
    568         cat <<eod > tt.f90
     520    cd "$MODEL"
     521    cat <<eod > tt.f90
    569522print*,'coucou'
    570523end
    571524eod
    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
    578530fi
    579531
     
    595547
    596548###########################################################################
    597 echo Installing Netcdf
     549echo "Installing Netcdf"
    598550###########################################################################
    599551
     
    687639        cp AA_make.gdef AA_make.orig
    688640        F_C="$compiler -c "
    689         if [[ $compiler = "$gfortran" || $compiler = "mpif90" ]]
     641        if [[ $compiler = "gfortran" || $compiler = "mpif90" ]]
    690642        then
    691643            F_C="$compiler -c -cpp "
    692644        fi
    693         if [[ "$compiler" = "pgf90" ]]; then F_C="$compiler -c -Mpreprocess"; fi
     645        if [[ $compiler = "pgf90" ]]; then F_C="$compiler -c -Mpreprocess"; fi
    694646        sed -e 's/^\#.*.g95.*.\#.*.$/\#/' AA_make.gdef > tmp
    695647        sed -e "s:F_L = g95:F_L = $compiler:" \
     
    709661        fi
    710662
    711 
    712663        # 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
    727669
    728670        echo "install_lmdz.sh MODIPSL_OK $(date)"
     
    735677        echo "log file : $ioipsllog   $(date)"
    736678
    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
    742682        # Build IOIPSL modules and library
    743683        $make clean
    744684        $make > "$ioipsllog" 2>&1
    745         if [[ $compiler = "$gfortran" || $compiler = "mpif90" ]]; then
     685        if [[ $compiler = "gfortran" || $compiler = "mpif90" ]]; then
    746686            # copy module files to lib
    747687            cp -f -- *.mod ../../../lib
     
    752692        if [[ -f $MODEL/modipsl/modeles/IOIPSL/tools/rebuild ]]; then
    753693            rebuild_dir=$MODEL/modipsl/modeles/IOIPSL/tools
    754         elif [[ -d $MODEL/modipsl/modeles/IOIPSL/rebuild ]]; then
    755               rebuild_dir=$MODEL/modipsl/modeles/IOIPSL/rebuild
     694              elif [[ -d $MODEL/modipsl/modeles/IOIPSL/rebuild ]]; then
     695            rebuild_dir=$MODEL/modipsl/modeles/IOIPSL/rebuild
    756696        fi
    757697        if [[ $rebuild_dir != "" ]]; then
    758             cd "$rebuild_dir"
     698                  cd "$rebuild_dir"
    759699            # 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
    768706            $make clean
    769707            $make > "$ioipsllog" 2>&1
    770708        fi
    771         ### fi # of if [[ "$pclinux" = 1 ]] which is commented out
    772709
    773710    else # of if [[ $ioipsl = 1 ]]
     
    817754
    818755    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
    825760        fi
    826761        cd XIOS/arch
     
    944879            cd "$src_d"; \rm -f -- *.mod make; $make clean
    945880            $make > "$orchideelog" 2>&1
    946             if [[ "$compiler" = "$gfortran" || "$compiler" = "mpif90" ]]; then
     881            if [[ "$compiler" = "gfortran" || "$compiler" = "mpif90" ]]; then
    947882                cp -f -- *.mod ../../../lib
    948883            fi
     
    956891#============================================================================
    957892# Ehouarn: the directory name LMDZ* depends on version/tar file...
    958 if [[ -d $MODEL/modipsl/modeles/LMD* ]]; then
     893if find . -name "$MODEL/modipsl/modeles/LMD*"; then
    959894    echo '###############################################################'
    960895    echo 'Preparing LMDZ compilation : arch file, svn switch if needed...'
     
    967902fi
    968903
     904
    969905###########################################################
    970906# For those who want to use fcm to compile via :
     
    1014950      cat <<EOF > arch-local.path
    1015951NETCDF_LIBDIR="-L$ncdfdir/lib"
    1016 NETCDF_LIB="-lnetcdff -lnetcdf\"
     952NETCDF_LIB="-lnetcdff -lnetcdf"
    1017953NETCDF_INCDIR=-I$ncdfdir/include
    1018954NETCDF95_INCDIR=-I\$LMDGCM/../../include
Note: See TracChangeset for help on using the changeset viewer.