Changeset 6827


Ignore:
Timestamp:
05/13/24 11:38:26 (5 weeks ago)
Author:
jgipsl
Message:

Add option to compress XIOS and LMDZ/libo in tar files after compilation. By default compression is done but can be deactivated with option -notar.
See -h for more information. Done by Karine Laurent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CONFIG/UNIFORM/v7/IPSLCM7/compile_ipslcm7.sh

    r6808 r6827  
    5353netcdf_lib="" 
    5454 
     55## Arguments in order to compress temporary files after compilation 
     56tar=no 
     57comp_tar=yes 
     58 
    5559# Output text file for compilation of each component 
    5660datestr=`LC_ALL=C date +"%Y%m%dT%H%M"` 
     
    9094                   and a link will be set to the choosen model version. Default version is currently ORCHIDEE_2_2 (-orch22). 
    9195[-orchdriver]   Activate compilation of orchidee offline drivers 
     96[-tar]: option to compress XIOS repository that takes many inodes without compilation 
     97[-comp_tar]: option to compile and compress XIOS repository if compilation succed 
     98[-notar]: do not compress XIOS repository 
     99 
    92100 
    93101Example 1: Default compilation of IPSLCM7  
     
    114122Example 7: Compilation of sub-configuration LMDZOR :  
    115123./compile_ipslcm7.sh -subconfig LMDZOR 
     124 
     125Example 5: Compile without compressing XIOS and LMDZ/libo in tar files 
     126./compile_ipslcm7.sh -notar 
    116127 
    117128end_help 
     
    140151        "-orchdriver") orchdriver="-driver";  shift ;; 
    141152        "-chimie")     optchimie=$2; shift ; shift;; 
     153        "-tar")             tar=yes ; shift ;; 
     154        "-comp_tar")        comp_tar=yes ; shift ;; 
     155        "-notar")           comp_tar=no ; shift ;; 
    142156        *)             echo "unknown option "$1" , exiting..." ; exit 
    143157    esac 
     
    153167echo "   optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch " >> $outfile  
    154168echo "   full_flag=$full_flag, full_xios=$full_xios, full_lmdz=$full_lmdz, full_orch=$full_orch, full_nemo=$full_nemo, full_dyna=$full_dyna, full_oasis=$full_oasis" >> $outfile  
     169echo "   tar=$tar, comp_tar=$comp_tar" >> $outfile 
    155170echo "   compinca=$compinca compnemo=$compnemo compoasis=$compoasis compdyna=$compdyna complmdz=y comporch=y compxios=y" >> $outfile 
    156171echo >> $outfile 
     
    163178else 
    164179    echo "ERROR in version of ORCHIDEE. It is only possible to have orch22 or orch4 for now" 
     180fi 
     181 
     182# Compress XIOS and LMDZ/libo without compiling if tar=yes 
     183if [ $tar == yes ] ; then 
     184    echo "Option tar activated to compress XIOS and LMDZ/libo. No compilation will be done." 
     185    echo >> $outfile 
     186    echo "Option tar activated to compress XIOS and LMDZ/libo. No compilation will be done." >> $outfile 
     187    if [[ -d $modipsl/modeles/XIOS ]] ; then 
     188        echo " Now tar XIOS repository" 
     189        echo " Now tar XIOS repository" >> $outfile 
     190        tar -cf $modipsl/modeles/XIOS.tar $modipsl/modeles/XIOS 
     191        rm -rf $modipsl/modeles/XIOS 
     192    else 
     193        echo " No XIOS repository to compress" 
     194        echo " No XIOS repository to compress" >> $outfile 
     195    fi 
     196 
     197    if [[ -d $modipsl/modeles/LMDZ/libo ]] ; then 
     198        echo "Now tar LMDZ/libo repository" 
     199        echo "Now tar LMDZ/libo repository" >> $outfile 
     200        tar -cf $modipsl/modeles/LMDZ/libo.tar $modipsl/modeles/LMDZ/libo 
     201        rm -rf $modipsl/modeles/LMDZ/libo 
     202    else 
     203        echo " No LMDZ/libo repository to compress" 
     204        echo " No LMDZ/libo repository to compress" >> $outfile 
     205    fi 
     206 
     207    echo "END OF SCRIPT" 
     208    echo "END OF SCRIPT" >> $outfile 
     209    exit 
    165210fi 
    166211 
     
    275320 
    276321## 2.3 Compile xios 
     322echo; echo "NOW DECOMPRESS XIOS IF NEEDED" 
     323# First check if XIOS needs to be decompressed 
     324# In priority search for modeles/XIOS_${optmode}.tar but if it doesn't exist take 
     325# the first which is found.  
     326if [[ -d $modipsl/modeles/XIOS ]] ; then 
     327    echo "Found XIOS -> no decompress needs to be do";  >> $outfile 
     328elif [[ -f $modipsl/modeles/XIOS_${optmode}.tar ]]; then 
     329    echo >> $outfile 
     330    echo "Found XIOS_${optmode}.tar -> decompress repository" >> $outfile 
     331    # Do not write "tar -xf ... -C $modipsl/modeles because it's modeles/XIOS that is compressed, not only XIOS/ 
     332    tar -xf $modipsl/modeles/XIOS_${optmode}.tar -C $modipsl/ >> $outfile 2>&1 
     333elif [[ -f $modipsl/modeles/XIOS_prod.tar ]]; then 
     334    echo >> $outfile 
     335    echo "Found XIOS_prod.tar -> decompress repository" >> $outfile 
     336    tar -xf $modipsl/modeles/XIOS_prod.tar -C $modipsl/ >> $outfile 2>&1 
     337elif [[ -f $modipsl/modeles/XIOS_debug.tar ]]; then 
     338    echo >> $outfile 
     339    echo "Found XIOS_debug.tar -> decompress repository" >> $outfile 
     340    tar -xf $modipsl/modeles/XIOS_debug.tar -C $modipsl/ >> $outfile 2>&1 
     341elif [[ -f $modipsl/modeles/XIOS_dev.tar ]]; then 
     342    echo >> $outfile 
     343    echo "Found XIOS_dev.tar -> decompress repository" >> $outfile 
     344    tar -xf $modipsl/modeles/XIOS_dev.tar -C $modipsl/ >> $outfile 2>&1 
     345elif [[ -f $modipsl/modeles/XIOS.tar ]]; then 
     346    echo >> $outfile 
     347    echo "Found XIOS.tar -> decompress repository" >> $outfile 
     348    tar -xf $modipsl/modeles/XIOS.tar -C $modipsl/ >> $outfile 2>&1 
     349else 
     350    echo "XIOS source code was not found. Exit" 
     351    echo "XIOS source code was not found. Exit" >> $outfile 
     352    exit 
     353fi 
     354 
    277355cd $modipsl/modeles/XIOS 
    278356echo; echo "NOW COMPILE XIOS" 
     
    461539cd $modipsl/modeles/LMDZ 
    462540 
     541# First check if LMDZ/libo exist or if it could be decompressed 
     542# If neither LMDZ/libo or LMDZ/libo_${optmode}.tar exists, nothing is done. It'll be created 
     543# during the compilation. 
     544echo; echo "NOW DECOMPRESS LMDZ/libo IF NEEDED" 
     545if [[ -d $modipsl/modeles/LMDZ/libo ]] ; then 
     546    echo "Found LMDZ/libo -> no decompress needs to be done"; >> $outfile 
     547elif [[ -f $modipsl/modeles/LMDZ/libo_${optmode}.tar ]]; then 
     548    echo "Found LMDZ/libo_${optmode}.tar -> decompress repository"; >> $outfile 
     549    echo >> $outfile 
     550    tar -xf $modipsl/modeles/LMDZ/libo_${optmode}.tar -C $modipsl/ >> $outfile 2>&1 
     551fi 
     552 
     553 
    463554# Temporary use of SOURCES/LMDZ to handle modifications needed by IPSLCM7 for LMDZ 4876 
    464555# To be removed for newer versions of LMDZ 
     
    698789fi 
    699790 
     791# Compress XIOS and LMDZ/libo 
     792if [ $comp_tar == yes ] && [ -d $modipsl/modeles/XIOS ] ; then 
     793    echo "Option comp_tar activated, now compress XIOS and LMDZ/libo" 
     794    echo "Option comp_tar activated, now compress XIOS and LMDZ/libo" >> $outfile 
     795    tar -cf $modipsl/modeles/XIOS_${optmode}.tar $modipsl/modeles/XIOS 
     796    rm -rf $modipsl/modeles/XIOS 
     797    tar -cf $modipsl/modeles/LMDZ/libo_${optmode}.tar $modipsl/modeles/LMDZ/libo 
     798    rm -rf $modipsl/modeles/LMDZ/libo 
     799fi 
     800 
    700801echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile 
    701802echo ls -lrt modipsl/bin >> $outfile 
Note: See TracChangeset for help on using the changeset viewer.