Ignore:
Timestamp:
Mar 25, 2024, 10:27:44 AM (8 weeks ago)
Author:
abarral
Message:

(WIP)
fix IOIPSL fcm arch
refactor install_xios

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/script_install_amaury/install_lmdz.sh

    r4862 r4871  
    3838### Functions
    3939
    40 function myget {
    41     # A function to fetch files either locally or on the internet
    42 
    43     local file_name=$1
    44     # Path on local computer where to look for the datafile
    45     if [[ -f "/u/lmdz/WWW/LMDZ/pub/$file_name" ]]; then
    46         \cp -f -p "/u/lmdz/WWW/LMDZ/pub/$file_name" .
    47     elif [[ -f ~"/LMDZ/pub/$file_name" ]]; then
    48         \cp -f -p ~"/LMDZ/pub/$file_name" .
    49     else
    50         wget --no-check-certificate -nv "http://lmdz.lmd.jussieu.fr/pub/$file_name"
    51     fi
     40function myget { # Get a file from LMDZ repository
     41  local url=$1
     42
     43  local filename
     44  filename=$(basename "$url")
     45
     46  wget --no-check-certificate -nv "http://lmdz.lmd.jussieu.fr/pub/$url"
     47  if [[ $filename =~ .*\.(ba)?sh ]]; then chmod +x "$filename"; fi
    5248}
    5349
     
    323319        \rm "modipsl.$version.tar"
    324320    fi
     321
     322    if [[ $svn != "" ]]; then
     323        mysvn=$svn
     324    else
     325        mysvn="$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null)"
     326    fi
     327    echo "SVN revision used: $mysvn"
     328}
     329
     330function setup_local_arch {
     331    # Setup local arch, and correspondance between arch names accross different programs
     332
     333    case $arch in
     334        local)
     335            arch_ioipsl="gfortran"
     336            arch_xios="local"
     337
     338            cat <<EOF >"$MODEL/modipsl/modeles/IOIPSL/arch/arch-${arch_ioipsl}.path"  # fix bad IOIPSL arch files...
     339NETCDF_INCDIR="\$(nf-config --fflags)"
     340NETCDF_LIBDIR="\$(nf-config --flibs)"
     341EOF
     342        ;;
     343      *) arch_ioipsl=$arch
     344         arch_xios=$arch
     345  esac
    325346}
    326347
     
    405426    echo "Compiling IOIPSL, the interface library with Netcdf $(date) (log: $ioipsllog)"
    406427
    407     if ! ./makeioipsl_fcm -job 8 > "$ioipsllog" 2>&1; then
     428    if ! ./makeioipsl_fcm -arch "$arch_ioipsl" -job 8 > "$ioipsllog" 2>&1; then
    408429      echo "IOIPSL compile failed, exiting"; exit 1
    409430    fi
     
    413434}
    414435
     436function install_XIOS {
     437    if [[ $with_xios = "y"  && ! -f "$MODEL/modipsl/modeles/XIOS/lib/libxios.a" ]]; then
     438        cd "$MODEL/modipsl/modeles"
     439        xioslog="$(pwd)/xios.log"
     440        echo "##########################################################"
     441        echo "Compiling XIOS (log $xioslog) $(date)"
     442        echo "##########################################################"
     443        myget script_install/install_xios.bash
     444
     445        if ! ./install_xios.bash -prefix "$MODEL/modipsl/modeles" -arch "$arch_xios" > "$xioslog" 2>&1; then
     446            echo "XIOS compilation failed, exiting"; exit 1
     447        fi
     448
     449        echo "Compiled XIOS $(date)"
     450    fi
     451}
     452
    415453echo "install_lmdz.sh DEBUT $(date)"
    416454
     
    419457check_available_software
    420458download_model
     459setup_local_arch
    421460install_netcdf
    422461install_IOIPSL
     462install_XIOS
     463
     464exit 0
    423465
    424466
     
    562604
    563605
    564 if [[ "$with_xios" = "y" ]]; then
    565     echo '##########################################################'
    566     echo 'Compiling XIOS'
    567     echo '##########################################################'
    568     cd "$MODEL/modipsl/modeles"
    569     xioslog="$(pwd)/xios.log"
    570     #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/install_xios.bash
    571     myget script_install/install_xios.bash
    572     chmod u=rwx install_xios.bash
    573 # following will be recalculated later on once LMDZ is updated
    574 #    mysvn=`svnversion LMDZ | egrep || "[0-9]+" 2>/dev/null`
    575     mysvn=$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null)
    576     if [[ $svn != "" ]]; then mysvn=$svn; fi
    577     echo "mysvn $mysvn"
    578 
    579     if [[ ${hostname:0:5} = jean- ]]; then
    580         if [[ $mysvn -ge 4619 ]]; then
    581             svn co http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.6 XIOS
    582         else
    583             svn co http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.5 XIOS
    584         fi
    585         cd XIOS/arch
    586         svn update
    587         cd ..
    588         echo "Compiling XIOS, start $(date) (it takes about 20 min on Jean-Zay)"
    589         echo "log file: $xioslog"
    590         ./make_xios --prod --arch $arch --job 4 > xios.log 2>&1
    591     else
    592         ./install_xios.bash -prefix "$MODEL/modipsl/modeles" \
    593                             -netcdf "$ncdfdir" -hdf5 "$ncdfdir" \
    594                             -MPI "$root_mpi" -arch $arch > xios.log 2>&1
    595     fi # of case Jean-Zay
    596     if [[ -f XIOS/lib/libxios.a ]]; then
    597         echo "XIOS library successfully generated"
    598         echo install_lmdz.sh XIOS_OK "$(date)"
    599     fi
    600 fi
    601 
    602606#============================================================================
    603607veget_version=false
    604 if [[ "$veget" != 'NONE' ]]; then
     608if [[ $veget != 'NONE' ]]; then
    605609    cd "$MODEL/modipsl/modeles/ORCHIDEE"
    606610    set +e; svn upgrade; set -e
    607     if [[ "$veget" = "CMIP6" ]]; then
     611    if [[ $veget = "CMIP6" ]]; then
    608612        veget_version=orchidee2.0
    609613        orchidee_rev=6592
     
    652656        # Pour les experts qui voudraient changer de version d'orchidee.
    653657        # Attention : necessite d'avoir le password pour orchidee
    654 
    655         # Correctif suite debug Jean-Zay
    656         if [[ -f src_global/time.f90 ]]; then
    657             sed -i -e 's/CALL tlen2itau/\!CALL tlen2itau/' src_global/time.f90
    658         fi
    659658        ###################################################################
    660659        if [[ "$veget_version" == "false" ]]; then
Note: See TracChangeset for help on using the changeset viewer.