source: TOOLS/PACK_IPSL/launch_ipsl_enlarge.sh @ 1875

Last change on this file since 1875 was 1875, checked in by gpincka, 12 years ago

portage sur machine ulam de l'idris

  • Property svn:executable set to *
File size: 4.1 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
39export JOB_DIR=${LS_SUBCWD:-${PWD}}
40export EXE_DIR=${JOB_DIR}
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
56
57export clean_tmp=${clean_tmp:-yes}
58export DEM_LOG=${JOB_DIR}/dem_${LSB_JOBID:-${$}}.log
59export LOG_LEV=2
60
61export config_card=${IGCM_DEM}/config_card.liste
62
63
64############## gpdebug : Pour gestion des erreurs #########################################
65# Execute la function errorReceive() si reception d'un signal TERM
66trap 'DEM_errorReceive' TERM
67# liste des processus à détruire en cas d'erreur bloquante
68export listPID=$$
69# fichier pour la transmission des messages d'erreur d'un fils au prog principal
70export errorMsgFile="${PWD}/errorMsg.txt"
71############## gpdebug : fin ##############################################################
72
73source ${EXE_DIR}/DEM_utilities.sh
74
75DEM_log -0 "Demarrage de ${SCRIPT_NAME}"
76
77if [ "x${ON_IDRIS}" == "xno" ]
78then
79    check_nco_version # verification de la version de nco #######################
80else
81    check_nco_version_idris # verification de la version de nco (sur la machine ulam de l'idris)
82    check_netcdf_idris      # verification du chargement du module netCDF (pour cmd ncdump)
83fi
84
85# gpdebug : si l'option -f est activee, on detruit tous les fichiers status
86if [ "x$restartExecFromZero" == "x1" ]
87then
88    echo "Deleting  all status files ..."
89    for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste )
90    do
91       PATH_SIMU=$( dirname $CONFIG )
92       ListStatFileInSimu=`find $PATH_SIMU -type f -name "*status" `
93       if [ "x$ListStatFileInSimu" != "x" ]
94       then
95           for file in $ListStatFileInSimu
96           do
97              if [ -e $file ]
98              then
99                 rm -f $file
100              fi
101       
102           done     
103       fi   
104    done
105    echo "Deletion done."
106fi
107# gpdebug : end
108
109export timeLaunchStartFile="${USER_OUTPUT_PROGRESS}/timeLaunchStartFile.txt"
110> $timeLaunchStartFile
111startTime=$( getDateMilliSeconds )
112echo "launch time:$startTime" > $timeLaunchStartFile
113
114
115for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do
116
117    DEM_state=$( DEM_read_state ${IGCM_DEM}/config_card.liste ${CONFIG} )
118
119    if [[ "${DEM_state}" != "WriteListTarDone" ]] ; then
120
121        DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} PackRunning
122        export PATH_SIMU=$( dirname $CONFIG )
123        ${EXE_DIR}/enlarge_my_files.sh ${INPUT_DMF_DATA} ${OUTPUT_STORE} ${OUTPUT_WORK}
124   
125        DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} PackDone
126
127    else
128        DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} TarRunning
129        export PATH_SIMU=$( dirname $CONFIG )
130        ${EXE_DIR}/tar_full_simu.sh  ${INPUT_DMF_DATA} ${OUTPUT_STORE} ${CONFIG}
131       
132        DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} TarDone
133
134
135    fi
136
137done
138
139export timeEndFile="${USER_OUTPUT_PROGRESS}/timeEndFile.txt"
140> $timeEndFile
141
142DEM_log -0 "Fin de ${SCRIPT_NAME}"
Note: See TracBrowser for help on using the repository browser.