Ignore:
Timestamp:
12/22/11 16:04:47 (12 years ago)
Author:
sdipsl
Message:
  • Prepare libIGCM for TGCC migration. For now work for CCRT machines ONLY
  • SX8, SX9 and Titane are independant from DMNFS
    • 30 seconds between execution instead of at least 3 minutes ; sometimes hours
  • SX8, SX9 and Titane use their SCRATCHDIR as a BUFFER (for restart and text)
  • Titane simulations are entirely post-processed on titane mono
    • Working except create_se and atlas (missing software : ncap2, openpbm, ImageMagick?)
  • Cards are the same up to now
  • New indentation to ease readability ("svn diff -x -b" to ignore space when differencing)
  • Project (gen2211) is inherited from AA_job by post-processing jobs
    • will stop during config_check if Project is empty
  • Prepare easy switching (submitting post-processing here or there)
  • Homogenize CCRTs libIGCM_sys
  • Bugfixes
  • Cosmetics

First steps and still a long way to go.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh

    r457 r544  
    2828 
    2929if ( $DEBUG_debug ) ; then 
    30     if [ -f stack ] ; 
    31     then 
    32         echo "Stack of an libIGCM job :" >> stack 
    33     else 
    34         echo "Stack of an libIGCM job :" >  stack 
    35     fi 
     30  if [ -f stack ] ; 
     31  then 
     32    echo "Stack of an libIGCM job :" >> stack 
     33  else 
     34    echo "Stack of an libIGCM job :" >  stack 
     35  fi 
    3636fi 
    3737 
     
    6868#D- 
    6969function IGCM_debug_CallStack { 
    70     echo 
    71     echo "!!!!!!!!!!!!!!!!!!!!!!!!!!" 
    72     echo "!! IGCM_debug_CallStack !!" 
     70  echo 
     71  echo "!!!!!!!!!!!!!!!!!!!!!!!!!!" 
     72  echo "!! IGCM_debug_CallStack !!" 
     73  echo "!------------------------!" 
     74  echo 
     75  if ( $DEBUG_debug ) ; then 
     76    # La pile d'appels est affichée de la plus vieille à la plus récente  
     77    # (c'est donc l'inverse de la norme d'affichage). 
     78    typeset i decal 
     79    (( i=0 )) 
     80    until [ $i -eq ${IGCM_debug_LenStack} ]; do 
     81      decal=0 
     82      until [ $decal -eq ${i} ]; do 
     83        printf -- ' ' 
     84        let $(( decal=decal+1 )) 
     85      done 
     86      echo "$i - ${IGCM_debug_Stack[$(( $IGCM_debug_LenStack-$i-1 ))]}"\ 
     87                "(${IGCM_debug_StackArgs[$(( $IGCM_debug_LenStack-$i-1 ))]})" 
     88      let $((i=i+1)) 
     89    done 
    7390    echo "!------------------------!" 
    74     echo 
    75     if ( $DEBUG_debug ) ; then 
    76        # La pile d'appels est affichée de la plus vieille à la plus récente  
    77        # (c'est donc l'inverse de la norme d'affichage). 
    78         typeset i decal 
    79         (( i=0 )) 
    80         until [ $i -eq ${IGCM_debug_LenStack} ]; do 
    81             decal=0 
    82             until [ $decal -eq ${i} ]; do 
    83                 printf -- ' ' 
    84                 let $(( decal=decal+1 )) 
    85             done 
    86             echo "$i - ${IGCM_debug_Stack[$(( $IGCM_debug_LenStack-$i-1 ))]}"\ 
    87                 "(${IGCM_debug_StackArgs[$(( $IGCM_debug_LenStack-$i-1 ))]})" 
    88             let $((i=i+1)) 
    89         done 
    90         echo "!------------------------!" 
    91     fi 
     91  fi 
    9292} 
    9393 
     
    9797#D- 
    9898function IGCM_debug_PushStack { 
    99     if ( $DEBUG_debug ) ; then 
    100        typeset decal 
    101        echo >> stack 
    102        decal=0 
    103        while [ $decal -lt ${IGCM_debug_LenStack} ]; do 
     99  if ( $DEBUG_debug ) ; then 
     100    typeset decal 
     101    echo >> stack 
     102    decal=0 
     103    while [ $decal -lt ${IGCM_debug_LenStack} ]; do 
    104104#          printf -- ' ' >> stack 
    105            printf ' ' >> stack 
    106            let $(( decal=decal+1 )) 
    107        done 
    108        echo "> ${IGCM_debug_LenStack} : ${@}" >> stack 
    109  
    110        # We add function call name on beginning of the stack 
    111        set +A IGCM_debug_Stack -- ${1} ${IGCM_debug_Stack[*]} 
    112  
    113        # We include the "null" Args in the beginning of the StackArgs 
    114        set +A IGCM_debug_StackArgs ${NULL_STR} ${IGCM_debug_StackArgs[*]}  
    115        # Then, we shift StackArgs tabular 
    116        if [ $# -gt 1 ]; then  
    117            shift;  
    118            IGCM_debug_StackArgs[0]=$(echo ${@} | sed -e "s/\ /,/g") >&2 
    119        fi 
    120        (( IGCM_debug_LenStack = IGCM_debug_LenStack + 1 )) 
    121  
    122        # If you want to print CallStack each time : 
    123        # IGCM_debug_CallStack 
    124     fi 
     105      printf ' ' >> stack 
     106      let $(( decal=decal+1 )) 
     107    done 
     108    echo "> ${IGCM_debug_LenStack} : ${@}" >> stack 
     109 
     110    # We add function call name on beginning of the stack 
     111    set +A IGCM_debug_Stack -- ${1} ${IGCM_debug_Stack[*]} 
     112 
     113    # We include the "null" Args in the beginning of the StackArgs 
     114    set +A IGCM_debug_StackArgs ${NULL_STR} ${IGCM_debug_StackArgs[*]}  
     115    # Then, we shift StackArgs tabular 
     116    if [ $# -gt 1 ]; then  
     117      shift;  
     118      IGCM_debug_StackArgs[0]=$(echo ${@} | sed -e "s/\ /,/g") >&2 
     119    fi 
     120    (( IGCM_debug_LenStack = IGCM_debug_LenStack + 1 )) 
     121 
     122    # If you want to print CallStack each time : 
     123    # IGCM_debug_CallStack 
     124  fi 
    125125} 
    126126 
     
    130130#D- 
    131131function IGCM_debug_PopStack { 
    132     if ( $DEBUG_debug ) ; then 
    133         if ( ${ExitFlag} ) ; then 
    134             echo '!!! ExitFlag has been activated !!!' >> stack 
    135         fi 
    136         if [ "${IGCM_debug_Stack[0]}" = "${1}" ]; then 
    137             let $(( IGCM_debug_LenStack = IGCM_debug_LenStack - 1 )) 
    138  
    139             IGCM_debug_Stack[0]=""  
    140             IGCM_debug_StackArgs[0]="" 
    141              
    142             set +A tmpStack -- ${IGCM_debug_Stack[*]} 
    143             unset IGCM_debug_Stack 
    144             set +A IGCM_debug_Stack -- ${tmpStack[*]}  
    145  
    146             set +A tmpStack -- ${IGCM_debug_StackArgs[*]} 
    147             unset IGCM_debug_StackArgs 
    148             set +A IGCM_debug_StackArgs -- ${tmpStack[*]} 
    149             unset tmpStack 
    150         else 
    151             echo 'IGCM_debug_Exit : stack is corrupted ! LenStack =' ${IGCM_debug_LenStack} 
    152             IGCM_debug_Exit $@ 
    153         fi 
    154         typeset decal=0 
    155         while [ $decal -lt ${IGCM_debug_LenStack} ]; do 
    156           # printf -- ' ' >> stack 
    157           printf ' ' >> stack 
    158           (( decal=decal+1 )) 
    159         done 
    160       echo "< ${IGCM_debug_LenStack} : ${@}" >> stack 
    161  
    162       if [ ${IGCM_debug_LenStack} = 0 ]; then 
    163           # Reset array only when necessary 
    164           #echo 
    165           #IGCM_debug_Print 3 "Clean stack array" 
    166           #echo 
    167           #set -A IGCM_debug_Stack ${NULL_STR} 
    168           #set -A IGCM_debug_StackArgs ${NULL_STR} 
    169           unset IGCM_debug_Stack 
    170           unset IGCM_debug_StackArgs 
    171           IGCM_debug_Stack[0]=${NULL_STR} 
    172           IGCM_debug_StackArgs[0]=${NULL_STR} 
    173       fi 
    174  
    175     fi 
    176  
    177     #IGCM_debug_CallStack 
     132  if ( $DEBUG_debug ) ; then 
     133    if ( ${ExitFlag} ) ; then 
     134      echo '!!! ExitFlag has been activated !!!' >> stack 
     135    fi 
     136    if [ "${IGCM_debug_Stack[0]}" = "${1}" ]; then 
     137      let $(( IGCM_debug_LenStack = IGCM_debug_LenStack - 1 )) 
     138 
     139      IGCM_debug_Stack[0]=""  
     140      IGCM_debug_StackArgs[0]="" 
     141       
     142      set +A tmpStack -- ${IGCM_debug_Stack[*]} 
     143      unset IGCM_debug_Stack 
     144      set +A IGCM_debug_Stack -- ${tmpStack[*]}  
     145 
     146      set +A tmpStack -- ${IGCM_debug_StackArgs[*]} 
     147      unset IGCM_debug_StackArgs 
     148      set +A IGCM_debug_StackArgs -- ${tmpStack[*]} 
     149      unset tmpStack 
     150    else 
     151      echo 'IGCM_debug_Exit : stack is corrupted ! LenStack =' ${IGCM_debug_LenStack} 
     152      IGCM_debug_Exit $@ 
     153    fi 
     154    typeset decal=0 
     155    while [ $decal -lt ${IGCM_debug_LenStack} ]; do 
     156      # printf -- ' ' >> stack 
     157      printf ' ' >> stack 
     158      (( decal=decal+1 )) 
     159    done 
     160    echo "< ${IGCM_debug_LenStack} : ${@}" >> stack 
     161 
     162    if [ ${IGCM_debug_LenStack} = 0 ]; then 
     163      # Reset array only when necessary 
     164      #echo 
     165      #IGCM_debug_Print 3 "Clean stack array" 
     166      #echo 
     167      #set -A IGCM_debug_Stack ${NULL_STR} 
     168      #set -A IGCM_debug_StackArgs ${NULL_STR} 
     169      unset IGCM_debug_Stack 
     170      unset IGCM_debug_StackArgs 
     171      IGCM_debug_Stack[0]=${NULL_STR} 
     172      IGCM_debug_StackArgs[0]=${NULL_STR} 
     173    fi 
     174 
     175  fi 
     176  #IGCM_debug_CallStack 
    178177} 
    179178 
     
    183182#D- 
    184183function IGCM_debug_Exit { 
    185     IGCM_debug_PushStack "IGCM_debug_Exit" 
    186     echo "IGCM_debug_Exit : " "${@}" 
    187     IGCM_debug_CallStack 
    188     ExitFlag=true 
    189     IGCM_debug_PopStack "IGCM_debug_Exit" 
     184  IGCM_debug_PushStack "IGCM_debug_Exit" 
     185  echo "IGCM_debug_Exit : " "${@}" 
     186  IGCM_debug_CallStack 
     187  ExitFlag=true 
     188  IGCM_debug_PopStack "IGCM_debug_Exit" 
    190189} 
    191190 
     
    195194#D- 
    196195function IGCM_debug_Verif_Exit { 
    197     if ( ${ExitFlag} ) ; then 
    198         # Plan to send an email here with IGCM_sys_SendMail 
    199         IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Fatal" 
    200         echo "IGCM_debug_Verif_Exit : Something wrong append." 
    201         echo "                        EXIT THE JOB." 
    202         echo 
    203         if ( $DEBUG_debug ) ; then 
    204             IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error 
    205             echo "Your files on ${R_OUT} :" 
    206             IGCM_sys_Tree ${R_SAVE} 
    207             echo 
    208         fi 
    209         # Mail notification 
    210         IGCM_sys_SendMail 
    211         # And Good Bye 
    212         date 
    213         exit 1 
    214     fi 
     196  if ( ${ExitFlag} ) ; then 
     197    # Plan to send an email here with IGCM_sys_SendMail 
     198    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Fatal" 
     199    echo "IGCM_debug_Verif_Exit : Something wrong append." 
     200    echo "                        EXIT THE JOB." 
     201    echo 
     202    if ( $DEBUG_debug ) ; then 
     203      IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error 
     204      echo "Your files on ${R_OUT} :" 
     205      IGCM_sys_Tree ${R_SAVE} 
     206      echo 
     207    fi 
     208    # Mail notification 
     209    IGCM_sys_SendMail 
     210    # And Good Bye 
     211    date 
     212    exit 1 
     213  fi 
    215214} 
    216215 
     
    220219#D- 
    221220function IGCM_debug_Verif_Exit_Post { 
    222     if ( ${ExitFlag} ) ; then 
    223         echo "IGCM_debug_Verif_Exit_Post : Something wrong append." 
    224         # If SpaceName is PROD then we stop if post_processing fails 
    225         # Plan to send an email here with IGCM_sys_SendMail 
    226         if ( [ X${config_UserChoices_SpaceName} = XPROD ] && [ X${JobType} = XRUN ] ) ; then 
    227             echo "                        EXIT THE JOB." 
    228             echo 
    229             if ( $DEBUG_debug ) ; then 
    230                 IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error 
    231                 echo 
    232             fi 
    233             # Mail notification 
    234             #IGCM_sys_SendMailPost 
    235             # And Good Bye 
    236             date 
    237             exit 1 
    238         else 
    239             echo "Either inside config.card the variable SpaceName is not in PROD" 
    240             echo "or insinde the main Job the variable JobType is not in RUN mode" 
    241             echo "              SO WE DO NOT EXIT THE JOB." 
    242             echo 
    243             date 
    244         fi 
    245     fi 
     221  if ( ${ExitFlag} ) ; then 
     222    echo "IGCM_debug_Verif_Exit_Post : Something wrong append." 
     223    # If SpaceName is PROD then we stop if post_processing fails 
     224    # Plan to send an email here with IGCM_sys_SendMail 
     225    if ( [ X${config_UserChoices_SpaceName} = XPROD ] && [ X${JobType} = XRUN ] ) ; then 
     226      echo "                        EXIT THE JOB." 
     227      echo 
     228      if ( $DEBUG_debug ) ; then 
     229        IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error 
     230        echo 
     231      fi 
     232      # Mail notification 
     233      #IGCM_sys_SendMailPost 
     234      # And Good Bye 
     235      date 
     236      exit 1 
     237    else 
     238      echo "Either inside config.card the variable SpaceName is not in PROD" 
     239      echo "or insinde the main Job the variable JobType is not in RUN mode" 
     240      echo "              SO WE DO NOT EXIT THE JOB." 
     241      echo 
     242      date 
     243    fi 
     244  fi 
    246245} 
    247246 
     
    252251function IGCM_debug_Print 
    253252{ 
    254     typeset level=$1 
     253  typeset level=$1 
     254  shift 
     255 
     256  if [ X"${1}" = X"-e" ]; then 
     257    typeset cmd_echo="echo -e" 
    255258    shift 
    256  
    257     if [ X"${1}" = X"-e" ]; then 
    258         typeset cmd_echo="echo -e" 
    259         shift 
    260     else 
    261         typeset cmd_echo="echo" 
    262     fi 
    263  
    264     if [ ${level} -le ${Verbosity} ] ; then 
    265         typeset i 
    266         case "${level}" in 
    267             1) for i in "$@" ; do 
    268                     ${cmd_echo} "--Debug1-->" ${i} 
    269               done ;;  
    270             2) for i in "$@" ; do 
    271                     ${cmd_echo} "--------Debug2-->" ${i} 
    272               done ;;  
    273             3) for i in "$@" ; do 
    274                     ${cmd_echo} "--------------Debug3-->" ${i} 
    275               done ;;  
    276         esac 
    277     fi 
     259  else 
     260    typeset cmd_echo="echo" 
     261  fi 
     262 
     263  if [ ${level} -le ${Verbosity} ] ; then 
     264    typeset i 
     265    case "${level}" in 
     266    1) for i in "$@" ; do 
     267      ${cmd_echo} "--Debug1-->" ${i} 
     268      done ;;  
     269    2) for i in "$@" ; do 
     270      ${cmd_echo} "--------Debug2-->" ${i} 
     271      done ;;  
     272    3) for i in "$@" ; do 
     273      ${cmd_echo} "--------------Debug3-->" ${i} 
     274      done ;;  
     275    esac 
     276  fi 
    278277} 
    279278 
     
    284283function IGCM_debug_PrintVariables 
    285284{ 
    286     typeset level=$1 
    287     shift 
    288  
    289     list=$( set | grep $1 | sed -e "s/'//g" ) 
    290  
    291     if [ "X${list}" != X ]  ; then 
    292         IGCM_debug_Print ${level} ${list} 
    293     fi 
     285  typeset level=$1 
     286  shift 
     287 
     288  list=$( set | grep $1 | sed -e "s/'//g" ) 
     289 
     290  if [ "X${list}" != X ]  ; then 
     291    IGCM_debug_Print ${level} ${list} 
     292  fi 
    294293} 
    295294 
     
    299298function IGCM_debug_Check 
    300299{ 
    301     #--------------------- 
    302     if [ ! -n "${libIGCM}" ] ; then 
    303         echo "Check libIGCM_debug ..........................................[ FAILED ]" 
    304         echo "--Error--> libIGCM variable is not defined" 
    305         exit 2 
    306     fi 
    307  
    308     #--------------------- 
    309     if [ ! -n "${Verbosity}" ] ; then 
    310         echo "Check libIGCM_debug ..........................................[ FAILED ]" 
    311         echo "--Error--> Verbosity variable is not defined" 
    312         exit 3 
    313     fi 
    314  
    315     #--------------------- 
    316     ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh > IGCM_debug_Test.ref.failed 2>&1 
    317     sleep 2 
    318  
    319     if diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref > /dev/null 2>&1 ; then 
    320         echo "Check libIGCM_debug ..............................................[ OK ]" 
    321         rm -f IGCM_debug_Test.ref.failed 
    322     else 
    323         echo "Check libIGCM_debug ..........................................[ FAILED ]" 
    324         echo "--Error--> Execution of ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh" 
    325         echo "           has produced the file IGCM_debug_Test.ref.failed" 
    326         echo "           Please analyse differences with the reference file by typing:" 
    327         echo "           diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref" 
    328         echo "           Report errors to the author: Patrick.Brockmann@cea.fr" 
    329         exit 4 
    330     fi 
    331     #--------------------- 
    332 } 
     300  #--------------------- 
     301  if [ ! -n "${libIGCM}" ] ; then 
     302    echo "Check libIGCM_debug ..........................................[ FAILED ]" 
     303    echo "--Error--> libIGCM variable is not defined" 
     304    exit 2 
     305  fi 
     306 
     307  #--------------------- 
     308  if [ ! -n "${Verbosity}" ] ; then 
     309    echo "Check libIGCM_debug ..........................................[ FAILED ]" 
     310    echo "--Error--> Verbosity variable is not defined" 
     311    exit 3 
     312  fi 
     313 
     314  #--------------------- 
     315  ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh > IGCM_debug_Test.ref.failed 2>&1 
     316  sleep 2 
     317 
     318  if diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref > /dev/null 2>&1 ; then 
     319    echo "Check libIGCM_debug ..............................................[ OK ]" 
     320    rm -f IGCM_debug_Test.ref.failed 
     321  else 
     322    echo "Check libIGCM_debug ..........................................[ FAILED ]" 
     323    echo "--Error--> Execution of ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh" 
     324    echo "           has produced the file IGCM_debug_Test.ref.failed" 
     325    echo "           Please analyse differences with the reference file by typing:" 
     326    echo "           diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref" 
     327    echo "           Report errors to the author: Patrick.Brockmann@cea.fr" 
     328    exit 4 
     329  fi 
     330  #--------------------- 
     331} 
Note: See TracChangeset for help on using the changeset viewer.