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