[1853] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | # Variables d'environnement |
---|
| 4 | export IGCM_DEM="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/IGCM_DEM" |
---|
| 5 | export INPUT_DMF_DATA="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME_DATAS" |
---|
| 6 | export OUTPUT_STORE="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_STORE" |
---|
| 7 | export OUTPUT_WORK="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_WORK" |
---|
| 8 | export OUTPUT_CHECK="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_CHECK" |
---|
| 9 | export OUTPUT_PROGRESS="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_PROGRESS" |
---|
| 10 | |
---|
[1858] | 11 | # Sur curie en sequentiel |
---|
| 12 | # export OUTPUT_PROGRESS="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_PROGRESS_SEQ" |
---|
| 13 | # export OUTPUT_STORE="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_STORE_SEQ" |
---|
| 14 | # export OUTPUT_WORK="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_WORK_SEQ" |
---|
| 15 | |
---|
| 16 | |
---|
[1853] | 17 | # Pour titane |
---|
| 18 | #export IGCM_DEM="/scratch/cont003/pierreg/IGCM_DEM" |
---|
| 19 | #export INPUT_DMF_DATA="/scratch/cont003/pierreg/datasLabo/dataDMNFS_simple1" |
---|
| 20 | #export OUTPUT_STORE="/scratch/cont003/pierreg/PSEUDO_DMNFS_STORE" |
---|
| 21 | #export OUTPUT_WORK="/scratch/cont003/pierreg/PSEUDO_DMNFS_WORK" |
---|
| 22 | #export OUTPUT_CHECK="/scratch/cont003/pierreg/PSEUDO_DMNFS_CHECK" |
---|
| 23 | #export OUTPUT_PROGRESS="/scratch/cont003/pierreg/PSEUDO_DMNFS_PROGRESS" |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | |
---|
[1863] | 27 | # Determination du chemin pour le rep ${PSEUDO_DMNFS_PROGRESS}/USER (seulement pour la partie de pack) |
---|
| 28 | # ------------------------------------------------------------------ |
---|
| 29 | # Le rep ${OUTPUT_PROGRESS} contiendra des sous rep USER |
---|
| 30 | # ${OUTPUT_PROGRESS}/USER contiendra, pour l'utilisateur USER : |
---|
| 31 | # * la liste des taches a executer en parallele par le prog c/mpi |
---|
| 32 | # * la nouvelle liste des taches qui n'ont pas ete reussies dans un premier temps |
---|
| 33 | # * les sorties des taches executees en parallele (traitement des liste de fichiers) |
---|
| 34 | # L'idee est de regrouper ces elements dans un rep ${OUTPUT_PROGRESS}/USER |
---|
| 35 | # Pour determiner le rep USER, on parcourt ${IGCM_DEM}/config_card.liste. |
---|
| 36 | # La chaine de caract commune a toutes les lignes de ce fichier est le rep USER, |
---|
| 37 | # que l'on cree ensuite dans ${OUTPUT_PROGRESS} |
---|
[1853] | 38 | |
---|
[1863] | 39 | function find_intersection |
---|
| 40 | { |
---|
| 41 | # Trouve la sous chaine commune de 2 chaines de caract |
---|
| 42 | local string1=$1 |
---|
| 43 | local string2=$2 |
---|
[1853] | 44 | |
---|
[1863] | 45 | local lengthString1=${#string1} |
---|
| 46 | local lengthString2=${#string2} |
---|
[1853] | 47 | |
---|
[1863] | 48 | local longestString= |
---|
| 49 | local smallestString= |
---|
| 50 | if [ $lengthString1 -ge $lengthString2 ] |
---|
| 51 | then |
---|
| 52 | longestString=$string1 |
---|
| 53 | smallestString=$string2 |
---|
| 54 | else |
---|
| 55 | longestString=$string2 |
---|
| 56 | smallestString=$string1 |
---|
| 57 | fi |
---|
[1853] | 58 | |
---|
[1863] | 59 | while [ "x`echo $longestString | grep $smallestString `" == "x" ] |
---|
| 60 | do |
---|
| 61 | smallestString=$( dirname $smallestString ) |
---|
| 62 | done |
---|
| 63 | echo "$smallestString" |
---|
| 64 | } |
---|
[1853] | 65 | |
---|
[1863] | 66 | |
---|
| 67 | scriptCallingThisOne="$scriptCallingLoad" |
---|
| 68 | # echo "scriptCallingThisOne=$scriptCallingThisOne" |
---|
| 69 | |
---|
| 70 | if [ "x${scriptCallingThisOne}" != "xlaunch_ipsl_pack.sh" ] |
---|
| 71 | then |
---|
| 72 | |
---|
| 73 | echo "specific loading for pack script." |
---|
| 74 | |
---|
[1858] | 75 | COMMON_STRING=`head -n 1 ${IGCM_DEM}/config_card.liste | awk '{print $1}' | xargs dirname ` |
---|
| 76 | for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do |
---|
[1853] | 77 | |
---|
[1858] | 78 | PATH_SIMU=$( dirname $CONFIG ) |
---|
| 79 | INTERSECT=$( find_intersection $PATH_SIMU $COMMON_STRING ) |
---|
| 80 | COMMON_STRING=$INTERSECT |
---|
[1853] | 81 | |
---|
[1858] | 82 | done |
---|
[1853] | 83 | |
---|
[1858] | 84 | # echo "COMMON_STRING=$COMMON_STRING" |
---|
[1853] | 85 | |
---|
[1858] | 86 | PATH_TO_ADD=`echo $COMMON_STRING | sed "s;${IGCM_DEM};;" | sed 's;^/;;' ` |
---|
| 87 | # echo "PATH_TO_ADD=$PATH_TO_ADD" |
---|
| 88 | |
---|
| 89 | USER_OUTPUT_PROGRESS="${OUTPUT_PROGRESS}/${PATH_TO_ADD}" |
---|
| 90 | export USER_OUTPUT_PROGRESS=`echo $USER_OUTPUT_PROGRESS | sed 's;/$;;' ` |
---|
| 91 | export DETAILLED_OUTPUT="${USER_OUTPUT_PROGRESS}/detailed_pack_output" |
---|
| 92 | |
---|
| 93 | # creation du rep ${IGCM_DEM}/PSEUDO_DMNFS_PROGRESS/USER |
---|
| 94 | mkdir -p ${USER_OUTPUT_PROGRESS} |
---|
| 95 | |
---|
| 96 | # creation d'un rep specifique pour les sorties detaillees des operations de pack |
---|
| 97 | mkdir -p ${DETAILLED_OUTPUT} |
---|
| 98 | |
---|
| 99 | fi |
---|