source: TOOLS/launch_ipsl_enlarge.sh @ 2133

Last change on this file since 2133 was 2133, checked in by acosce, 11 years ago

New tools allows packing simulation already pack (so pack with a bigger frequency)

File size: 4.3 KB
Line 
1#!/bin/bash
2######################
3## TITANE   CEA ##
4######################
5#MSUB -r ipsl_pack      # Nom du job               
6#MSUB -eo
7#MSUB -n 1              # Reservation du processus
8#MSUB -T 86400          # Limite de temps elapsed du job
9#MSUB -p gen2211
10#MSUB -q mono
11
12# ex : ./launch_ipsl_enlarge.sh
13
14# Est-on sur ulam (machine de l'IDRIS) ?
15is_idris_machine=`hostname | grep "ulam" | wc -l `
16ON_IDRIS="no"
17if [ "x${is_idris_machine}" != "x0" ]
18then
19    ON_IDRIS="yes"
20fi
21export ON_IDRIS=${ON_IDRIS}
22
23# gpdebug : pour option -f
24restartExecFromZero=0
25while [ $# -gt 0 ]
26do
27   echo "boucle sur les arguments du script ..."
28   echo "@=$@"
29   case $1 in
30   -f)  restartExecFromZero=1
31        echo "force restart from the beginning ..."
32        ;;
33   esac
34   shift
35done
36export restartExecFromZero=${restartExecFromZero}
37# gpdebug : end
38
39#export JOB_DIR=${TMP_MIGR_DATA}
40#export EXE_DIR=${LS_SUBCWD:-${PWD}}
41
42# export INPUT_DMF_DATA=/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable # gpdebug : suppr
43# export OUTPUT_STORE=${SCRATCHDIR}/PSEUDO_DMNFS_STORE # gpdebug : suppr
44# export OUTPUT_WORK=${SCRATCHDIR}/PSEUDO_DMNFS_WORK # gpdebug : suppr
45
46SCRIPT_NAME=$(basename ${0} )
47
48# export IGCM_DEM=${SCRATCHDIR}/IGCM_DEM # gpdebug : suppr
49# export IGCM_TMP=${SCRATCHDIR}/IGCM_DEM/tmp # gpdebug : suppr
50
51# On renseigne les variables d'environnement
52export scriptCallingLoad=$SCRIPT_NAME # sert a renseigner "load_ipslPack_env.sh" sur le script l'appelant
53. load_ipslPack_env.sh
54export IGCM_TMP="${IGCM_DEM}/tmp"  # gpdebug : added
55
56export JOB_DIR=${TMP_MIGR_DATA}
57export EXE_DIR=${LS_SUBCWD:-${PWD}}
58
59export clean_tmp=${clean_tmp:-yes}
60export DEM_LOG=${JOB_DIR}/dem_${LSB_JOBID:-${$}}.log
61export LOG_LEV=2
62
63export config_card=${IGCM_DEM}/config_card.liste
64
65
66############## gpdebug : Pour gestion des erreurs #########################################
67# Execute la function errorReceive() si reception d'un signal TERM
68trap 'DEM_errorReceive' TERM
69# liste des processus à détruire en cas d'erreur bloquante
70export listPID=$$
71# fichier pour la transmission des messages d'erreur d'un fils au prog principal
72export errorMsgFile="${TMP_MIGR_DATA}/errorMsg.txt"
73############## gpdebug : fin ##############################################################
74
75source ${EXE_DIR}/DEM_utilities.sh
76
77DEM_log -0 "Demarrage de ${SCRIPT_NAME}"
78
79if [ "x${ON_IDRIS}" == "xno" ]
80then
81    check_nco_version # verification de la version de nco #######################
82else
83    check_nco_version_idris # verification de la version de nco (sur la machine ulam de l'idris)
84    check_netcdf_idris      # verification du chargement du module netCDF (pour cmd ncdump)
85fi
86
87# gpdebug : si l'option -f est activee, on detruit tous les fichiers status
88if [ "x$restartExecFromZero" == "x1" ]
89then
90    echo "Deleting  all status files ..."
91    for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste )
92    do
93       PATH_SIMU=$( dirname $CONFIG )
94       ListStatFileInSimu=`find $PATH_SIMU -type f -name "*status" `
95       if [ "x$ListStatFileInSimu" != "x" ]
96       then
97           for file in $ListStatFileInSimu
98           do
99              if [ -e $file ]
100              then
101                 rm -f $file
102              fi
103       
104           done     
105       fi   
106    done
107    echo "Deletion done."
108fi
109# gpdebug : end
110
111export timeLaunchStartFile="${USER_OUTPUT_PROGRESS}/timeLaunchStartFile.txt"
112> $timeLaunchStartFile
113startTime=$( getDateMilliSeconds )
114echo "launch time:$startTime" > $timeLaunchStartFile
115
116
117for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do
118
119    DEM_state=$( DEM_read_state ${IGCM_DEM}/config_card.liste ${CONFIG} )
120
121    if [[ "${DEM_state}" != "WriteListTarDone" ]] ; then
122
123        DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} PackRunning
124        export PATH_SIMU=$( dirname $CONFIG )
125        ${EXE_DIR}/enlarge_my_files.sh ${INPUT_DMF_DATA} ${OUTPUT_STORE} ${OUTPUT_WORK}
126   
127        DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} PackDone
128
129    else
130        DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} TarRunning
131        export PATH_SIMU=$( dirname $CONFIG )
132        # ${EXE_DIR}/tar_full_simu.sh  ${INPUT_DMF_DATA} ${OUTPUT_STORE} ${CONFIG}
133        ${EXE_DIR}/enlarge_my_files.sh  ${INPUT_DMF_DATA} ${OUTPUT_STORE} ${CONFIG}
134        DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} TarDone
135
136
137    fi
138
139done
140
141export timeEndFile="${USER_OUTPUT_PROGRESS}/timeEndFile.txt"
142> $timeEndFile
143
144DEM_log -0 "Fin de ${SCRIPT_NAME}"
Note: See TracBrowser for help on using the repository browser.