[3684] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | ################################################################################# |
---|
| 4 | # A.I : 1e version : Decembre 2019 |
---|
| 5 | # Reprise Mars 2020 |
---|
| 6 | # installer les scripts de post-traitement multi-atlas pour LMDZ sur une machine |
---|
[3745] | 7 | # le packege sera integre sous svn aux ..../BOL/Multi-Atlas |
---|
[3684] | 8 | # Ce script permet de definir les differents repertoires en fonction de la machine |
---|
| 9 | # Permet de creer les sscripts job_multi.sh et atlas.sh |
---|
| 10 | ################################################################################# |
---|
[3745] | 11 | # |
---|
| 12 | # |
---|
[3684] | 13 | # Definition des coleurs d'affichage |
---|
| 14 | noir='\e[0;30m' gris='\e[1;30m' rougefonce='\e[0;31m' rose='\e[1;31m' vertfonce='\e[0;32m' vertclair='\e[1;32m' orange='\e[0;33m' jaune='\e[1;33m' bleufonce='\e[0;34m' bleuclair='\e[1;34m' violetfonce='\e[0;35m' violetclair='\e[1;35m' cyanfonce='\e[0;36m' cyanclair='\e[1;36m' grisclair='\e[0;37m' blanc='\e[1;37m' neutre='\e[0;m' |
---|
[3694] | 15 | ## |
---|
| 16 | ## |
---|
[3684] | 17 | # AI avril 2020 : A FAIRE : |
---|
| 18 | # Utiliser des fonctions entete, ... |
---|
| 19 | # A function pour definir l entete du job en fonction de la machine |
---|
| 20 | #function jobentete { #1er argument doit etre le nom de la machine |
---|
| 21 | |
---|
[3694] | 22 | #set -x |
---|
[3745] | 23 | # Nom machine et login |
---|
[3684] | 24 | hostname=`hostname` |
---|
| 25 | login=`whoami` |
---|
| 26 | |
---|
[3694] | 27 | # Definitions en fonction de la machine |
---|
[3684] | 28 | # CICLAD |
---|
[4330] | 29 | if [ ${hostname:0:5} = cicla ] || [ ${hostname:0:5} = spiri ]; then |
---|
[4313] | 30 | echo hostname-0-5 is ${hostname:0:5} |
---|
[3694] | 31 | # chemin vers le rep dods de base |
---|
[3882] | 32 | DODSDIR=/thredds/ipsl |
---|
[3694] | 33 | # Rep ou sont stockes les multiatlas |
---|
| 34 | MULTIDIR=$DODSDIR/$login/lmdz/MultiSimu |
---|
[4313] | 35 | if [ ! -d $MULTIDIR ] ; then mkdir -p $MULTIDIR ; fi |
---|
[3743] | 36 | # Rep ou se trouve les sorties cmorizees |
---|
| 37 | ROOT_SIM_DIR=$DODSDIR/$login/lmdz/SE/ORIG |
---|
[3745] | 38 | ROOT_OBS_DIR=$DODSDIR/fabric/lmdz/SE/CMOR/OBS |
---|
[4313] | 39 | |
---|
[4330] | 40 | if [ -f entete.sh ]; then \rm entete.sh ; fi |
---|
[3745] | 41 | # Def entete des jobs |
---|
[3684] | 42 | cat <<eod >> entete.sh |
---|
| 43 | #PBS -N atlas |
---|
| 44 | #PBS -m a |
---|
| 45 | #PBS -j oe |
---|
| 46 | #PBS -q h12 |
---|
| 47 | #PBS -o atlasNOMSIMULATION.out |
---|
| 48 | #PBS -S /bin/bash |
---|
| 49 | #PBS -l nodes=1:ppn=1 |
---|
| 50 | #PBS -l mem=30gb |
---|
| 51 | #PBS -l vmem=30gb |
---|
| 52 | # |
---|
| 53 | # Commande pour soumettre en bash |
---|
| 54 | submit=qsub |
---|
| 55 | |
---|
| 56 | login=$login |
---|
| 57 | DODSDIR=$DODSDIR |
---|
| 58 | eod |
---|
| 59 | # CLIMSERV |
---|
[4313] | 60 | elif [ ${hostname:0:5} = camel ] ; then |
---|
| 61 | echo hostname-0-5 is ${hostname:0:5} |
---|
[3882] | 62 | DODSDIR=/thredds/ipsl |
---|
[3684] | 63 | cat <<eod > entete.sh |
---|
| 64 | #PBS -N atlas |
---|
| 65 | #PBS -m a |
---|
| 66 | #PBS -j oe |
---|
| 67 | #PBS -q h12 |
---|
| 68 | #PBS -o atlasNOMSIMULATION.out |
---|
| 69 | #PBS -S /bin/bash |
---|
| 70 | #PBS -l nodes=1:ppn=1 |
---|
| 71 | #PBS -l mem=30gb |
---|
| 72 | #PBS -l vmem=30gb |
---|
| 73 | # |
---|
| 74 | # Commande pour soumettre en bash |
---|
| 75 | submit=qsub |
---|
| 76 | eod |
---|
| 77 | |
---|
| 78 | # IRENE |
---|
[4313] | 79 | elif [ ${hostname:0:5} = irene ] ; then |
---|
| 80 | echo hostname-0-5 is ${hostname:0:5} |
---|
[3684] | 81 | cat <<eod > definerep.sh |
---|
| 82 | MAIN_SE= |
---|
| 83 | TS_DA= |
---|
| 84 | TS_MO= |
---|
| 85 | MULTIDIR= |
---|
| 86 | groupe= |
---|
| 87 | eod |
---|
| 88 | cat <<eod > entete.sh |
---|
| 89 | ###################### |
---|
| 90 | ## IRENE TGCC/CEA ## |
---|
| 91 | ###################### |
---|
| 92 | #MSUB -r multiatlas # Job name |
---|
| 93 | #MSUB -o multi.out_%I |
---|
| 94 | #MSUB -e multi.out_%I |
---|
| 95 | #MSUB -n 1 |
---|
| 96 | #MSUB -T 36000 # Maximum elapsed time |
---|
| 97 | #MSUB -q xlarge |
---|
| 98 | #MSUB -c 8 |
---|
| 99 | #MSUB -Q normal |
---|
| 100 | #MSUB -A $groupe |
---|
| 101 | #MSUB -m store,work,scratch |
---|
| 102 | # |
---|
| 103 | # Commande pour soumettre en bash |
---|
| 104 | submit=ccc_msub |
---|
| 105 | eod |
---|
| 106 | |
---|
[3745] | 107 | # JEAN-ZAY |
---|
[4313] | 108 | elif [ ${hostname:0:5} = jean- ] ; then |
---|
| 109 | echo hostname-0-5 is ${hostname:0:5} |
---|
[3684] | 110 | cat <<eod > definerep.sh |
---|
| 111 | MAIN_SE= |
---|
| 112 | TS_DA= |
---|
| 113 | TS_MO= |
---|
| 114 | MULTIDIR= |
---|
| 115 | groupe= |
---|
| 116 | eod |
---|
| 117 | cat <<eod > entete.sh |
---|
| 118 | ###################### |
---|
| 119 | ## IRENE TGCC/CEA ## |
---|
| 120 | ###################### |
---|
| 121 | #MSUB -r multiatlas # Job name |
---|
| 122 | #MSUB -o multi.out_%I |
---|
| 123 | #MSUB -e multi.out_%I |
---|
| 124 | #MSUB -n 1 |
---|
| 125 | #MSUB -T 36000 # Maximum elapsed time |
---|
| 126 | #MSUB -q xlarge |
---|
| 127 | #MSUB -c 8 |
---|
| 128 | #MSUB -Q normal |
---|
| 129 | #MSUB -A $groupe |
---|
| 130 | #MSUB -m store,work,scratch |
---|
| 131 | # |
---|
| 132 | # Commande pour soumettre en bash |
---|
| 133 | submit=sbash |
---|
| 134 | eod |
---|
| 135 | fi |
---|
| 136 | |
---|
| 137 | # PC (formation et perso linux) |
---|
| 138 | # Machines locales lmd |
---|
| 139 | |
---|
[3696] | 140 | local=`pwd -P` |
---|
| 141 | |
---|
[4340] | 142 | cd .. |
---|
| 143 | ln -s ${local}/env_Multi_atlas.sh . |
---|
| 144 | cd ${local} |
---|
| 145 | |
---|
[3737] | 146 | echo -e "${noir}%%%%%%%%%%%%%%%%%%%%%%% ${rougefonce} LMDZ MULTIATLAS ${noir}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
| 147 | echo |
---|
[3745] | 148 | echo -e "${bleufonce}"To create your multi-atlas you needs : |
---|
[3684] | 149 | echo 1. to create your multiatlas directory "example Multi01" : |
---|
[3882] | 150 | echo mkdir -p $DODSdir/$login/lmdz/MultiSimu/Multi01 |
---|
[3737] | 151 | echo |
---|
[3684] | 152 | echo 2. to define some characeristics of your multi-atlas "names, dates, description of simulations and atlas variables" : |
---|
[3882] | 153 | echo cp Utils/def.txt Utils/atlas-def ${DODSdir}/$login/lmdz/MultiSimu/Multi01/. |
---|
[3684] | 154 | echo define "names, date, description" of simulations in file : |
---|
[3882] | 155 | echo ${DODSdir}/$login/lmdz/MultiSimu/Multi01/def.txt |
---|
[3737] | 156 | echo define atlas variables in file : |
---|
[3882] | 157 | echo $DODSdir/$login/lmdz/MultiSimu/Multi01/atlas-def |
---|
[3737] | 158 | echo |
---|
[3696] | 159 | echo 3. Add the link to the simulation outputs in your file : $local/runs.txt |
---|
[3737] | 160 | echo |
---|
[3745] | 161 | |
---|
| 162 | ### creer le job principal |
---|
[3684] | 163 | rm -f job_multi.sh |
---|
| 164 | cat entete.sh >| job_multi.sh |
---|
| 165 | cat Utils/multi.sh >> job_multi.sh |
---|
| 166 | chmod +x job_multi.sh |
---|
| 167 | |
---|
[3915] | 168 | #### scripts pour creer les atlas |
---|
[3684] | 169 | rm -f atlas.sh |
---|
| 170 | cat entete.sh >| atlas.sh |
---|
| 171 | cat Utils/atlas0.sh >> atlas.sh |
---|
| 172 | chmod +x atlas.sh |
---|
| 173 | \mv atlas.sh atlas/. |
---|
[3915] | 174 | ### |
---|
| 175 | rm -f make_atlas.sh |
---|
| 176 | cat entete.sh >| make_atlas.sh |
---|
| 177 | cat Utils/make_atlas0.sh >> make_atlas.sh |
---|
| 178 | chmod +x make_atlas.sh |
---|
| 179 | \mv make_atlas.sh atlas/. |
---|
| 180 | |
---|
[3743] | 181 | cp Utils/lmdz_SE0.py tmp0.py |
---|
| 182 | sed -e s:ROOT_SIM_DIR:$ROOT_SIM_DIR:g tmp0.py > tmp.py |
---|
| 183 | sed -e s:ROOT_OBS_DIR:$ROOT_OBS_DIR:g tmp.py > lmdz_SE.py |
---|
| 184 | rm -f tmp0.py tmp.py |
---|
| 185 | \mv lmdz_SE.py atlas/. |
---|
[3684] | 186 | |
---|
[4307] | 187 | exit |
---|
[3696] | 188 | echo 4. Then you can run your multiatlas : |
---|
[3684] | 189 | echo ./job_multi.sh Multi01 |
---|
[3737] | 190 | echo -e "${noir}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|