Changeset 5336 for BOL


Ignore:
Timestamp:
Nov 18, 2024, 4:53:17 PM (3 days ago)
Author:
abarral
Message:

Create function do_compile_sh
Set dynamico commit
Fix dynamico bench cleanup
Housekeeping for icosa/icolmdz

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/script_install_amaury/install_lmdz.sh

    r5332 r5336  
    4949}
    5050
     51function do_compile_sh {
     52  local component=$1
     53  local command=$2
     54  local log
     55
     56  log="$(pwd)/$component.log"
     57  echo "$command" > compile.sh
     58  echo "Compiling $component using $(\cat compile.sh) (log: $log) $(date)"
     59    chmod +x ./compile.sh
     60    if ! ./compile.sh &> "$log"; then
     61        echo "STOP: $component compilation failed, exiting"; exit 1
     62    fi
     63    echo "Finished $component compilation $(date)"
     64}
     65
    5166function get_svn_branch {
    5267  local url=$1
     
    88103
    89104    icolmdz=0
    90     DYNAMICO_VERS=374a3c66
     105    dynamico_commit="11001689"
    91106
    92107    rad="rrtm"
     
    101116    make_j=8
    102117    clean_install=1
     118    local="$(pwd)"
    103119
    104120    # Check if on a Mac /!\ Probably doesn't work anymore, to fix one day...
     
    354370}
    355371
    356 function download_model {
     372function download_modipsl_tar {
    357373    if [[ $clean_install = 1 ]]; then rm -rf "$MODEL"; fi
    358374
     
    370386        tar xf "modipsl.$version.tar" &>> get.log
    371387        rm "modipsl.$version.tar"
    372 
    373         cd - &> /dev/null
    374     ## checkout DYNAMICO and icosa interface in modipsl/modeles if needed
    375        if [[ $icolmdz = 1 ]]; then
    376          TMPLOCDIR=$(pwd)
    377          cd "$MODEL/modipsl/modeles/"
    378          getlog="$(pwd)/get.log"
    379          git clone https://gitlab.in2p3.fr/ipsl/projets/dynamico/dynamico.git DYNAMICO ; cd DYNAMICO ; git checkout master; cd .. &>> get.log
    380          svn checkout http://svn.lmd.jussieu.fr/LMDZ/ICOSA_LMDZ &>> get.log
    381          cd "$TMPLOCDIR" &> /dev/null
    382        fi
    383388    fi
    384389}
    385390
    386391function init_arch {
     392    cd "$local"
    387393    set +e; arch_dir=$(readlink -f "$arch_dir"); set -e  # full path. readlink must be called *after* the path is created
    388394
     
    578584
    579585        install_arch "XIOS"
    580 
    581         echo "$jobcmd ./make_xios --job $make_j --arch $arch" > compile.sh
    582         chmod +x compile.sh
    583         echo "$(date) Compiling XIOS using $(\cat compile.sh) (log in $xioslog)"
    584         if ! ./compile.sh &> "$xioslog"; then
    585             echo "STOP: XIOS compilation failed, exiting"; exit 1
    586         fi
    587 
    588         echo "Compiled XIOS $(date)"
     586        do_compile_sh "XIOS" "$jobcmd ./make_xios --job $make_j --arch $arch"
    589587    fi
    590588}
     
    633631        cd "$MODEL/modipsl/modeles/ORCHIDEE"
    634632
    635         orchideelog="$(pwd)/orchidee.log"
    636         echo "Compiling ORCHIDEE, the continental surface model (log $orchideelog) $(date)"
    637 
    638633        local xios_orchid
    639634        if [[ $with_xios = 1 ]]; then
     
    646641           echo "STOP: Orchidee version too old for parallel support"; exit 1
    647642        fi
    648         echo "$jobcmd ./makeorchidee_fcm -j $make_j $xios_orchid $optim_flag -parallel $parallel -arch $arch" > compile.sh
    649         chmod +x compile.sh
    650         echo "Compiling ORCHIDEE using $(\cat compile.sh)"
    651         if ! ./compile.sh &> "$orchideelog"; then
    652             echo "STOP: ORCHIDEE compilation failed, exiting"; exit 1
    653         fi
    654         echo "Compiled ORCHIDEE $(date)"
     643        do_compile_sh "ORCHIDEE" "$jobcmd ./makeorchidee_fcm -j $make_j $xios_orchid $optim_flag -parallel $parallel -arch $arch"
    655644    fi
    656645}
     
    660649    LMDZPATH=$(readlink -e -f "$MODEL/modipsl/modeles/LMD"*)
    661650    cd "$LMDZPATH"
    662     lmdzlog="$(pwd)/lmdz.log"
    663 
    664651
    665652    if [[ -n $svn_lmdz ]]; then
     
    713700
    714701    # Compile
    715     makelmdz="makelmdz_fcm $optim_flag -arch $arch -j $make_j"
     702    local makelmdz="makelmdz_fcm $optim_flag -arch $arch -j $make_j"
    716703    local para_compile_opt="-mem -parallel $parallel"; if [[ $parallel = "none" ]]; then para_compile_opt=""; fi
    717     echo "$jobcmd ./$makelmdz $opt_rad $opt_cosp $opt_makelmdz_xios $opt_aer $opt_inlandsis $opt_strataer $opt_isotopes -p $compphysiq -d ${grid_resolution} -v $fcm_veget_version $para_compile_opt $fortran_file" > compile.sh
    718     echo "Compiling lmdz using $(\cat compile.sh) (log: $lmdzlog) $(date)"
    719     chmod +x ./compile.sh
    720     if ! ./compile.sh &> "$lmdzlog"; then
    721         echo "STOP: LMDZ compilation failed, exiting"; exit 1
    722     fi
    723     echo "Finished LMDZ compilation $(date)"
     704    do_compile_sh "LMDZ" "$jobcmd ./$makelmdz $opt_rad $opt_cosp $opt_makelmdz_xios $opt_aer $opt_inlandsis $opt_strataer $opt_isotopes -p $compphysiq -d ${grid_resolution} -v $fcm_veget_version $para_compile_opt $fortran_file"
    724705
    725706    # Check executable
     
    731712}
    732713
     714function get_dynamico_icosa_version {
     715  if [[ $icolmdz = 1 ]]; then
     716    echo "Checking DYNAMICO source version"
     717    cd "$MODEL/modipsl/modeles"
     718    if [[ ! -d DYNAMICO ]]; then
     719      git clone https://gitlab.in2p3.fr/ipsl/projets/dynamico/dynamico.git DYNAMICO
     720    fi
     721    cd DYNAMICO
     722    git checkout master && git checkout $dynamico_commit
     723    cd - > /dev/null
     724
     725    echo "Checking ICOSA_LMDZ source version"
     726    if [[ ! -d ICOSA_LMDZ ]]; then
     727      svn checkout http://svn.lmd.jussieu.fr/LMDZ/ICOSA_LMDZ
     728    fi
     729    cd ICOSA_LMDZ
     730    svn up -r 5320
     731  fi
     732}
     733
    733734function compile_icolmdzor {
    734735    if [[ $icolmdz = 1 ]]; then
    735 
    736 #      install_arch "DYNAMICO"
    737736      install_arch "ICOSA_LMDZ"
    738 
    739       cd "$LMDZPATH"
    740737      local para_compile_opt="-parallel $parallel"; if [[ $parallel = "none" ]]; then para_compile_opt=""; fi
    741738
    742739      # LMDZ physics package library already available in LMDZ/config/lib directory
     740
    743741      # Compile DYNAMICO
    744       cd ../DYNAMICO
     742      cd "$MODEL/modipsl/modeles/DYNAMICO"
     743
     744      # Need to get rather than install the archs as DYNAMICO uses FCMv2 that does not understand the makefile syntax ($shell)
    745745      cd arch
    746 # Need to get rather than install the archs as DYNAMICO uses FCMv2 that does not understand the makefile syntax ($shell)
    747       wget http://lmdz.lmd.jussieu.fr/pub/src_archives/misc/arch/DYNAMICO/arch-$arch.env
    748       wget http://lmdz.lmd.jussieu.fr/pub/src_archives/misc/arch/DYNAMICO/arch-$arch.fcm
    749       wget http://lmdz.lmd.jussieu.fr/pub/src_archives/misc/arch/DYNAMICO/arch-$arch.path
     746      wget "http://lmdz.lmd.jussieu.fr/pub/src_archives/misc/arch/DYNAMICO/arch-$arch.env"
     747      wget "http://lmdz.lmd.jussieu.fr/pub/src_archives/misc/arch/DYNAMICO/arch-$arch.fcm"
     748      wget "http://lmdz.lmd.jussieu.fr/pub/src_archives/misc/arch/DYNAMICO/arch-$arch.path"
    750749      cd ..
    751750
    752       dynamicolog="$(pwd)/dynamico.log"
    753       echo "Compile DYNAMICO"
    754       echo "$jobcmd ./make_icosa $optim_flag -arch $arch -job $make_j $para_compile_opt -external_ioipsl -with_xios" > compile.sh
    755       chmod +x ./compile.sh
    756       if ! ./compile.sh &> "$dynamicolog"; then
    757         echo "STOP: DYNAMICO compilation failed, exiting"; exit 1
    758       fi
    759       echo "Finished DYNAMICO compilation $(date)"
     751      do_compile_sh "DYNAMICO" "$jobcmd ./make_icosa $optim_flag -arch $arch -job $make_j $para_compile_opt -external_ioipsl -with_xios"
    760752
    761753      # Compile icosa_lmdz
    762       echo "Bin PATH before icosalmdz" $PATH
    763       cd ../ICOSA_LMDZ
    764       icosalog="$(pwd)/icosa.log"
    765       echo "Compile interface ICOSA_LMDZ"
    766       echo "$jobcmd ./make_icosa_lmdz -arch $arch -j $make_j -nodeps -p lmd $optim_flag $para_compile_opt -with_orchidee" > compile.sh
    767       chmod +x ./compile.sh
    768       if ! ./compile.sh &> "$icosalog"; then
    769         echo "STOP: ICOSA_LMDZ compilation failed, exiting"; exit 1
    770       fi
    771       echo "Finished ICOSA_LMDZ compilation $(date)"
     754      echo "Bin PATH before icosalmdz" "$PATH"
     755      cd "$MODEL/modipsl/modeles/ICOSA_LMDZ"
     756      do_compile_sh "ICOSA_LMDZ" "$jobcmd ./make_icosa_lmdz -arch $arch -j $make_j -nodeps -p lmd $optim_flag $para_compile_opt -with_orchidee"
    772757      echo "# Running environment for icosa_lmdz" > icosalmdz.env
    773758      echo "# "                                   >> icosalmdz.env
     
    10241009      cd "$MODEL/modipsl/modeles/ICOSA_LMDZ"
    10251010      if [[ $bench = 1 ]]; then
    1026         namebench=bench_icolmdz_nbp10_79
     1011        namebench="bench_icolmdz_nbp10_79"
     1012        rm -rf $namebench
    10271013        myget "3DBenchs/$namebench.tar.gz"
    1028         mkdir $namebench
     1014        mkdir -p $namebench
    10291015        tar xf "$namebench.tar.gz" -C "$namebench" --strip-components=1
    10301016        cd $namebench
     
    10581044read_cmdline_args "$@"
    10591045ensure_correct_option_combinations
    1060 download_model
     1046download_modipsl_tar
    10611047init_arch
    10621048check_available_software
    10631049get_lmdz_version
     1050get_dynamico_icosa_version
    10641051get_orchidee_version
    10651052install_netcdf
     
    10701057compile_icolmdzor
    10711058run_bench
    1072 if [ ! $? = 0 ]; then exit 1; fi
    10731059run_bench_icosa
Note: See TracChangeset for help on using the changeset viewer.