#!/bin/bash ###################### ## TITANE CEA ## ###################### #MSUB -r ipsl_pack # Nom du job #MSUB -eo #MSUB -n 1 # Reservation du processus #MSUB -T 86400 # Limite de temps elapsed du job #MSUB -p gen2211 #MSUB -q mono # ex : ./launch_ipsl_enlarge.sh param_ACA.txt # Est-on sur ulam (machine de l'IDRIS) ? is_idris_machine=`hostname | grep "ulam" | wc -l ` ON_IDRIS="no" if [ "x${is_idris_machine}" != "x0" ] then ON_IDRIS="yes" fi export ON_IDRIS=${ON_IDRIS} # gpdebug : pour option -f restartExecFromZero=0 while [ $# -gt 0 ] do echo "boucle sur les arguments du script ..." echo "@=$@" case $1 in -f) restartExecFromZero=1 echo "force restart from the beginning ..." ;; esac shift done export restartExecFromZero=${restartExecFromZero} # gpdebug : end #export JOB_DIR=${TMP_MIGR_DATA} #export EXE_DIR=${LS_SUBCWD:-${PWD}} # export INPUT_DMF_DATA=/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable # gpdebug : suppr # export OUTPUT_STORE=${SCRATCHDIR}/PSEUDO_DMNFS_STORE # gpdebug : suppr # export OUTPUT_WORK=${SCRATCHDIR}/PSEUDO_DMNFS_WORK # gpdebug : suppr SCRIPT_NAME=$(basename ${0} ) # export IGCM_DEM=${SCRATCHDIR}/IGCM_DEM # gpdebug : suppr # export IGCM_TMP=${SCRATCHDIR}/IGCM_DEM/tmp # gpdebug : suppr # On renseigne les variables d'environnement export scriptCallingLoad=$SCRIPT_NAME # sert a renseigner "load_ipslPack_env.sh" sur le script l'appelant . load_ipslPack_env.sh export IGCM_TMP="${IGCM_DEM}/tmp" # gpdebug : added export JOB_DIR=${TMP_MIGR_DATA} export EXE_DIR=${LS_SUBCWD:-${PWD}} export clean_tmp=${clean_tmp:-yes} export DEM_LOG=${JOB_DIR}/dem_${LSB_JOBID:-${$}}.log export LOG_LEV=2 export config_card=${IGCM_DEM}/config_card.liste ############## gpdebug : Pour gestion des erreurs ######################################### # Execute la function errorReceive() si reception d'un signal TERM trap 'DEM_errorReceive' TERM # liste des processus à détruire en cas d'erreur bloquante export listPID=$$ # fichier pour la transmission des messages d'erreur d'un fils au prog principal export errorMsgFile="${TMP_MIGR_DATA}/errorMsg.txt" ############## gpdebug : fin ############################################################## source ${EXE_DIR}/DEM_utilities.sh DEM_log -0 "Demarrage de ${SCRIPT_NAME}" if [ "x${ON_IDRIS}" == "xno" ] then check_nco_version # verification de la version de nco ####################### else check_nco_version_idris # verification de la version de nco (sur la machine ulam de l'idris) check_netcdf_idris # verification du chargement du module netCDF (pour cmd ncdump) fi # gpdebug : si l'option -f est activee, on detruit tous les fichiers status if [ "x$restartExecFromZero" == "x1" ] then echo "Deleting all status files ..." for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) do PATH_SIMU=$( dirname $CONFIG ) ListStatFileInSimu=`find $PATH_SIMU -type f -name "*status" ` if [ "x$ListStatFileInSimu" != "x" ] then for file in $ListStatFileInSimu do if [ -e $file ] then rm -f $file fi done fi done echo "Deletion done." fi # gpdebug : end export timeLaunchStartFile="${USER_OUTPUT_PROGRESS}/timeLaunchStartFile.txt" > $timeLaunchStartFile startTime=$( getDateMilliSeconds ) echo "launch time:$startTime" > $timeLaunchStartFile for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do DEM_state=$( DEM_read_state ${IGCM_DEM}/config_card.liste ${CONFIG} ) if [[ "${DEM_state}" != "WriteListTarDone" ]] ; then DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} PackRunning export PATH_SIMU=$( dirname $CONFIG ) ${EXE_DIR}/enlarge_my_files.sh ${INPUT_DMF_DATA} ${OUTPUT_STORE} ${OUTPUT_WORK} DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} PackDone else DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} TarRunning export PATH_SIMU=$( dirname $CONFIG ) # ${EXE_DIR}/tar_full_simu.sh ${INPUT_DMF_DATA} ${OUTPUT_STORE} ${CONFIG} ${EXE_DIR}/enlarge_my_files.sh ${INPUT_DMF_DATA} ${OUTPUT_STORE} ${CONFIG} DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} TarDone fi done export timeEndFile="${USER_OUTPUT_PROGRESS}/timeEndFile.txt" > $timeEndFile DEM_log -0 "Fin de ${SCRIPT_NAME}"