Changeset 1853


Ignore:
Timestamp:
09/03/12 11:29:13 (12 years ago)
Author:
gpincka
Message:

principalement : enchainement du launcher parallele + gestion reprise du code parallele

Location:
TOOLS/PACK_IPSL
Files:
4 added
11 edited

Legend:

Unmodified
Added
Removed
  • TOOLS/PACK_IPSL/DEM_utilities.sh

    r1849 r1853  
    324324} 
    325325 
     326function check_libccc_user 
     327{ 
     328   # nom du présent prog (pour gestion des erreurs)  
     329   PROGNAME="DEM_utilities.sh" ######### 
     330   . /etc/profile  
     331   module list >& myModuleList.txt 
     332    
     333   if [ "x$?" != "x0" ] 
     334   then 
     335       # echo "La commande module list a rencontre un pb !" 
     336       DEM_errorSend "${PROGNAME}:${LINENO}:La commande module list a rencontre un pb !" 
     337   fi 
     338    
     339   if [ ! -e myModuleList.txt ] 
     340   then 
     341       # echo "Le fichier 'myModuleList.txt'  n existe pas" 
     342       DEM_errorSend "${PROGNAME}:${LINENO}:Le fichier 'myModuleList.txt' n'existe pas." 
     343   fi    
     344    
     345   # Presence de la chaine "n) nco/" ou n est un nombre   
     346   libLines=` grep -e '[[:digit:]]*) libccc_user/' myModuleList.txt ` 
     347   echo "libLines :" 
     348   echo $libLines 
     349   nb_of_libLines=`echo $libLines | wc -l ` 
     350   if [ "x${nb_of_libLines}" == "x0" ] 
     351   then 
     352       DEM_errorSend "${PROGNAME}:${LINENO}:Aucun libccc_user n'est charge" 
     353   fi 
     354 
     355   # Plus besoin du myModuleList.txt 
     356   # rm -f myModuleList.txt 
     357 
     358} 
    326359function prepareMonitoringDir 
    327360{ 
  • TOOLS/PACK_IPSL/Makefile

    r1849 r1853  
     1 
    12MPICC=mpicc 
     3MPICC_OPTS=-g 
     4# do not forget "module load libccc_user" before 
     5ifneq ($(CCC_LIBCCC_USER_LDFLAGS),) 
     6LIBS=$(CCC_LIBCCC_USER_LDFLAGS)  
     7MPICC_OPTS+=-D __HAVE_LIBCCC_USER__ -I$(CCC_LIBCCC_USER_INC_DIR) 
     8endif 
    29 
    310.PHONY: all 
    4 all : cmd_launch.exe  
     11all : glost_launch 
    512 
    6 %.exe:%.c 
    7         $(MPICC) -o $@ $< 
     13%:%.c 
     14        $(MPICC) $(MPICC_OPTS) -o $@ $< $(LIBS) 
     15 
     16clean: 
     17        $(RM) glost_launch 
    818 
    919 
     
    1222 
    1323 
    14  
  • TOOLS/PACK_IPSL/check_ncrcat_list.sh

    r1849 r1853  
    55# /ccc/scratch/cont003/incka/pierreg/IGCM_DEM/dataDMNFS_FromTitane/IGCM_OUT/IPSLCM5A/REDO/historicalGHG/v3.historicalGHG1R/output_tar/v3.historicalGHG1R_20101201_20121231_1M_histmthNMC.nc.list 
    66 
     7if [ ! -e $listToProcessFile ] 
     8then 
     9    echo "Le fichier en entree n'existe pas. STOP." 
     10    exit 1 
     11fi 
    712 
    8 # export INPUT_DMF_DATA=${SCRATCHDIR}/datasLabo/dataDMNFS_simple1 
    9 export INPUT_DMF_DATA=${SCRATCHDIR}/dataDMNFS_FromTitane 
    10  
    11 # export OUTPUT_STORE=${SCRATCHDIR}/PSEUDO_DMNFS_STORE 
    12 export OUTPUT_STORE=${SCRATCHDIR}/dataDMNFS_FromTitane_STORE 
    13  
    14 # export OUTPUT_WORK=${SCRATCHDIR}/PSEUDO_DMNFS_WORK 
    15 export OUTPUT_WORK=${SCRATCHDIR}/dataDMNFS_FromTitane_WORK 
    16  
    17 # export OUTPUT_CHECK=${SCRATCHDIR}/PSEUDO_DMNFS_CHECK 
    18 export OUTPUT_CHECK=${SCRATCHDIR}/dataDMNFS_FromTitane_CHECK 
     13# On renseigne les variables d'environnement (ici surtout pour la var OUTPUT_CHECK)  
     14. load_ipslPack_env.sh 
    1915 
    2016 
     
    2824source ${EXE_DIR}/DEM_utilities.sh 
    2925 
    30 dirPathOfListFile=$( dirname  $listToProcessFile ) 
    31 dirnameOfListFile=$( basename $dirPathOfListFile ) 
     26# Ca sert a quoi tout ca ? 
     27# dirPathOfListFile=$( dirname  $listToProcessFile ) 
     28# dirnameOfListFile=$( basename $dirPathOfListFile ) 
    3229 
    3330# rep de simu : celui contenant le rep qui contient la liste 
    34 PATH_SIMU=$( dirname  $dirPathOfListFile ) 
     31# PATH_SIMU=$( dirname  $dirPathOfListFile ) 
     32 
    3533set=$listToProcessFile 
    3634 
     
    6361 
    6462echo 
    65 echo "Output file to write:" 
     63echo "ncrcat file to compare cdo cat file with :" 
    6664echo "$output_ncrcat_file" 
    6765echo 
  • TOOLS/PACK_IPSL/create_config_card.sh

    r1849 r1853  
    5656    echo "gpdebug : PATH_SIMUL_FULL :" # gpdebug : a virer 
    5757    echo "$PATH_SIMUL_FULL :" # gpdebug : a virer 
    58     PATH_SIMUL_SHORT=$(echo ${PATH_SIMUL_FULL} | sed "s%${SCRATCHDIR}/%%" ) # gpdebug : added 
     58    PATH_SIMUL_SHORT=$(echo ${PATH_SIMUL_FULL} | sed "s%${INPUT_DMF_DATA}/%%" ) # gpdebug : added 
    5959    echo "gpdebug : PATH_SIMUL_SHORT :" # gpdebug : a virer 
    6060    echo "$PATH_SIMUL_SHORT :" # gpdebug : a virer   
  • TOOLS/PACK_IPSL/enlarge_my_files.sh

    r1849 r1853  
    6262fi 
    6363 
    64 if [[ ! -d $PATH_SIMU/output_ncrcat || ! -d $PATH_SIMU/output_tar || ! -d $PATH_SIMU/restart_tar || ! -d $PATH_SIMU/store_cp || ! -d $PATH_SIMU/work_cp || ! -d $PATH_SIMU/debug_tar || ! -d $PATH_SIMU/other_tar ]] ; then 
     64if ( \ 
     65     [ ! -d $PATH_SIMU/output_ncrcat ] || \ 
     66     [ ! -d $PATH_SIMU/output_tar ]    || \ 
     67     [ ! -d $PATH_SIMU/restart_tar ]   || \ 
     68     [ ! -d $PATH_SIMU/store_cp ]      || \ 
     69     [ ! -d $PATH_SIMU/work_cp ]       || \ 
     70     [ ! -d $PATH_SIMU/debug_tar ]     || \ 
     71     [ ! -d $PATH_SIMU/other_tar ] \ 
     72   ) \ 
     73   && \ 
     74   [ ! -e $PATH_SIMU/tar_full_simul.list ] 
     75then 
    6576        `dirname $0`/enlarge_my_files.sh -h 
    6677        exit 
     
    599610        #----------------------------------- 
    600611         
    601 done     
     612done 
     613 
     614# if [ "$baseNameOfListFile" == "tar_full_simul.list" ] 
     615for set in $( ls $PATH_SIMU/tar_full_simul.list ) 
     616do 
     617        # set="${PATH_SIMU}/tar_full_simul.list" # gpdebug : foireux ? 
     618        #----------------------------------- 
     619        echo "#-------------------" 
     620        echo "Set: $set" 
     621        datestr=`LC_ALL=C date +"%Y%m%dT%H%M%S"` 
     622        datestr1=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
     623        statusfile=${set%%.list}.status 
     624        logfile=${set%%.list}_${datestr}.log 
     625 
     626        #----------------------------------- 
     627        # Create status file if not exists 
     628        if [ ! -e $statusfile ] ; then 
     629                echo "# Status ; DateStart ; DateEnd ; Command ; TarFileExists" > $statusfile 
     630        fi 
     631 
     632        #----------------------------------- 
     633        # Skip the set if last line of the status file is "COMPLETED" or "DELEGATE" 
     634        if tail -1 $statusfile | grep -q -E '(COMPLETED|DELEGATE)' ; then 
     635                printf "====> " 
     636                tail -1 $statusfile 
     637                exit 0 
     638        fi 
     639 
     640        #----------------------------------- 
     641        # Set output file name from list name 
     642        # echo "PATH_SIMU=$PATH_SIMU" 
     643        dirOfOutputFile=`echo $PATH_SIMU | sed "s;${IGCM_DEM};${OUTPUT_STORE};" ` 
     644        fileout=${dirnameOfListFile}.tar 
     645        # echo "dirnameOfListFile=$dirnameOfListFile" 
     646        outputfile=$dirOfOutputFile/${fileout} 
     647        mkdir -p $dirOfOutputFile 
     648        echo "Output file to write: $outputfile  tar_full_simul" 
     649         
     650        # exit 0 # a virer 
     651 
     652        #----------------------------------- 
     653        # Try 1 time before fire "FAILED" 
     654        # Waiting for CCRT command 
     655        tarcmd=tar 
     656        taroptions="--format=posix -W -cf" 
     657#       taroptions="--format=posix -cf" 
     658 
     659        filefirst=`head -n 1 $set` 
     660        dirinputfile=`dirname $filefirst` 
     661        cd $dirinputfile 
     662 
     663        set_local=${set%%.list}.local 
     664        > $set_local 
     665        for file in $( cat $set) ; do 
     666            basename $file >> $set_local  
     667        done 
     668#       ls 
     669         
     670        startTime=$( getDateMilliSeconds ) # gpdebug : time 
     671        resCmd=0 
     672        $tarcmd $taroptions $outputfile --dereference --files-from $set_local > $logfile 2>&1 # gpdebug : a retablir 
     673        resCmd=$? 
     674        meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time 
     675         
     676        # resultCmd=$( gives_0_or_1 ) 
     677        # if [ $resultCmd -eq 0 ] ; then 
     678        if [ $resCmd -eq 0 ] ; then 
     679            sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time 
     680            datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
     681            echo "DONE ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set); $logfile" >> $statusfile 
     682            echo "====> COMPLETED at try #$nbtries (at 1st shot on 1)" 
     683            echo "COMPLETED at try #$nbtries (at 1st shot on 1)" >> $statusfile 
     684        else 
     685            datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
     686            echo "====> FAILED at try #$nbtries"  
     687            echo "FAILED at try #$nbtries ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set) ; $logfile" >> $statusfile 
     688            exit 1 
     689        fi 
     690         
     691        #----------------------------------- 
     692done 
  • TOOLS/PACK_IPSL/launch_and_measureTime.sh

    r1849 r1853  
    11#!/bin/bash 
    22 
     3function update_tasks_list 
     4{ 
     5   local tasksListFile=$1 # fichier contenant la nouvelle liste de cmds 
     6   touch $tasksListFile 
     7   local logFileOfPrevPack=$2 # fichier log de relatif a l'execution de la derniere liste de cmds 
     8   local tasksListFileOfPrevPack=$3 # fichier contenant la derniere liste de cmds 
     9    
     10   > $tasksListFile 
     11    
     12   old_IFS=$IFS     # sauvegarde du séparateur de champ   
     13   IFS=$'\n'     # nouveau séparateur de champ, le caractère fin de ligne    
     14   for cmdReport in $( cat $logFileOfPrevPack ) 
     15   do   
     16       hasCmdGoodFormat=`echo $cmdReport | grep -e '^#executed by process' | wc -l ` 
     17       if [ "x${hasCmdGoodFormat}" == "x0" ] 
     18       then 
     19           continue 
     20       fi 
     21        
     22       local resCmd=`echo $cmdReport | awk '{print $9}' ` 
     23        
     24       if [ "x$resCmd" !=  "x0" ] 
     25       then 
     26           local cmdToPrint=`echo $cmdReport | awk '{print $NF}' ` 
     27           echo "./process_list.sh $cmdToPrint" >> ${tasksListFile} 
     28       fi 
     29   done 
     30   IFS=$old_IFS     # rétablissement du séparateur de champ par défaut 
     31    
     32   # Il faut aussi rajouter les cmds qui n'ont pas ete traitees du tout, 
     33   # par exemple en cas d'interruption du calculateur 
     34   # Pour cela, on boucle sur la derniere liste de cmds et on cherche dans le  
     35   # fichier log associe si certaines sont absentes. On remet ces commandes (absentes) 
     36   # dans la nouvelle liste 
     37   old_IFS=$IFS     # sauvegarde du séparateur de champ   
     38   IFS=$'\n'     # nouveau séparateur de champ, le caractère fin de ligne    
     39   for cmd in $( cat $tasksListFileOfPrevPack ) 
     40   do   
     41       local list=`echo $cmd | awk '{print $NF}' ` 
     42       hasListBeenTreated=`grep $list $logFileOfPrevPack | wc -l ` 
     43       if [ "x${hasListBeenTreated}" == "x0" ] 
     44       then 
     45           echo $cmd  >> ${tasksListFile} 
     46       fi 
     47        
     48  
     49   done 
     50   IFS=$old_IFS     # rétablissement du séparateur de champ par défaut      
     51 
     52} 
     53 
     54function getNumeroOfCurrentTry 
     55{ 
     56   local num_try="1" 
     57   tryNumFile=${USER_OUTPUT_PROGRESS}/numero_current_try.txt 
     58   if [ ! -e $tryNumFile ] 
     59   then 
     60       echo "Le fichier :" >> $badFailureFile 
     61       echo "$tryNumFile" >> $badFailureFile 
     62       echo "doit etre present dans le repertoire :" >> $badFailureFile 
     63       echo "${USER_OUTPUT_PROGRESS}" >> $badFailureFile 
     64       echo "et il doit contenir un numero d'essai" >> $badFailureFile 
     65       exit 1 
     66   fi 
     67   num_try=`head -n 1 $tryNumFile ` 
     68   echo $num_try 
     69    
     70} 
     71 
     72function getNumeroOfLastInstance 
     73{ 
     74    local num_instance="0" 
     75    local numTry=$1 
     76    ici=$PWD 
     77    local progressDirectory="${USER_OUTPUT_PROGRESS}/TRY__${numTry}" 
     78    if [ ! -e $progressDirectory ] 
     79    then 
     80        echo "fonction getNumeroOfLastInstance :" >> $badFailureFile 
     81        echo "Le repertoire :" >> $badFailureFile 
     82        echo "$progressDirectory" >> $badFailureFile 
     83        echo "devrait exister. Il n'existe pas." >> $badFailureFile 
     84        exit 1 
     85    fi     
     86    cd $progressDirectory 
     87    
     88    listFiles=`ls | grep -e "inputCmd__try__${numTry}__instance__[[:digit:]]\{1,2\}.list" ` 
     89    for listFile in $listFiles 
     90    do 
     91       num=`echo $listFile | awk -F"__" '{print $NF}' | awk -F"." '{print $1}' ` 
     92       if [ $num -gt $num_instance ] 
     93       then 
     94           num_instance=$num  
     95       fi 
     96    done   
     97    cd $ici 
     98    echo $num_instance 
     99 
     100 
     101} 
     102 
     103 
     104function check_progress 
     105{ 
     106   local file1=$1 
     107   local file2=$2 
     108   if [ "x${file1}" == "x" ] || [ "x${file2}" == "x" ] 
     109   then 
     110       echo "check_progress : Le nom d'au moins 1 des 2 fichiers d'entree est vide" >> $badFailureFile 
     111       exit 1 
     112   fi 
     113       
     114   if [ ! -e $file1 ] || [ ! -e $file2 ] 
     115   then 
     116       echo "check_progress : au moins un des 2 fichiers suivants n'existe pas :" >> $badFailureFile 
     117       echo "$file1" 
     118       echo "$file2" 
     119       exit 1 
     120   fi 
     121   local nbLineFile1=`cat $file1 | wc -l ` 
     122   local nbLineFile1=`cat $file2 | wc -l ` 
     123   if [ $nbLineFile1 -ne $nbLineFile1 ] 
     124   then 
     125       echo 1 
     126       return 
     127   fi 
     128    
     129   old_IFS=$IFS     # sauvegarde du séparateur de champ   
     130   IFS=$'\n'     # nouveau séparateur de champ, le caractère fin de ligne    
     131   for line in $( cat $file1 ) 
     132   do 
     133       # echo $line 
     134       local isLineInFile2=`grep $line $file2 | wc -l ` 
     135       if [ $isLineInFile2 -eq 0 ] 
     136       then 
     137           echo 1 
     138           return 
     139       fi  
     140   done 
     141   IFS=$old_IFS     # rétablissement du séparateur de champ par défaut    
     142   echo 0 
     143} 
     144 
     145 
     146function update_report 
     147{  
     148    > $reportFile # on vide le fichier rapport 
     149    echo "Execution of tasks :" >> $reportFile 
     150    echo "------------------" >> $reportFile 
     151    cat $inputCmd >> $reportFile 
     152    echo >> $reportFile 
     153    echo "Results of tasks :" >> $reportFile  
     154    echo "----------------" >> $reportFile 
     155    cat $output >> $reportFile 
     156    echo >> $reportFile 
     157    echo >> $reportFile 
     158 
     159} 
     160 
     161########## batch directives : begin ########## 
    3162#MSUB -r pack_ipsl          # Nom du job                 
    4 #MSUB -e IO_parallel/launchMeasureTimeOutput/pack_ipsl_%I.e 
    5 #MSUB -o IO_parallel/launchMeasureTimeOutput/pack_ipsl_%I.o 
    6 #MSUB -n 7            # Reservation du processus 
    7 #MSUB -T 2500            # Limite de temps elapsed du job (en secondes) 
     163### mutable directives ### 
     164#MSUB -o /ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_PROGRESS/zIGCM_OUT/LMDZ4OR_v2/detailed_pack_output/pack_ipsl_%I.o 
     165#MSUB -e /ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_PROGRESS/zIGCM_OUT/LMDZ4OR_v2/detailed_pack_output/pack_ipsl_%I.e 
     166#MSUB -n 4 
     167#MSUB -T 900 
    8168#MSUB -A tgcc0013 
    9169#MSUB -q standard 
    10 # #MSUB -q large 
    11170#MSUB -Qos test 
    12  
    13  
     171########## batch directives : end ########## 
    14172 
    15173export JOB_DIR=${LS_SUBCWD:-${PWD}} 
     
    17175source ${EXE_DIR}/DEM_utilities.sh 
    18176 
    19  
    20 export IGCM_DEM=${SCRATCHDIR}/IGCM_DEM 
    21  
    22  
    23 # inputCmd="myIO/inputCmd.list" 
    24 inputCmd="inputCmd_Realistic.list" 
    25 output="IO_parallel/output.log" 
    26  
    27 > ${inputCmd} 
    28  
    29 listOfDir="output_ncrcat output_tar restart_tar debug_tar store_cp work_cp" 
    30  
    31 for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do  
    32  
    33    PATH_SIMU=$( dirname $CONFIG ) 
    34    echo "PATH_SIMU=$PATH_SIMU" 
    35    echo "------------------------------------------" 
    36    for typeDir in $listOfDir 
    37    do 
    38        typeDirList=`find $PATH_SIMU -type d -name "$typeDir" ` 
    39        for dir in $typeDirList 
     177export badFailureFile=${USER_OUTPUT_PROGRESS}/badFailure.txt 
     178 
     179export numCurrentTry=$( getNumeroOfCurrentTry ) 
     180export progressDir="${USER_OUTPUT_PROGRESS}/TRY__${numCurrentTry}" 
     181if [ ! -e $progressDir ] 
     182then 
     183   echo "Le repertoire de suivi :" >> $badFailureFile 
     184   echo "$progressDir" >> $badFailureFile 
     185   echo "n'existe pas. STOP." >> $badFailureFile    
     186   exit 1 
     187fi 
     188export numPrevInstance=$( getNumeroOfLastInstance $numCurrentTry ) 
     189export numNewInstance=$(( $numPrevInstance + 1 )) 
     190 
     191export inputCmd="${progressDir}/inputCmd__try__${numCurrentTry}__instance__${numNewInstance}.list" 
     192export nextInputCmd="${progressDir}/nextInputCmd__try__${numCurrentTry}__instance__${numNewInstance}.list" 
     193export output="${progressDir}/packOutput__try__${numCurrentTry}__instance__${numNewInstance}.log" 
     194export reportFile="${progressDir}/report__try__${numCurrentTry}__instance__${numNewInstance}.log" 
     195 
     196 
     197export noInterruptFile="${progressDir}/noInterrupt__try__${numCurrentTry}__instance__${numNewInstance}.txt" 
     198 
     199 
     200# a virer 
     201#echo "inputCmd=$inputCmd" >> $badFailureFile 
     202#echo "nextInputCmd=$nextInputCmd" >> $badFailureFile 
     203#echo "output=$nextInputCmd" >> $badFailureFile 
     204#echo "reportFile=$nextInputCmd" >> $badFailureFile 
     205#echo "noInterruptFile=$noInterruptFile" >> $badFailureFile 
     206 
     207# exit 0 # a virer 
     208 
     209# a virer 
     210#if [ ${numNewInstance} -ge 4 ] 
     211#then 
     212#    echo "inputCmd=$inputCmd" >> $badFailureFile 
     213#    echo "nextInputCmd=$nextInputCmd" >> $badFailureFile 
     214#    echo "output=$nextInputCmd" >> $badFailureFile 
     215#    echo "reportFile=$nextInputCmd" >> $badFailureFile 
     216#    echo "noInterruptFile=$noInterruptFile" >> $badFailureFile 
     217#    echo >> $badFailureFile 
     218#fi 
     219 
     220if [ ${numCurrentTry} -le 1 ] && [ ${numNewInstance} -le 1 ] 
     221then 
     222    # C'est le tout premier essai 
     223    # on construit la liste des taches a effectuer en inventoriant les fichiers *.liste 
     224    # dans les rep contenus dans le fichier "config_card.liste" 
     225    > ${inputCmd} 
     226    for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do  
     227     
     228       PATH_SIMU=$( dirname $CONFIG ) 
     229       # echo "PATH_SIMU=$PATH_SIMU" 
     230 
     231       setOfListFiles=`find $PATH_SIMU -type f -name "*.list" ` 
     232       for file in $setOfListFiles 
    40233       do 
    41            # echo "dir=$dir" 
    42            listFilesInDir=`find $dir -name "*.list" ` 
    43            for file in $listFilesInDir 
    44            do 
    45                echo "./process_list.sh $file" >> ${inputCmd} 
    46            done 
     234            echo "./process_list.sh $file" >> ${inputCmd} 
    47235       done 
    48    done 
    49     
    50  
    51 done 
    52  
    53  
    54  
     236        
     237    done 
     238else 
     239    # if try > 1 && inst == 1 ==> construction liste cmd avec fichiers try - 1, derniere instance 
     240    #                             dans ce dernier cas, gerer une eventuelle interruption au try - 1 
     241    # if try > 1 && inst > 1  ==> construction liste cmd avec fichiers try, instance precedente 
     242    if [ ${numNewInstance} -ge 2 ] 
     243    then 
     244        nextInputCmd_of_PrevInst="${progressDir}/nextInputCmd__try__${numCurrentTry}__instance__${numPrevInstance}.list" 
     245        if [ ! -e $nextInputCmd_of_PrevInst ] 
     246        then 
     247            echo "Le fichier suivant :" >> $badFailureFile 
     248            echo "$nextInputCmd_of_PrevInst" >> $badFailureFile 
     249            echo "n'existe pas. Il devrait exister. STOP." >> $badFailureFile 
     250            exit 1 
     251        fi 
     252        cat $nextInputCmd_of_PrevInst > ${inputCmd} 
     253     
     254    else # numNewInstance == 1 
     255        numPrevTry=$(( $numCurrentTry - 1 )) 
     256        # echo "numCurrentTry=$numCurrentTry" >> $badFailureFile # a virer 
     257        # echo "numPrevTry=$numPrevTry" >> $badFailureFile # a virer 
     258        # exit 1 # a virer 
     259        numLastInstInstanceInPrevTry=$( getNumeroOfLastInstance $numPrevTry ) 
     260        noInterruptFile="${progressDir}/noInterrupt__try__${numPrevTry}__instance__${numLastInstInstanceInPrevTry}.txt" 
     261        if [ ! -e $noInterruptFile ] 
     262        then 
     263            # il y a eu interruption non prevue au dernier essai, il faut recomposer la liste des cmds avec les resultats 
     264            # de l'essai precedent, derniere instance 
     265            prevProgressDir="${USER_OUTPUT_PROGRESS}/TRY__${numPrevTry}" 
     266            nextInputCmd_of_LastInst="${prevProgressDir}/nextInputCmd__try__${numPrevTry}__instance__${numLastInstInstanceInPrevTry}.list" 
     267            output_of_LastInst="${prevProgressDir}/packOutput__try__${numPrevTry}__instance__${numLastInstInstanceInPrevTry}.log" 
     268            inputCmd_of_LastInst="${prevProgressDir}/inputCmd__try__${numPrevTry}__instance__${numLastInstInstanceInPrevTry}.list" 
     269            if [ ! -e $output_of_LastInst ] || [ ! -e $inputCmd_of_LastInst ] 
     270            then 
     271                echo "Les fichiers suivants :" >> $badFailureFile 
     272                echo "$output_of_LastInst" >> $badFailureFile 
     273                echo "$inputCmd_of_LastInst" >> $badFailureFile 
     274                echo "n'existent pas. Il devrait exister. STOP." >> $badFailureFile 
     275                exit 1 
     276            fi 
     277             
     278            update_tasks_list ${nextInputCmd_of_LastInst} ${output_of_LastInst} ${inputCmd_of_LastInst} 
     279            cat $nextInputCmd_of_LastInst > ${inputCmd} 
     280        else 
     281            nextInputCmd_of_LastInst="${progressDir}/nextInputCmd__try__${numPrevTry}__instance__${numLastInstInstanceInPrevTry}.list" 
     282            if [ ! -e $nextInputCmd_of_LastInst ] 
     283            then 
     284                echo "Le fichier suivant :" >> $badFailureFile 
     285                echo "$nextInputCmd_of_LastInst" >> $badFailureFile 
     286                echo "n'existe pas. Il devrait exister. STOP." >> $badFailureFile 
     287                exit 1 
     288            fi 
     289            cat $nextInputCmd_of_LastInst > ${inputCmd} 
     290        fi  
     291         
     292    fi 
     293fi 
     294 
     295# Initialisation du rapport : par defaut, les calculs ont ete interrompus 
     296echo "No report. Le computation must have interrupted." > $reportFile 
     297 
     298# exit 0 # a virer 
     299 
     300# a virer ######################################### 
     301#if [ ${numNewInstance} -ge 4 ] 
     302#then 
     303#    echo >> $badFailureFile 
     304#    echo "4eme instance. STOP." >> $badFailureFile 
     305#    exit 1 
     306#fi 
     307################################################### 
    55308startTime=$( getDateMilliSeconds ) 
    56309echo "start time:$startTime" >> $timeHandlingFile 
    57310 
    58 ccc_mprun  ./cmd_launch.exe ${inputCmd} 2>${output} 
    59 # ./cmd_launch.exe ${inputCmd} 2>${output} 
    60 # ccc_mprun -p standard -n ${BRIDGE_MSUB_NPROC} ./cmd_launch.exe ${inputCmd} 2>myIO/output.log 
    61 # mpirun -n 4 ./cmd_launch.exe myIO/inputCmd10.list 2>myIO/output.log 
     311ccc_mprun  ./glost_launch -R $timeLimitBeforeEnd ${inputCmd} 2>${output} 
     312 
     313### ccc_mprun  ./cmd_launch.exe ${inputCmd} 2>${output} 
     314 
     315###    ./cmd_launch.exe ${inputCmd} 2>${output} 
     316###    ccc_mprun -p standard -n ${BRIDGE_MSUB_NPROC} ./cmd_launch.exe ${inputCmd} 2>myIO/output.log 
     317###    mpirun -n 4 ./cmd_launch.exe myIO/inputCmd10.list 2>myIO/output.log 
    62318 
    63319meantime=$( getTimeDiffSeconds $startTime ) 
     
    66322echo "end time:$endExecutionTime" >> $timeHandlingFile 
    67323 
    68  
    69324echo "meantime ncrcat = $meantime" 
     325 
     326# exit 0 # a virer 
     327 
     328# Gestion des reprises : 
     329# -------------------- 
     330 
     331update_report 
     332 
     333update_tasks_list $nextInputCmd $output $inputCmd 
     334 
     335echo "no interruption has occured" > ${noInterruptFile} 
     336 
     337# Tout s'est bien passe 
     338# ---------------------- 
     339everythingOK=`cat $nextInputCmd | wc -l ` 
     340if [ "x{everythingOK}" == "x0"] 
     341then 
     342    echo "Tout s'est fini correctement" >> $badFailureFile 
     343    exit 1 
     344fi 
     345 
     346# y a t il progression ? 
     347# ---------------------- 
     348resDiff=$( check_progress $inputCmd $nextInputCmd ) 
     349# resDiff == 1 : fichiers differents 
     350# resDiff == 0 : fichiers identiques 
     351if [ "x${resDiff}" == "x0" ] 
     352then 
     353    echo "Il n'y pas plus de progression" >> $badFailureFile 
     354    exit 1 
     355fi 
     356 
     357# On enchaine avec le meme script 
     358ccc_msub launch_and_measureTime.sh 
  • TOOLS/PACK_IPSL/launch_ipsl_pack.sh

    r1849 r1853  
    6464SCRIPT_NAME=$(basename ${0} ) 
    6565 
    66 export IGCM_DEM=${SCRATCHDIR}/IGCM_DEM 
    67 export IGCM_TMP=${SCRATCHDIR}/IGCM_DEM/tmp 
     66# On renseigne les variables d'environnement  
     67. load_ipslPack_env.sh 
     68 
     69export IGCM_TMP="${IGCM_DEM}/tmp"  # gpdebug : added 
     70# INPUT_DMF_DATA, positionnee par le load_ipslPack_env.sh, sert pour pour PATH_SIMUL_SHORT dans create_config_card.sh 
     71 
    6872export clean_tmp=${clean_tmp:-yes} 
    6973export DEM_LOG=${JOB_DIR}/dem_${LSB_JOBID:-${$}}.log 
  • TOOLS/PACK_IPSL/parallelPack.sh

    r1849 r1853  
    11#!/bin/bash 
     2 
     3function insertDirectives 
     4{ 
     5     
     6    local batchFile="launch_and_measureTime.sh" 
     7    local lineBeginMutableDrves=`grep -n "batch directives : begin" $batchFile | awk -F":" '{print $1}' ` 
     8    local lineHeaderMutableDrves=`grep -n "mutable directives" $batchFile | awk -F":" '{print $1}' ` 
     9    local lineEndMutableDrves=`grep -n "batch directives : end" $batchFile | awk -F":" '{print $1}' ` 
     10    if [ "x${lineBeginMutableDrves}" == "x" ] || [ "x${lineHeaderMutableDrves}" == "x" ] || [ "x${lineEndMutableDrves}" == "x" ] 
     11    then 
     12        echo "Examen du fichier $batchFile :" 
     13        echo "Il manque les balises commentees 'mutable directives' et 'batch directives : end' " 
     14        exit 1 
     15    fi 
     16     
     17    # echo "lineHeaderMutableDrves=$lineHeaderMutableDrves" 
     18    # echo "lineEndMutableDrves=$lineEndMutableDrves" 
     19     
     20    if [ $lineHeaderMutableDrves -ge $lineEndMutableDrves ] 
     21    then 
     22       echo "Examen du fichier $batchFile :" 
     23       echo "les lignes 'mutable directives' et 'batch directives : end' n'existent pas ou ne sont" 
     24       echo "pas bien placees l'une par rapport a l'autre ==> STOP." 
     25       exit 1 
     26    fi 
     27     
     28    # Suppression des anciennes directives 
     29    local firstLineToMove=$(( $lineHeaderMutableDrves + 1 )) 
     30    local lastLineToMove=$(( $lineEndMutableDrves - 1 )) 
     31    if [ $firstLineToMove -lt $lineEndMutableDrves ] 
     32    then 
     33        sed -i "${firstLineToMove},${lastLineToMove}d" $batchFile 
     34    fi 
     35         
     36    # insertion des directives chargees a partir de "load_batch_directives.sh" 
     37    local lineEndMutableDrves=`grep -n "batch directives : end" $batchFile | awk -F":" '{print $1}' ` 
     38    sed -i "${lineEndMutableDrves}i\#MSUB -Qos $QosType" $batchFile 
     39    sed -i "${lineEndMutableDrves}i\#MSUB -q $queueType" $batchFile 
     40    sed -i "${lineEndMutableDrves}i\#MSUB -A $projectName" $batchFile 
     41    sed -i "${lineEndMutableDrves}i\#MSUB -T $computationTime" $batchFile 
     42    sed -i "${lineEndMutableDrves}i\#MSUB -n $nbProcs" $batchFile 
     43     
     44    # insertion des directives specifiant les sorties des operations de pack 
     45    sed -i "${lineEndMutableDrves}i\#MSUB -e ${DETAILLED_OUTPUT}/pack_ipsl_%I.e" $batchFile 
     46    sed -i "${lineEndMutableDrves}i\#MSUB -o ${DETAILLED_OUTPUT}/pack_ipsl_%I.o" $batchFile 
     47 
     48} 
     49 
     50function check_machine 
     51{ 
     52    local host_name=`hostname ` 
     53    local isMachineTitane=`echo $host_name | grep "titane" | wc -l ` 
     54    local isMachineCurie=`echo $host_name | grep "curie" | wc -l ` 
     55     
     56    if [ "x${isMachineTitane}" == "x0" ] && [ "x${isMachineCurie}" == "x0" ] 
     57    then 
     58        echo "Ce programme doit etre lance a partir 'curie' ou 'titane'. STOP." 
     59        exit 1 
     60    fi 
     61 
     62} 
     63 
     64function getNumeroOfPreviousTry 
     65{ 
     66   local num_try="0" 
     67   ici=$PWD 
     68   cd $USER_OUTPUT_PROGRESS 
     69    
     70   tryDirs=`ls | grep -e 'TRY__[[:digit:]]\{1,2\}$' ` 
     71   for dir in $tryDirs 
     72   do 
     73      num=`echo $dir | awk -F"__" '{print $NF}' ` 
     74      if [ $num -gt $num_try ] 
     75      then 
     76          num_try=$num  
     77      fi 
     78   done   
     79   cd $ici 
     80   echo $num_try 
     81    
     82} 
    283 
    384########  pour option -f ############# 
     
    1798###################################### 
    1899 
    19 export IGCM_DEM=${SCRATCHDIR}/IGCM_DEM 
    20  
    21 ######### Si l'option -f est activee, on detruit tous les fichiers status  ########## 
     100# On charge les variables d'environnement  
     101. load_ipslPack_env.sh 
     102 
     103# On charge les directives batch 
     104. load_batch_directives.sh 
     105 
     106# on verifie que la machine est 'curie' ou 'titane' 
     107check_machine 
     108 
     109#########  On insert les directives batch en en-tete du script "launch_and_measureTime.sh"         ########## 
     110#########  lance plus loin. Seules les directives de nom du job et de sorties restent inchangees   ########## 
     111 
     112insertDirectives 
     113 
     114# exit 0 # gpdebug : a virer 
     115 
     116# export inputCmd="${USER_OUTPUT_PROGRESS}/inputCmd.list" 
     117# export nextInputCmd="${USER_OUTPUT_PROGRESS}/nextInputCmd.list" 
     118# export output="${USER_OUTPUT_PROGRESS}/packOutput.log" 
     119# export reportFile="${USER_OUTPUT_PROGRESS}/report.log" 
     120 
     121########## Si l'option -f est activee, on detruit tous les fichiers status  ########## 
    22122if [ "x$restartExecFromZero" == "x1" ] 
    23123then 
     
    41141    echo "Deletion done." 
    42142fi 
     143 
     144 
     145# Par ailleurs, on vide les fichiers de cmds, d'output et de rapport si option -f activee 
     146if [ "x${restartExecFromZero}" == "x1" ] 
     147then 
     148    rm -rf ${USER_OUTPUT_PROGRESS}/TRY__* 
     149fi 
     150 
     151# exit 0 # a virer 
     152 
    43153##################################################################################### 
    44154 
     
    54164# fichier pour la transmission des messages d'erreur d'un fils au prog principal 
    55165export errorMsgFile="${PWD}/errorMsg.txt" 
    56 ############## gpdebug : fin ##############################################################  
    57  
    58 export timeHandlingFile="timeHandlingFile.txt" 
     166############## gpdebug : fin ############################################################## 
     167 
     168check_nco_version # verification de la version de nco ####################### 
     169 
     170# penser a arreter le present script si le module "libccc_user" n'a pas ete charge 
     171 
     172export badFailureFile=${USER_OUTPUT_PROGRESS}/badFailure.txt 
     173> $badFailureFile # nouvel essai, on vide le fichier d'erreur 
     174tryNumFile=${USER_OUTPUT_PROGRESS}/numero_current_try.txt 
     175numPreviousTry=$( getNumeroOfPreviousTry ) 
     176# echo "numPreviousTry=$numPreviousTry" 
     177numNewTry=$(( $numPreviousTry + 1 )) 
     178 
     179# Pas de 4eme essai permis 
     180# ----------------------------  
     181if [ $numNewTry -ge 3 ] 
     182then 
     183    echo "Pas de 4eme essai permis" 
     184    exit 1 
     185fi 
     186 
     187# echo "numNewTry=$numNewTry" 
     188mkdir -p ${USER_OUTPUT_PROGRESS}/TRY__${numNewTry} 
     189echo $numNewTry > $tryNumFile 
     190 
     191# exit 0 # a virer 
     192 
     193 
     194 
     195export timeHandlingFile="${USER_OUTPUT_PROGRESS}/timeHandlingFile.txt" 
    59196> $timeHandlingFile 
    60197startTime=$( getDateMilliSeconds ) 
     
    65202DEM_log -0 "Demarrage de ${SCRIPT_NAME}" 
    66203 
    67 check_nco_version # gpdebug : verification de la version de nco ####################### 
    68  
    69 ccc_msub -A tgcc0013 launch_and_measureTime.sh 
    70  
    71  
     204# ccc_msub -A tgcc0013 launch_and_measureTime.sh 
     205ccc_msub launch_and_measureTime.sh 
    72206 
    73207DEM_log -0 "Fin de ${SCRIPT_NAME}" 
     208 
     209 
     210elapsedTime=0 
     211while [ $elapsedTime -lt 500 ] 
     212do 
     213    sleep 5 
     214    elapsedTime=$(( $elapsedTime + 5 )) 
     215    isFailureFileEmpty=`cat $badFailureFile | wc -l ` 
     216    if [ "x${isFailureFileEmpty}" != "x0" ] 
     217    then 
     218       sleep 2 # on attend que le fichier soit correctement rempli 
     219       cat $badFailureFile 
     220       exit 0 
     221    fi 
     222done 
     223 
     224 
     225 
     226 
  • TOOLS/PACK_IPSL/process_list.sh

    r1849 r1853  
    99maxtries=3 
    1010 
    11 #------------------------------------------------------ 
    12 # export INPUT_DMF_DATA=${SCRATCHDIR}/datasLabo/dataDMNFS_simple1 
    13 export INPUT_DMF_DATA=${SCRATCHDIR}/dataDMNFS_FromTitane 
    14  
    15 # export OUTPUT_STORE=${SCRATCHDIR}/PSEUDO_DMNFS_STORE 
    16 export OUTPUT_STORE=${SCRATCHDIR}/dataDMNFS_FromTitane_STORE 
    17  
    18 # export OUTPUT_WORK=${SCRATCHDIR}/PSEUDO_DMNFS_WORK 
    19 export OUTPUT_WORK=${SCRATCHDIR}/dataDMNFS_FromTitane_WORK 
    20  
    21 export IGCM_DEM=${SCRATCHDIR}/IGCM_DEM 
     11# On renseigne les variables d'environnement  
     12. load_ipslPack_env.sh 
    2213 
    2314dirin=$INPUT_DMF_DATA 
     
    3021#------------------------------------------------------ 
    3122 
     23baseNameOfListFile=$( basename $listToProcessFile ) 
    3224dirPathOfListFile=$( dirname  $listToProcessFile ) 
    3325dirnameOfListFile=$( basename $dirPathOfListFile ) 
    3426 
    35 echo "dirnameOfListFile=${dirnameOfListFile}|" 
    36  
    37 dirOK=0 
    38  
    39 if [ "$dirnameOfListFile" != "output_ncrcat" ]  
    40 then 
    41     dirOK=$(( $dirOK || 0 )) 
    42 else 
    43     dirOK=$(( $dirOK || 1 ))  
    44 fi 
    45  
    46 if [ "$dirnameOfListFile" != "output_tar" ]  
    47 then 
    48     dirOK=$(( $dirOK || 0 )) 
    49 else 
    50     dirOK=$(( $dirOK || 1 ))  
    51 fi 
    52  
    53 if [ "$dirnameOfListFile" != "restart_tar" ]  
    54 then 
    55     dirOK=$(( $dirOK || 0 )) 
    56 else 
    57     dirOK=$(( $dirOK || 1 ))  
    58 fi 
    59  
    60 if [ "$dirnameOfListFile" != "store_cp" ]  
    61 then 
    62     dirOK=$(( $dirOK || 0 )) 
    63 else 
    64     dirOK=$(( $dirOK || 1 ))  
    65 fi 
    66  
    67 if [ "$dirnameOfListFile" != "work_cp" ]  
    68 then 
    69     dirOK=$(( $dirOK || 0 )) 
    70 else 
    71     dirOK=$(( $dirOK || 1 ))  
    72 fi 
    73  
    74 if [ "$dirnameOfListFile" != "debug_tar" ]  
    75 then 
    76     dirOK=$(( $dirOK || 0 )) 
    77 else 
    78     dirOK=$(( $dirOK || 1 ))  
    79 fi 
    80  
    81 if [ "$dirnameOfListFile" != "other_tar" ]  
    82 then 
    83     dirOK=$(( $dirOK || 0 )) 
    84 else 
    85     dirOK=$(( $dirOK || 1 ))  
    86 fi 
    87  
    88 # echo "dirOK=$dirOK" 
    89  
    90 if [ "$dirOK" == "0" ] 
    91 then 
    92         echo "probleme : le rep du fichier liste est mauvais 2." # gpdebug : a modifier 
     27echo "dirnameOfListFile ==> $dirnameOfListFile" 
     28 
     29 
     30if ( \ 
     31     [ $dirnameOfListFile != "output_ncrcat" ] && \ 
     32     [ $dirnameOfListFile != "output_tar" ]    && \ 
     33     [ $dirnameOfListFile != "restart_tar" ]   && \ 
     34     [ $dirnameOfListFile != "store_cp" ]      && \ 
     35     [ $dirnameOfListFile != "work_cp" ]       && \ 
     36     [ $dirnameOfListFile != "debug_tar" ]     && \ 
     37     [ $dirnameOfListFile != "other_tar" ] \ 
     38   ) \ 
     39   && \ 
     40   [ $baseNameOfListFile != "tar_full_simul.list" ] 
     41then 
     42        echo "probleme : le rep du fichier liste est mauvais." # gpdebug : a modifier 
    9343        exit 1 
    9444fi 
     
    14292        statusfile=${set%%.list}.status 
    14393        logfile=${set%%.list}_${datestr}.log 
    144  
     94         
     95        # echo "output_ncrcat : blabla 0" 
     96         
    14597        #----------------------------------- 
    14698        # Create status file if not exists 
     
    148100                echo "# Status ; DateStart ; DateEnd ; Command ; TarFileExists" > $statusfile 
    149101        fi 
    150  
     102        # echo "output_ncrcat : blabla 1" 
    151103        #----------------------------------- 
    152104        # Switch to tar command 
     
    157109                exit 0 
    158110        fi 
    159  
     111        # echo "output_ncrcat : blabla 2" 
    160112        #----------------------------------- 
    161113        # Skip the set if last line of the status file is "COMPLETED" or "DELEGATE" 
     
    165117                exit 0 # gpdebug : modif 
    166118        fi 
     119         
     120        # echo "output_ncrcat : blabla 3" 
    167121 
    168122        #----------------------------------- 
     
    182136        outputfile=$diroutputfile/${fileout} 
    183137        mkdir -p $diroutputfile 
    184         echo "Output file to write: $outputfile" 
     138        echo "Output file to write: $outputfile  output_ncrcat" 
    185139 
    186140        #----------------------------------- 
     
    248202                                cp $set $PATH_SIMU/output_tar # gpdebug : a retablir 
    249203                        fi 
     204                        exit 1 
    250205                fi 
    251206        fi 
     
    299254        outputfile=$diroutputfile/${fileout} 
    300255        mkdir -p $diroutputfile 
    301         echo "Output file to write: $outputfile" 
     256        echo "Output file to write: $outputfile  output_tar" 
    302257 
    303258        #----------------------------------- 
     
    333288            echo "====> FAILED at try #$nbtries"  
    334289            echo "FAILED at try #$nbtries ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set) ; $logfile" >> $statusfile 
    335  
     290            exit 1 
    336291        fi 
    337292        rm -f $set".local"  
     
    381336        outputfile=$diroutputfile/${fileout} 
    382337        mkdir -p $diroutputfile 
    383         echo "Output file to write: $outputfile" 
     338        echo "Output file to write: $outputfile  restart_tar" 
    384339 
    385340        #----------------------------------- 
     
    410365            echo "====> FAILED at try #$nbtries"  
    411366            echo "FAILED at try #$nbtries ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set) ; $logfile" >> $statusfile 
    412  
     367            exit 1 
    413368        fi 
    414369         
     
    458413        outputfile=$diroutputfile/${fileout} 
    459414        mkdir -p $diroutputfile 
    460         echo "Output file to write: $outputfile" 
     415        echo "Output file to write: $outputfile  debug_tar" 
    461416 
    462417        #----------------------------------- 
     
    486441            echo "====> FAILED at try #$nbtries"  
    487442            echo "FAILED at try #$nbtries ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set) ; $logfile" >> $statusfile 
    488  
     443            exit 1 
    489444        fi 
    490445         
     
    532487            diroutputfile=`dirname $file | sed -e "s%$dirin%$dirout%"` 
    533488            mkdir -p $diroutputfile 
    534             echo "Output file to write: $diroutputfile/$( basename $file )" 
     489            echo "Output file to write: $diroutputfile/$( basename $file )  store_cp" 
    535490             
    536491        #----------------------------------- 
     
    556511            echo "====> FAILED at try #$nbtries"  
    557512            echo "FAILED at try #$nbtries ; $datestr1 ; $datestr2 ; $cpcmd $cpoptions $file $diroutputfile ; $logfile" >> $statusfile 
    558  
     513            exit 1 
    559514        fi 
    560515         
     
    602557            diroutputfile=`dirname $file | sed -e "s%$dirin%$dirout_work%"` 
    603558            mkdir -p $diroutputfile 
    604             echo "Output file to write: $diroutputfile/$( basename $file )" 
     559            echo "Output file to write: $diroutputfile/$( basename $file )  work_cp" 
    605560             
    606561        #----------------------------------- 
     
    625580            echo "====> FAILED at try #$nbtries"  
    626581            echo "FAILED at try #$nbtries ; $datestr1 ; $datestr2 ; $cpcmd $cpoptions $file $diroutputfile ; $logfile" >> $statusfile 
    627  
     582            exit 1 
    628583        fi 
    629584         
     
    632587fi 
    633588 
    634  
    635  
    636  
    637  
    638  
    639  
    640  
    641  
    642  
    643  
    644  
    645  
     589# gpdebug : traitement des simu < 1 Go ou de type create_etat0 
     590#           il n'est censé n'y avoir qu'un seul fichier tar_full_simul.list par simu. 
     591#           d'ou le "if" et non le "for" 
     592# pense bete : 
     593#    * implication dans showPackProgress.sh (fichier status) ? 
     594if [ "$baseNameOfListFile" == "tar_full_simul.list" ] 
     595then 
     596        # set="${PATH_SIMU}/tar_full_simul.list" # gpdebug : foireux ? 
     597        #----------------------------------- 
     598        echo "#-------------------" 
     599        echo "Set: $set" 
     600        datestr=`LC_ALL=C date +"%Y%m%dT%H%M%S"` 
     601        datestr1=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
     602        statusfile=${set%%.list}.status 
     603        logfile=${set%%.list}_${datestr}.log 
     604 
     605        #----------------------------------- 
     606        # Create status file if not exists 
     607        if [ ! -e $statusfile ] ; then 
     608                echo "# Status ; DateStart ; DateEnd ; Command ; TarFileExists" > $statusfile 
     609        fi 
     610 
     611        #----------------------------------- 
     612        # Skip the set if last line of the status file is "COMPLETED" or "DELEGATE" 
     613        if tail -1 $statusfile | grep -q -E '(COMPLETED|DELEGATE)' ; then 
     614                printf "====> " 
     615                tail -1 $statusfile 
     616                exit 0 
     617        fi 
     618 
     619        #----------------------------------- 
     620        # Set output file name from list name 
     621        # echo "PATH_SIMU=$PATH_SIMU" 
     622        dirOfOutputFile=`echo $PATH_SIMU | sed "s;${IGCM_DEM};${OUTPUT_STORE};" ` 
     623        fileout=${dirnameOfListFile}.tar 
     624        # echo "dirnameOfListFile=$dirnameOfListFile" 
     625        outputfile=$dirOfOutputFile/${fileout} 
     626        mkdir -p $dirOfOutputFile 
     627        echo "Output file to write: $outputfile  tar_full_simul" 
     628         
     629        # exit 0 # a virer 
     630 
     631        #----------------------------------- 
     632        # Try 1 time before fire "FAILED" 
     633        # Waiting for CCRT command 
     634        tarcmd=tar 
     635        taroptions="--format=posix -W -cf" 
     636#       taroptions="--format=posix -cf" 
     637 
     638        filefirst=`head -n 1 $set` 
     639        dirinputfile=`dirname $filefirst` 
     640        cd $dirinputfile 
     641 
     642        set_local=${set%%.list}.local 
     643        > $set_local 
     644        for file in $( cat $set) ; do 
     645            basename $file >> $set_local  
     646        done 
     647#       ls 
     648         
     649        startTime=$( getDateMilliSeconds ) # gpdebug : time 
     650        resCmd=0 
     651        $tarcmd $taroptions $outputfile --dereference --files-from $set_local > $logfile 2>&1 # gpdebug : a retablir 
     652        resCmd=$? 
     653        meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time 
     654         
     655        # resultCmd=$( gives_0_or_1 ) 
     656        # if [ $resultCmd -eq 0 ] ; then 
     657        if [ $resCmd -eq 0 ] ; then 
     658            sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time 
     659            datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
     660            echo "DONE ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set); $logfile" >> $statusfile 
     661            echo "====> COMPLETED at try #$nbtries (at 1st shot on 1)" 
     662            echo "COMPLETED at try #$nbtries (at 1st shot on 1)" >> $statusfile 
     663        else 
     664            datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
     665            echo "====> FAILED at try #$nbtries"  
     666            echo "FAILED at try #$nbtries ; $datestr1 ; $datestr2 ; $tarcmd $taroptions $outputfile $(cat $set) ; $logfile" >> $statusfile 
     667            exit 1 
     668        fi 
     669         
     670        #----------------------------------- 
     671fi 
     672 
     673 
     674 
     675 
     676 
     677 
     678 
     679 
     680 
     681 
     682 
  • TOOLS/PACK_IPSL/showPackProgress.sh

    r1850 r1853  
    44export EXE_DIR=${JOB_DIR} 
    55 
    6 # gpdebug : pour titane 
    7 # --------------------- 
    8 # export INPUT_DMF_DATA=${SCRATCHDIR}/datasLabo/dataDMNFS_simple1 
    9 # export OUTPUT_STORE=${SCRATCHDIR}/PSEUDO_DMNFS_STORE 
    10 # export OUTPUT_WORK=${SCRATCHDIR}/PSEUDO_DMNFS_WORK 
    11  
    12  
    13 # gpdebug : pour curie 
    14 # -------------------- 
    15 export INPUT_DMF_DATA=${SCRATCHDIR}/dataDMNFS_FromTitane 
    16 export OUTPUT_STORE=${SCRATCHDIR}/dataDMNFS_FromTitane_STORE  
    17 export OUTPUT_WORK=${SCRATCHDIR}/dataDMNFS_FromTitane_WORK 
     6# On renseigne les variables d'environnement  
     7. load_ipslPack_env.sh 
    188 
    199SCRIPT_NAME=$(basename ${0} ) 
    2010 
    21 export IGCM_DEM=${SCRATCHDIR}/IGCM_DEM 
    22 export IGCM_TMP=${SCRATCHDIR}/IGCM_DEM/tmp 
     11export IGCM_TMP="${IGCM_DEM}/tmp"  # gpdebug : added 
    2312 
    2413export config_card=${IGCM_DEM}/config_card.liste 
     
    2615source ${EXE_DIR}/DEM_utilities.sh 
    2716 
    28 export timeHandlingFile="timeHandlingFile.txt" 
     17export timeHandlingFile="${USER_OUTPUT_PROGRESS}/timeHandlingFile.txt" 
    2918 
    3019 
     
    3322   config_card=$1 
    3423    
    35    baseName=$( basename $config_card ) 
    36    simuName=`echo ${baseName} | sed 's;config_card_;;' ` 
     24   dirSimu=$( dirname $config_card ) 
     25   simuName=`echo ${dirSimu} | sed "s;${IGCM_DEM}/;;" ` 
    3726   echo $simuName 
    3827 
     
    194183} 
    195184 
     185 
     186 
     187function getListProgress 
     188{ 
     189     set=$1      
     190      
     191     listName=`echo $(basename $set) | sed 's;\.list$;;' | sed 's;\.nc$;;' ` 
     192     ListNbInode=`cat $set |wc -l` 
     193     TotalNbInodes=$(( $TotalNbInodes + $ListNbInode )) 
     194     statusfile=${set%%.list}.status 
     195     status=$( progressStatus $statusfile ) # gpdebug : a retablir 
     196     timeTaken="???" 
     197   
     198     packFailed=`echo $status | grep -E '(DELEGATE|FAILED|illisible)' | wc -l ` 
     199     if [ "x${packFailed}" != "x0" ] 
     200     then 
     201        nbOfListsFailed=$(( $nbOfListsFailed + 1 )) 
     202        simuOK=$(( $simuOK && 0 )) # marque une simu pas OK 
     203     fi 
     204   
     205     packSuccess=`echo $status | grep "COMPLETED" | wc -l ` 
     206     if [ "x${packSuccess}" != "x0" ] 
     207     then 
     208        timeTaken=$( getTimeTaken $statusfile ) 
     209        nbOfListsPacked=$(( $nbOfListsPacked + 1 )) 
     210     fi 
     211      
     212     echo "       $listName : $status | time : $timeTaken" >> simuPrint.txt 
     213      
     214     timeInSecondsOK=`echo $timeTaken | grep -e '^[[:digit:].]*$' | wc -l ` 
     215     if [ "x${timeInSecondsOK}" != "x0" ] 
     216     then 
     217         totalTime=$(awk 'BEGIN { print '$totalTime'+'$timeTaken' }') 
     218     fi 
     219 
     220 
     221 
     222} 
     223 
    196224################################# 
    197225####### Main script ############# 
    198226################################# 
     227 
     228########  Options du script ######################################################## 
     229focusOnSimu= 
     230outputFile= 
     231detailed_mode=1 
     232while [ $# -gt 0 ] 
     233do 
     234   # echo "boucle sur les arguments du script ..." 
     235   # echo "@=$@" 
     236   case $1 in 
     237   -s)  echo "option -s selectionnee : afficher une simulation" 
     238        shift 
     239        focusOnSimu=$1 
     240        is_simu_an_option=`echo $focusOnSimu | grep -e '^-' | wc -l ` 
     241        if [ "x${is_simu_an_option}" != "x0" ] || [ "x$focusOnSimu" == "x" ] 
     242        then 
     243           echo "L'option -s doit etre suivie d'une simulation !" 
     244           exit 1 
     245        fi 
     246        ;; 
     247   -o)  echo "option -o selectionnee : fichier d'output" 
     248        shift 
     249        outputFile=$1 
     250        is_output_an_option=`echo $outputFile | grep -e '^-' | wc -l ` 
     251        if [ "x${is_output_an_option}" != "x0" ] || [ "x$outputFile" == "x" ] 
     252        then 
     253           echo "L'option -o doit etre suivie d'un fichier d'output !" 
     254           exit 1 
     255        fi 
     256        ;; 
     257   --not-detailled)  echo "option '--not-detailled' selectionnee" 
     258                     detailed_mode=0 
     259                     ;; 
     260   esac 
     261   shift 
     262done 
     263 
     264# echo "focusOnSimu=$focusOnSimu" 
     265# echo "outputFile=$outputFile" 
     266# echo "detailed_mode=$detailed_mode" 
     267###################################################################################### 
     268# exit 0 # gpdebug : a virer 
     269 
     270 
     271 
    199272> showPackProgress.log # vider le fichier de log 
     273 
    200274 
    201275# Recuperation des temps d'attente et ecoule depuis de demarrage des traitements en batch 
     
    228302totalTime=0 
    229303 
     304 
    230305for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do  
    231306 
    232307    DEM_state=$( DEM_read_state ${IGCM_DEM}/config_card.liste ${CONFIG} ) 
    233  
    234     if [[ "${DEM_state}" != "TarDone" ]] ; then 
    235  
    236          simuName=$( getSimuName $CONFIG ) 
    237          echo "*******************************************" 
    238          echo "simulation : $simuName" 
    239          echo "*******************************************" 
    240          export PATH_SIMU=$( dirname $CONFIG ) 
    241          # echo "PATH_SIMU = $PATH_SIMU" 
    242          
     308     
     309    # Eviter les simus autre que celle selectionnee par l'option -s 
     310    showCurrentSimu=`echo $CONFIG | grep "${focusOnSimu}" | wc -l ` 
     311    if [ "x${showCurrentSimu}" == "x0" ] 
     312    then 
     313        continue 
     314    fi 
     315 
     316    simuName=$( getSimuName $CONFIG ) 
     317     
     318    > simuPrint.txt 
     319 
     320    export PATH_SIMU=$( dirname $CONFIG ) 
     321    # echo "PATH_SIMU = $PATH_SIMU" 
     322     
     323    simuOK=1  
     324     
     325    if [ ! -e "${PATH_SIMU}/tar_full_simul.list" ] 
     326    then 
     327         
    243328         listOfDir="output_ncrcat output_tar restart_tar debug_tar store_cp work_cp" 
    244329         for dir in $listOfDir 
    245330         do 
    246              echo "   ${dir} :" 
     331             echo "   ${dir} :" >> simuPrint.txt 
    247332             if [ ! -d $PATH_SIMU/${dir} ] 
    248333             then 
    249                 echo "      ${dir} n'existe pas pour cette simu" 
     334                echo "      ${dir} n'existe pas pour cette simu" >> simuPrint.txt 
     335                simuOK=$(( $simuOK && 0 )) # marque une simu pas OK 
    250336                continue 
    251337             fi 
     
    254340             if [ "x$listFilesInDir" == "x0" ] 
    255341             then 
    256                 echo "       -- no list --" 
     342                echo "       -- no list --" >> simuPrint.txt 
    257343                continue            
    258344             fi 
     
    262348             for set in $setList 
    263349             do 
    264                   listName=`echo $(basename $set) | sed 's;\.list$;;' | sed 's;\.nc$;;' ` 
    265                   ListNbInode=`cat $set |wc -l` 
    266                   TotalNbInodes=$(( $TotalNbInodes + $ListNbInode )) 
    267                   statusfile=${set%%.list}.status 
    268                   status=$( progressStatus $statusfile ) # gpdebug : a retablir 
    269                   timeTaken="???" 
    270                   # progressStatus $statusfile # gpdebug : a virer 
    271                   # exit 0 # gpdebug : a virer 
    272                 
    273                   packFailed=`echo $status | grep -E '(DELEGATE|FAILED|illisible)' | wc -l ` 
    274                   if [ "x${packFailed}" != "x0" ] 
    275                   then 
    276                      nbOfListsFailed=$(( $nbOfListsFailed + 1 )) 
    277                   fi 
    278                 
    279                   packSuccess=`echo $status | grep "COMPLETED" | wc -l ` 
    280                   if [ "x${packSuccess}" != "x0" ] 
    281                   then 
    282                      timeTaken=$( getTimeTaken $statusfile ) 
    283                      nbOfListsPacked=$(( $nbOfListsPacked + 1 )) 
    284                   fi 
    285                    
    286                   echo "       $listName : $status | time : $timeTaken" 
    287                    
    288                   timeInSecondsOK=`echo $timeTaken | grep -e '^[[:digit:].]*$' | wc -l ` 
    289                   if [ "x${timeInSecondsOK}" != "x0" ] 
    290                   then 
    291                       totalTime=$(awk 'BEGIN { print '$totalTime'+'$timeTaken' }') 
    292                   fi 
     350                  getListProgress $set 
    293351             done 
    294352         done 
     353    else          
     354         getListProgress ${PATH_SIMU}/tar_full_simul.list 
     355         TotalSimuTar=$(( $TotalSimuTar + 1 )) 
     356    fi 
     357     
     358    resSimu="OK" 
     359    if [ "x${simuOK}" == "x0" ] 
     360    then 
     361        resSimu="not OK" 
     362    fi 
     363     
     364    if [ "x${outputFile}" == "x" ] 
     365    then 
     366        echo "***************************************************" 
     367        echo "simulation : $simuName  ===> $resSimu" 
     368        echo "***************************************************" 
     369        if [ "x${detailed_mode}" == "x1" ] 
     370        then 
     371            cat simuPrint.txt  $outRedirectStatement 
     372        fi 
    295373    else 
    296 #si "${DEM_state}" == "TarDone" 
    297  
    298          simuName=$( getSimuName $CONFIG ) 
    299          echo "*******************************************" 
    300          echo "simulation : $simuName TAR" 
    301          echo "*******************************************" 
    302          TotalSimuTar=$(( $TotalSimuTar + 1 )) 
    303     fi 
     374        echo "***************************************************" >> ${outputFile} 
     375        echo "simulation : $simuName  ===> $resSimu"               >> ${outputFile} 
     376        echo "***************************************************" >> ${outputFile} 
     377        if [ "x${detailed_mode}" == "x1" ] 
     378        then 
     379            cat simuPrint.txt  $outRedirectStatement               >> ${outputFile} 
     380        fi      
     381    fi  
     382    rm simuPrint.txt 
    304383done 
    305384 
  • TOOLS/PACK_IPSL/write_liste_tar.sh

    r1846 r1853  
    3939rm -f ${IGCM_DEM_SIMU}/tar_no_output_files.txt 
    4040rm -f ${IGCM_DEM_SIMU}/tar_no_restart_files.txt 
    41 rm -f ${IGCM_DEM_SIMU}/work_cp/* 
    42 rm -f ${IGCM_DEM_SIMU}/store_cp/* 
    43 rm -f ${IGCM_DEM_SIMU}/other_tar/* 
     41 
     42 
     43# gpdebug : traitement des simu < 1 Go ou de type create_etat0 : il faut virer ces rep  
     44#           (et pas slt leur contenu) pour pouvoir integrer le traitement specifique  
     45#           de ces simu dans "enlarge_my_files.sh" (sequentiel) et  "process_list.sh" (parallele) 
     46# rm -f ${IGCM_DEM_SIMU}/work_cp/* 
     47# rm -f ${IGCM_DEM_SIMU}/store_cp/* 
     48# rm -f ${IGCM_DEM_SIMU}/other_tar/* 
     49 
     50rm -rf ${IGCM_DEM_SIMU}/work_cp 
     51rm -rf ${IGCM_DEM_SIMU}/store_cp 
     52rm -rf ${IGCM_DEM_SIMU}/other_tar 
    4453 
    4554DEM_write_state ${IGCM_DEM}/config_card.liste ${config_card} WriteListTarDone 
Note: See TracChangeset for help on using the changeset viewer.