Changeset 4997 for BOL


Ignore:
Timestamp:
Jun 27, 2024, 11:43:01 AM (5 days ago)
Author:
abarral
Message:

add <jobcm> arg
fix lmdz version variable when specifying svn rev
fix default orcbranch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/script_install_amaury/install_lmdz.sh

    r4994 r4997  
    9595    arch="local-gfortran"
    9696    arch_dir=""
     97
     98    jobcmd=""
    9799}
    98100
     
    148150
    149151        -make_j     number of processes to parallelize installations (default <$make_j>)
     152
     153        -jobcmd     command prepended to fcm compile jobs, e.g. "srun" (default <$jobcmd>)
    150154
    151155        -noclean    will only download necessary files (but no thorough check is made on the integrity of existing files), and will recompile everything (very quick if it's already been compiled before)
     
    187191            "-inlandsis") inlandsis=1; shift;;
    188192            "-make_j") make_j=$2; shift; shift;;
     193            "-jobcmd") jobcmd=$2; shift; shift;;
    189194            "-noclean") clean_install=0; shift;;
    190195            *)  bash install_lmdz.sh -h; exit 1
     
    319324        getlog="$(pwd)/get.log"
    320325        echo "logfile : $getlog"
    321         myget "src_archives/$trusting/modipsl.$version.tar.gz" >> get.log 2>&1
     326        myget "src_archives/$trusting/modipsl.$version.tar.gz" &>> get.log
    322327        echo "install_lmdz.sh wget_OK $(date)"
    323         gunzip "modipsl.$version.tar.gz" >> get.log 2>&1
    324         tar xf "modipsl.$version.tar" >> get.log 2>&1
     328        gunzip "modipsl.$version.tar.gz" &>> get.log
     329        tar xf "modipsl.$version.tar" &>> get.log
    325330        \rm "modipsl.$version.tar"
    326331    fi
     
    447452            echo "----------------------------------------------------------"
    448453            echo "log file : $netcdflog"
    449             myget script_install/$script_install_netcdf >> "$netcdflog" 2>&1
     454            myget script_install/$script_install_netcdf &>> "$netcdflog"
    450455            chmod u=rwx $script_install_netcdf
    451456            # shellcheck disable=SC2086
    452             ./$script_install_netcdf -prefix "$ncdfdir" $opt_ >> "$netcdflog" 2>&1
     457            ./$script_install_netcdf -prefix "$ncdfdir" $opt_ &>> "$netcdflog"
    453458        fi
    454459
     
    506511    echo "Compiling IOIPSL, the interface library with Netcdf $(date) (log: $ioipsllog)"
    507512
    508     if ! ./makeioipsl_fcm -arch "$arch" -job 8 > "$ioipsllog" 2>&1; then
    509         echo "IOIPSL compile failed, exiting"; exit 1
     513    echo "$jobcmd ./makeioipsl_fcm -j $make_j -arch $arch" > compile.sh
     514    chmod +x compile.sh
     515    echo "Compiling IOIPSL using $(\cat compile.sh)"
     516    if ! ./compile.sh &> "$ioipsllog"; then
     517        echo "STOP: IOIPSL compile failed, exiting"; exit 1
    510518    fi
    511519
     
    536544
    537545        echo "Starting XIOS compilation"
    538         if ! ./make_xios --arch "$arch" --job 8 > "$xioslog" 2>&1; then
    539             echo "XIOS compilation failed, exiting"; exit 1
     546        if ! ./make_xios --arch "$arch" --job 8 &> "$xioslog"; then
     547            echo "STOP: XIOS compilation failed, exiting"; exit 1
    540548        fi
    541549
     
    550558        "none") fcm_veget_version="false";;
    551559        "orch2.0" | "CMIP6") fcm_veget_version=orchidee2.0; fetch_rev=7906;;  # in previous tar we used 6592 but with some modifications to xios_orchidee.f90, which got integrated in 7906
    552         "orch2.2") fcm_veget_version=orchidee2.1; orcbranch="ORCHIDEE_2_2" ;; # the bundled version
     560        "orch2.2") fcm_veget_version=orchidee2.1; orcbranch="/branches/ORCHIDEE_2_2/ORCHIDEE" ;; # the bundled version
    553561        *) fetch_rev=$veget; fcm_veget_version=orchidee2.1;;  # /!\ arbitary rev only works for orch>=2.1
    554562    esac
     
    597605        fi
    598606
    599         if [[ $parallel = "none" ]]; then
    600             echo "./makeorchidee_fcm $xios_orchid $opt_orc -parallel none -arch $arch -j $make_j" > compile.sh
    601         else
    602             if [[ ! -d src_parallel ]]; then
    603                echo "Orchidee version too old for parallel support"; exit 1
    604             fi
    605             {
    606                 echo "./makeorchidee_fcm -j $make_j $xios_orchid $opt_orc -parallel $parallel -arch $arch"
    607             } > compile.sh
    608         fi
     607        if [[ $parallel != "none" && ! -d src_parallel ]]; then
     608           echo "STOP: Orchidee version too old for parallel support"; exit 1
     609        fi
     610        echo "$jobcmd ./makeorchidee_fcm -j $make_j $xios_orchid $opt_orc -parallel $parallel -arch $arch" > compile.sh
    609611        chmod +x compile.sh
    610612        echo "Compiling ORCHIDEE using $(\cat compile.sh)"
    611         if ! ./compile.sh > "$orchideelog" 2>&1; then
    612             echo "ORCHIDEE compilation failed, exiting"; exit 1
     613        if ! ./compile.sh &> "$orchideelog"; then
     614            echo "STOP: ORCHIDEE compilation failed, exiting"; exit 1
    613615        fi
    614616        echo "Compiled ORCHIDEE $(date)"
     
    622624
    623625    if [[ -n $svn_lmdz ]]; then
    624       local curr_rev
    625       curr_rev=$(svn info "$MODEL/modipsl/modeles/LMD"* | grep Revision: | cut -d ":" -f 2)
    626       if [[ $svn_lmdz != "$curr_rev" ]]; then
    627           local lmdzbranch
    628           echo "Fetching LMDZ $svn_lmdz from the repository"
    629           lmdzbranch=$(svn log -v -q https://svn.lmd.jussieu.fr/LMDZ -r "$svn_lmdz" | grep LMDZ | head -1 | sed -e 's:trunk/.*$:trunk:' | awk '{print $2}')
    630           cd "$MODEL/modipsl/modeles"
    631           rm -rf LMD*
    632           svn co -r "$svn_lmdz" "https://svn.lmd.jussieu.fr/LMDZ$lmdzbranch" LMDZ
    633           cd - > /dev/null
    634       fi
     626        local curr_rev
     627        curr_rev=$(svn info "$MODEL/modipsl/modeles/LMD"* | grep Revision: | cut -d ":" -f 2)
     628        if [[ $svn_lmdz != "$curr_rev" ]]; then
     629            local lmdzbranch
     630            echo "Fetching LMDZ $svn_lmdz from the repository"
     631            lmdzbranch=$(svn log -v -q https://svn.lmd.jussieu.fr/LMDZ -r "$svn_lmdz" | grep LMDZ | head -1 | sed -e 's:trunk/.*$:trunk:' | awk '{print $2}')
     632            cd "$MODEL/modipsl/modeles"
     633            rm -rf LMD*
     634            svn co -r "$svn_lmdz" "https://svn.lmd.jussieu.fr/LMDZ$lmdzbranch" LMDZ
     635            cd - > /dev/null
     636        fi
     637        used_lmdz_rev=$svn_lmdz
    635638    else  # get svn from info
    636          set +e; used_lmdz_rev=$(svn info | grep "Last Changed Rev" | cut -c 19-); set -e
    637          if [[ -z $used_lmdz_rev ]]; then  # svn info failed
     639        set +e; used_lmdz_rev=$(svn info | grep "Last Changed Rev" | cut -c 19-); set -e
     640        if [[ -z $used_lmdz_rev ]]; then  # svn info failed
    638641            used_lmdz_rev=$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null)
    639642            if [[ -z $used_lmdz_rev ]]; then echo "Could not determine lmdz version. This is likely an issue with the .tar itself, please report to LMDZ team."; exit 1; fi
    640          fi
     643        fi
    641644    fi
    642645}
     
    671674    makelmdz="makelmdz_fcm $optim_debug -arch $arch -j $make_j"
    672675    local para_compile_opt="-mem -parallel $parallel"; if [[ $parallel = "none" ]]; then para_compile_opt=""; fi
    673     echo "./$makelmdz $opt_rad $opt_cosp $opt_makelmdz_xios $opt_aer $opt_inlandsis $opt_isotopes -p $compphysiq -d ${grid_resolution} -v $fcm_veget_version $para_compile_opt gcm" > compile.sh
     676    echo "$jobcmd ./$makelmdz $opt_rad $opt_cosp $opt_makelmdz_xios $opt_aer $opt_inlandsis $opt_isotopes -p $compphysiq -d ${grid_resolution} -v $fcm_veget_version $para_compile_opt gcm" > compile.sh
    674677    echo "Compiling lmdz using $(\cat compile.sh) (log: $lmdzlog) $(date)"
    675678    chmod +x ./compile.sh
    676     if ! ./compile.sh > "$lmdzlog" 2>&1; then
    677         echo "LMDZ compilation failed, exiting"; exit 1
     679    if ! ./compile.sh &> "$lmdzlog"; then
     680        echo "STOP: LMDZ compilation failed, exiting"; exit 1
    678681    fi
    679682    echo "Finished LMDZ compilation $(date)"
     
    681684    # Check executable
    682685    if [[ ! -f $exe_name ]]; then
    683         echo "Compilation failed, can't find the executable"; exit 1
     686        echo "STOP: Compilation failed, can't find the executable"; exit 1
    684687    else
    685688        echo "Compilation successfull, the executable is $exe_name $(date)"
     
    809812                echo "ulimit -s unlimited" >> bench.sh
    810813            fi
    811             if which mpirun > /dev/null 2>&1; then
    812                 echo "mpirun -np 2 gcm.e > listing 2>&1" >> bench.sh
     814            if which mpirun &> /dev/null; then
     815                echo "mpirun -np 2 gcm.e &> listing" >> bench.sh
    813816            elif grep -q "Adastra" /etc/motd; then
    814817                local account
    815818                account=$(/usr/sbin/my_project.py -l 2>&1 | head -1 | cut -d " " -f 3- | cut -c 5-)
    816819                bench_cmd="srun --nodes=1 --ntasks=1 --cpus-per-task=2 --threads-per-core=2 --time=0:10:00 --constraint=GENOA --account=$account bash bench.sh"
    817                 echo "./gcm.e > listing 2>&1" >> bench.sh
     820                echo "./gcm.e &> listing" >> bench.sh
    818821            else
    819822                echo "Error: No command found to run parallel bench"; exit 1
     
    831834EOF
    832835        else
    833             echo "./gcm.e > listing 2>&1" > bench.sh
     836            echo "./gcm.e &> listing" > bench.sh
    834837        fi
    835838        # Getting orchidee stuff
     
    877880        echo "EXECUTION DU BENCH"
    878881        date
    879         if (! $bench_cmd > out.bench 2>&1) || ! (tail -n 1 listing | grep "Everything is cool"); then
     882        if (! $bench_cmd &> out.bench) || ! (tail -n 1 listing | grep "Everything is cool"); then
    880883            tail listing
    881884            echo "Bench FAILED, exiting"; exit 1
     
    899902                    fi
    900903        echo "Running 1D/run.sh, log in $(pwd)/run1d.log"
    901         ./run.sh > "$(pwd)/run1d.log" 2>&1
     904        ./run.sh &> "$(pwd)/run1d.log"
    902905    fi
    903906}
Note: See TracChangeset for help on using the changeset viewer.