[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 |
---|
| 29 | if [ ${hostname:0:5} = cicla ] ; then |
---|
[3694] | 30 | # chemin vers le rep dods de base |
---|
[3882] | 31 | DODSDIR=/thredds/ipsl |
---|
[3694] | 32 | # Rep ou sont stockes les multiatlas |
---|
| 33 | MULTIDIR=$DODSDIR/$login/lmdz/MultiSimu |
---|
[3743] | 34 | # Rep ou se trouve les sorties cmorizees |
---|
| 35 | ROOT_SIM_DIR=$DODSDIR/$login/lmdz/SE/ORIG |
---|
[3745] | 36 | ROOT_OBS_DIR=$DODSDIR/fabric/lmdz/SE/CMOR/OBS |
---|
[3694] | 37 | if [ ! -d $MULTIDIR ] ; then mkdir -p $MULTIDIR ; fi |
---|
[3745] | 38 | # Def entete des jobs |
---|
[3684] | 39 | cat <<eod >> entete.sh |
---|
| 40 | #PBS -N atlas |
---|
| 41 | #PBS -m a |
---|
| 42 | #PBS -j oe |
---|
| 43 | #PBS -q h12 |
---|
| 44 | #PBS -o atlasNOMSIMULATION.out |
---|
| 45 | #PBS -S /bin/bash |
---|
| 46 | #PBS -l nodes=1:ppn=1 |
---|
| 47 | #PBS -l mem=30gb |
---|
| 48 | #PBS -l vmem=30gb |
---|
| 49 | # |
---|
| 50 | # Commande pour soumettre en bash |
---|
| 51 | submit=qsub |
---|
| 52 | |
---|
| 53 | login=$login |
---|
| 54 | DODSDIR=$DODSDIR |
---|
| 55 | eod |
---|
| 56 | fi |
---|
| 57 | |
---|
| 58 | # CLIMSERV |
---|
| 59 | if [ ${hostname:0:5} = camel ] ; then |
---|
[3882] | 60 | DODSDIR=/thredds/ipsl |
---|
[3684] | 61 | cat <<eod > entete.sh |
---|
| 62 | #PBS -N atlas |
---|
| 63 | #PBS -m a |
---|
| 64 | #PBS -j oe |
---|
| 65 | #PBS -q h12 |
---|
| 66 | #PBS -o atlasNOMSIMULATION.out |
---|
| 67 | #PBS -S /bin/bash |
---|
| 68 | #PBS -l nodes=1:ppn=1 |
---|
| 69 | #PBS -l mem=30gb |
---|
| 70 | #PBS -l vmem=30gb |
---|
| 71 | # |
---|
| 72 | # Commande pour soumettre en bash |
---|
| 73 | submit=qsub |
---|
| 74 | eod |
---|
| 75 | fi |
---|
| 76 | |
---|
| 77 | # IRENE |
---|
| 78 | if [ ${hostname:0:5} = irene ] ; then |
---|
| 79 | cat <<eod > definerep.sh |
---|
| 80 | MAIN_SE= |
---|
| 81 | TS_DA= |
---|
| 82 | TS_MO= |
---|
| 83 | MULTIDIR= |
---|
| 84 | groupe= |
---|
| 85 | eod |
---|
| 86 | cat <<eod > entete.sh |
---|
| 87 | ###################### |
---|
| 88 | ## IRENE TGCC/CEA ## |
---|
| 89 | ###################### |
---|
| 90 | #MSUB -r multiatlas # Job name |
---|
| 91 | #MSUB -o multi.out_%I |
---|
| 92 | #MSUB -e multi.out_%I |
---|
| 93 | #MSUB -n 1 |
---|
| 94 | #MSUB -T 36000 # Maximum elapsed time |
---|
| 95 | #MSUB -q xlarge |
---|
| 96 | #MSUB -c 8 |
---|
| 97 | #MSUB -Q normal |
---|
| 98 | #MSUB -A $groupe |
---|
| 99 | #MSUB -m store,work,scratch |
---|
| 100 | # |
---|
| 101 | # Commande pour soumettre en bash |
---|
| 102 | submit=ccc_msub |
---|
| 103 | eod |
---|
| 104 | fi |
---|
| 105 | |
---|
[3745] | 106 | # JEAN-ZAY |
---|
[3684] | 107 | if [ ${hostname:0:5} = jean- ] ; then |
---|
| 108 | cat <<eod > definerep.sh |
---|
| 109 | MAIN_SE= |
---|
| 110 | TS_DA= |
---|
| 111 | TS_MO= |
---|
| 112 | MULTIDIR= |
---|
| 113 | groupe= |
---|
| 114 | eod |
---|
| 115 | cat <<eod > entete.sh |
---|
| 116 | ###################### |
---|
| 117 | ## IRENE TGCC/CEA ## |
---|
| 118 | ###################### |
---|
| 119 | #MSUB -r multiatlas # Job name |
---|
| 120 | #MSUB -o multi.out_%I |
---|
| 121 | #MSUB -e multi.out_%I |
---|
| 122 | #MSUB -n 1 |
---|
| 123 | #MSUB -T 36000 # Maximum elapsed time |
---|
| 124 | #MSUB -q xlarge |
---|
| 125 | #MSUB -c 8 |
---|
| 126 | #MSUB -Q normal |
---|
| 127 | #MSUB -A $groupe |
---|
| 128 | #MSUB -m store,work,scratch |
---|
| 129 | # |
---|
| 130 | # Commande pour soumettre en bash |
---|
| 131 | submit=sbash |
---|
| 132 | eod |
---|
| 133 | fi |
---|
| 134 | |
---|
| 135 | # PC (formation et perso linux) |
---|
| 136 | # Machines locales lmd |
---|
| 137 | |
---|
[3696] | 138 | local=`pwd -P` |
---|
| 139 | |
---|
[3737] | 140 | echo -e "${noir}%%%%%%%%%%%%%%%%%%%%%%% ${rougefonce} LMDZ MULTIATLAS ${noir}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
| 141 | echo |
---|
[3745] | 142 | echo -e "${bleufonce}"To create your multi-atlas you needs : |
---|
[3684] | 143 | echo 1. to create your multiatlas directory "example Multi01" : |
---|
[3882] | 144 | echo mkdir -p $DODSdir/$login/lmdz/MultiSimu/Multi01 |
---|
[3737] | 145 | echo |
---|
[3684] | 146 | echo 2. to define some characeristics of your multi-atlas "names, dates, description of simulations and atlas variables" : |
---|
[3882] | 147 | echo cp Utils/def.txt Utils/atlas-def ${DODSdir}/$login/lmdz/MultiSimu/Multi01/. |
---|
[3684] | 148 | echo define "names, date, description" of simulations in file : |
---|
[3882] | 149 | echo ${DODSdir}/$login/lmdz/MultiSimu/Multi01/def.txt |
---|
[3737] | 150 | echo define atlas variables in file : |
---|
[3882] | 151 | echo $DODSdir/$login/lmdz/MultiSimu/Multi01/atlas-def |
---|
[3737] | 152 | echo |
---|
[3696] | 153 | echo 3. Add the link to the simulation outputs in your file : $local/runs.txt |
---|
[3737] | 154 | echo |
---|
[3745] | 155 | |
---|
| 156 | ### creer le job principal |
---|
[3684] | 157 | rm -f job_multi.sh |
---|
| 158 | cat entete.sh >| job_multi.sh |
---|
| 159 | cat Utils/multi.sh >> job_multi.sh |
---|
| 160 | chmod +x job_multi.sh |
---|
| 161 | |
---|
[3743] | 162 | #### script pour creer les atlas |
---|
[3684] | 163 | rm -f atlas.sh |
---|
| 164 | cat entete.sh >| atlas.sh |
---|
| 165 | cat Utils/atlas0.sh >> atlas.sh |
---|
| 166 | chmod +x atlas.sh |
---|
| 167 | \mv atlas.sh atlas/. |
---|
[3743] | 168 | cp Utils/lmdz_SE0.py tmp0.py |
---|
| 169 | sed -e s:ROOT_SIM_DIR:$ROOT_SIM_DIR:g tmp0.py > tmp.py |
---|
| 170 | sed -e s:ROOT_OBS_DIR:$ROOT_OBS_DIR:g tmp.py > lmdz_SE.py |
---|
| 171 | rm -f tmp0.py tmp.py |
---|
| 172 | \mv lmdz_SE.py atlas/. |
---|
[3684] | 173 | |
---|
[3696] | 174 | echo 4. Then you can run your multiatlas : |
---|
[3684] | 175 | echo ./job_multi.sh Multi01 |
---|
[3737] | 176 | echo -e "${noir}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|