Changeset 4900


Ignore:
Timestamp:
Apr 15, 2024, 11:18:38 AM (3 weeks ago)
Author:
abarral
Message:

change bundled veget version
fix veget version update
unbundle XIOS
split init and install arch
fix ORCHIDEE XIOS library forwarding
fix local netcdf compil
fix Makefile linking

Location:
BOL/script_install_amaury
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • BOL/script_install_amaury/arch_local/arch-local-gfortran-parallel.fcm

    r4896 r4900  
    1212%BASE_CFLAGS         -w -std=c++11 -D__XIOS_EXCEPTION  # xios
    1313# /!\ LD must be written in Makefile syntax
    14 %BASE_LD             -Wl,-rpath=$(shell dirname $(readlink -f "$(which mpif90)"))/../lib:$(shell nf-config --prefix)/lib -lstdc++
     14%BASE_LD             -Wl,-rpath=$(shell dirname $(shell readlink -f "$(shell which mpif90)"))/../lib:$(shell nf-config --prefix)/lib -lstdc++
    1515%BASE_INC            -D__NONE__  # xios
    1616
     
    2525
    2626%MPI_FFLAGS          -fcray-pointer
    27 %MPI_LD              -L$(shell dirname $(readlink -f "$(which mpif90)"))/../lib -lmpi
     27%MPI_LD              -L$(shell dirname $(shell readlink -f "$(shell which mpif90)"))/../lib -lmpi
    2828%OMP_LD              -fopenmp
    2929%OMP_FFLAGS          -fopenmp -fcray-pointer
  • BOL/script_install_amaury/arch_local/arch-local-gfortran.path

    r4896 r4900  
    1 NETCDF_INCDIR="$(nf-config --fflags)"
    2 NETCDF_LIBDIR="$(nf-config --flibs)"
    3 NETCDF_LIB="$(nf-config --flibs)"
     1NETCDF_INCDIR="-I$(nf-config --includedir)"
     2# Ugly hack for orchidee <=2.0
     3NETCDF_LIBDIR="-L$(nf-config --flibs | sed -e "s/-L//")"
    44NETCDF95_INCDIR="-I$LMDGCM/../../include"
    55NETCDF95_LIBDIR="-L$LMDGCM/../../lib"
  • BOL/script_install_amaury/install_lmdz.sh

    r4896 r4900  
    3737
    3838### Functions
    39 # TODO add make_j parallel argument -> check what is used for libigcm
    4039
    4140function myget { # Get a file from LMDZ repository
     
    137136        -physiq     to choose which physics package to use (default <$physiq>)
    138137
    139         -veget      surface/vegetation scheme treatment controlled by the single variable veget which can have the following values: none: bucket scheme (default); CMIP6: orchidee version used in CMIP exercise, rev 5661; number: orchidee version number (default $veget)
     138        -veget      surface/vegetation scheme treatment controlled by the single variable veget which can have the following values: none: bucket scheme (default); CMIP6 | veget2.0: orchidee version used in CMIP exercise, rev 5661; veget2.2: orchidee branch 2.2, rev 8529 (bundled); number: orchidee version number (default $veget)
    140139
    141140        -arch       name of the arch to use (default <$arch>)
     
    190189
    191190    # Check on veget version
    192     if [[ $veget != 'none' && $veget != "CMIP6" ]]; then
     191    if [[ $veget != 'none' && $veget != "CMIP6" && $veget != "orch2.0" && $veget != "orch2.2" ]]; then
    193192        re='^[0-9]+$'
    194193        if ! [[ $veget =~ $re ]]; then
     
    200199    if [[ $veget = 'none' ]]; then
    201200        suff_orc=''
    202         #For use with tutorial, orchidee_rev is also defined (will be
    203         #written in surface_env at the end of the script)
    204         orchidee_rev=''
    205201    else
    206202        suff_orc='_orch'
     
    284280}
    285281
    286 function download_model_AMAURY {  # TODO
     282function download_model_AMAURY {  # TODO TEMP while waiting for tar: we copy the base from a local path = IPSLCM7 + ORCH2.2 latest
     283    if [[ ! -d ../MODEL_REF ]]; then
     284        cd ..
     285        mkdir MODEL_REF
     286        cd MODEL_REF
     287        svn co --username icmc_users https://forge.ipsl.fr/igcmg/svn/modipsl/trunk modipsl
     288        cd modipsl/util
     289        ./model IPSLCM7_work
     290        rm -rf oasis3-mct
     291        cd ../modeles
     292        rm -rf ICOSA_LMDZ ORCHIDEE_4 ORCHIDEE_2_2 NEMO DYNAMICO XIOS INCA
     293        svn co svn://forge.ipsl.fr/orchidee/branches/ORCHIDEE_2_2/ORCHIDEE
     294        cd ../../../script_install
     295    fi
     296
     297    if [[ ! -d "$MODEL" ]]; then
     298        \cp -r ../MODEL_REF .
     299        mv MODEL_REF "$MODEL"
     300    fi
    287301    MODEL=$(readlink -f "$MODEL"); echo "$MODEL"  # absolute path
    288302
     
    295309}
    296310
    297 function install_arch {
     311function init_arch {
    298312    if [[ ! -d $arch_dir ]]; then
    299313        echo "Error: no arch dir $arch_dir"; exit 1
     
    314328    # check compiler
    315329    compiler=$(< "$fcm_path" grep "%COMPILER" | sed -e "s/%COMPILER\s*//")
    316 
    317     # Copy arch to different components
    318     # TODO check that this doesn't error if the source and destination are the same
    319     for dir in "IOIPSL" "ORCHIDEE" "LMDZ" "XIOS"; do
    320         \cp -f "$arch_dir/arch-$arch.fcm" "$MODEL/modipsl/modeles/$dir/arch"
    321         \cp -f "$arch_dir/arch-$arch.path" "$MODEL/modipsl/modeles/$dir/arch"
    322     done
    323 
    324     # TODO TEMP compat w/ old orch version - make a proper case later
    325     sed -i'' -e "s/-I//" -e "s/-L//" "$MODEL/modipsl/modeles/ORCHIDEE/arch/arch-$arch.path"  # /!\ we only replace first occurence on purpose
    326 
    327     # Adapt for XIOS, which uses different naming conventions
    328     sed -i'' -e "s/%COMPILER/%FCOMPILER/" -e "s/%LINK/%LINKER/" -e "s/-fdefault-real-8//" "$MODEL/modipsl/modeles/XIOS/arch/arch-$arch.fcm"
     330}
     331
     332function install_arch {
     333    local component=$1
     334
     335    if [[ ! -f "$MODEL/modipsl/modeles/$component/arch/arch-$arch.fcm" ]]; then
     336        \cp -f "$arch_dir/arch-$arch.fcm" "$MODEL/modipsl/modeles/$component/arch"
     337        \cp -f "$arch_dir/arch-$arch.path" "$MODEL/modipsl/modeles/$component/arch"
     338
     339        if [[ $component = "XIOS" ]]; then
     340            # Adapt for XIOS, which uses different naming conventions
     341            sed -i'' -e "s/%COMPILER/%FCOMPILER/" -e "s/%LINK/%LINKER/" -e "s/-fdefault-real-8//" "$MODEL/modipsl/modeles/XIOS/arch/arch-$arch.fcm"
     342        elif [[ $component = "ORCHIDEE" ]]; then
     343            if [[ $orcbranch = "/tags/ORCHIDEE_2_0/ORCHIDEE" ]]; then  # 2.0 and before have a different fcm convention
     344                sed -i'' -e "s/-I//" -e "s/-L//" "$MODEL/modipsl/modeles/ORCHIDEE/arch/arch-$arch.path"  # /!\ we only replace first occurence on purpose
     345            fi
     346        fi
     347    fi
    329348}
    330349
    331350function install_netcdf {
    332351    echo "Installing Netcdf"
     352    local ncdf_compiler="$compiler"
    333353
    334354    if [[ $netcdf = 0 ]]; then
     
    338358
    339359        # Convert non-basic compiler
    340         local ncdf_compiler="$compiler"
    341360        case $compiler in  # TODO check if it works with other base compilers
    342361            mpif90) ncdf_compiler=$($compiler --help | head -n 1 | cut -f 2 -d " ")
     
    365384        fi
    366385
    367 
    368386        echo "Repertoire netcdf $ncdfdir"
    369387        if [[ ! -d $ncdfdir ]]; then
     
    426444
    427445function install_IOIPSL {
     446    install_arch "IOIPSL"
     447
    428448    cd "$MODEL/modipsl/modeles/IOIPSL"
    429449    ioipsllog="$(pwd)/ioipsl.log"
     
    466486
    467487        cd XIOS
     488
     489        install_arch "XIOS"
     490
     491        echo "Starting XIOS compilation"
    468492        if ! ./make_xios --arch "$arch" --job 8 > "$xioslog" 2>&1; then
    469493            echo "XIOS compilation failed, exiting"; exit 1
     
    478502
    479503function get_orchidee_version {  # Set / Check ORCHIDEE version
    480     if [[ $veget = "none" ]]; then
    481         veget_version="false"
    482     elif [[ $veget = "CMIP6" ]]; then
    483         veget_version=orchidee2.0
    484     else # specific orchidee revision newer than CMIP6, on 2_1 or 2_2 branches
    485         veget_version=orchidee2.1
    486         if [[ $veget -lt 4465 ]]; then
    487             echo 'ORCHIDEE version must be >=4465, exiting'
    488             exit 1
    489         fi
    490 
     504    local fetch_rev=""
     505    orcbranch=""
     506    case $veget in
     507        "none") fcm_veget_version="false";;
     508        "orch2.0" | "CMIP6") fcm_veget_version=orchidee2.0; fetch_rev=6592;;
     509        "orch2.2") fcm_veget_version=orchidee2.1; orcbranch="ORCHIDEE_2_2" ;; # the bundled version
     510        *) fetch_rev=$veget
     511    esac
     512
     513    if [[ -n $fetch_rev ]]; then
     514        echo "Fetching orch $fetch_rev from the repository"
     515        orcbranch=$(svn log -v -q svn://forge.ipsl.jussieu.fr/orchidee/ -r "$fetch_rev" |grep ORCHIDEE |head -1| sed -e 's:ORCHIDEE/.*$:ORCHIDEE:' | awk '{print $2}')
     516        echo "branch is $orcbranch"
     517        if [[ $fetch_rev -lt 4465 ]]; then echo 'ORCHIDEE version must be >=4465, exiting'; exit 1; fi
     518        \rm -rf "$MODEL/modipsl/modeles/ORCHIDEE"
     519        echo "IF YOU INSTALL ORCHIDEE THE VERY FIRST TIME, ASK for PASSWORD at orchidee-help@listes.ipsl.fr"
     520        cd "$MODEL/modipsl/modeles"
    491521        set +e
    492         svn upgrade
    493         local orcbranch
    494         orcbranch=$(svn log -v -q svn://forge.ipsl.jussieu.fr/orchidee/ -r "$veget" |grep ORCHIDEE |head -1| sed -e 's:ORCHIDEE/.*$:ORCHIDEE:' | awk '{print $2}')
    495         echo "IF YOU INSTALL ORCHIDEE THE VERY FIRST TIME, ASK for PASSWORD at orchidee-help@listes.ipsl.fr"
    496         svn switch -r "$veget" --accept theirs-full "svn://forge.ipsl.jussieu.fr/orchidee/$orcbranch"
    497         svn log -r "$veget" | grep "$veget"
    498         if ! svn log -r "$veget" | grep "$veget"; then
    499             echo 'Cannot update ORCHIDEE as not on the right branch for ORCHIDEE'
    500             exit 1
    501         fi
    502         svn update -r "$veget"
     522        svn co -r "$fetch_rev" "svn://forge.ipsl.jussieu.fr/orchidee/$orcbranch"
    503523        set -e
     524        cd -
    504525    fi
    505526}
     
    507528function compile_orchidee {
    508529    get_orchidee_version
     530    install_arch "ORCHIDEE"
     531
    509532    ORCHPATH=""
    510533
     
    529552        fi
    530553
    531         # TODO check that this works with old orchidee versions (cf. -d tools)
    532         local varenv="IOIPSL_LIBDIR_=$IOIPSL_LIBDIR_ IOIPSL_INCDIR_=$IOIPSL_INCDIR_ ORCHPATH=$ORCHPATH"
     554        local varenv="IOIPSL_LIBDIR_=$IOIPSL_LIBDIR_ IOIPSL_INCDIR_=$IOIPSL_INCDIR_ ORCHPATH=$ORCHPATH XIOS_INCDIR_=$XIOS_INCDIR_ XIOS_LIBDIR_=$XIOS_LIBDIR_"
    533555        if [[ $parallel = "none" ]]; then
    534556            echo "$varenv ./makeorchidee_fcm $xios_orchid $opt_orc -parallel none -arch $arch -j $make_j" > compile.sh
     
    578600function compile_lmdz {
    579601    get_lmdz_version
     602    install_arch "LMDZ"
    580603
    581604    exe_name="bin/gcm_${grid_resolution}_phylmd_${rad}${suff_exe}${suff_orc}.e"
     
    601624    makelmdz="makelmdz_fcm $optim_debug -arch $arch -j $make_j"
    602625    if [[ $parallel = "none" ]]; then
    603         echo "$varenv ./$makelmdz $opt_rad $opt_cosp -d ${grid_resolution} -v $veget_version gcm " > compile.sh
    604     else
    605         echo "$varenv ./$makelmdz $opt_rad $opt_cosp $opt_makelmdz_xios -d ${grid_resolution} -v $veget_version -mem -parallel $parallel gcm" > compile.sh
     626        echo "$varenv ./$makelmdz $opt_rad $opt_cosp -d ${grid_resolution} -v $fcm_veget_version gcm " > compile.sh
     627    else
     628        echo "$varenv ./$makelmdz $opt_rad $opt_cosp $opt_makelmdz_xios -d ${grid_resolution} -v $fcm_veget_version -mem -parallel $parallel gcm" > compile.sh
    606629    fi
    607630    echo "Compiling lmdz using $(\cat compile.sh) (log: $lmdzlog) $(date)"
     
    828851#download_model
    829852download_model_AMAURY
    830 install_arch
     853init_arch
    831854check_available_software
    832855install_netcdf
Note: See TracChangeset for help on using the changeset viewer.