source: BOL/Multi_atlas/install_multi_atlas.sh

Last change on this file was 4340, checked in by musat, 19 months ago

Inclut environnement spirit et dernieres corrections (1/3)
IonelaMusat?

  • Property svn:executable set to *
File size: 5.1 KB
Line 
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 integre sous svn aux ..../BOL/Multi-Atlas
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#
12#
13# Definition des coleurs d'affichage
14noir='\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'
15##
16##
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
22#set -x
23# Nom machine et login
24hostname=`hostname`
25login=`whoami`
26
27# Definitions en fonction de la machine
28# CICLAD
29if [ ${hostname:0:5} = cicla ] || [ ${hostname:0:5} = spiri ]; then
30echo hostname-0-5 is ${hostname:0:5}
31# chemin vers le rep dods de base
32DODSDIR=/thredds/ipsl
33# Rep ou sont stockes les multiatlas
34MULTIDIR=$DODSDIR/$login/lmdz/MultiSimu
35if [ ! -d $MULTIDIR ] ; then mkdir -p $MULTIDIR ; fi
36# Rep ou se trouve les sorties cmorizees
37ROOT_SIM_DIR=$DODSDIR/$login/lmdz/SE/ORIG
38ROOT_OBS_DIR=$DODSDIR/fabric/lmdz/SE/CMOR/OBS
39
40if [ -f entete.sh ]; then \rm entete.sh ; fi
41# Def entete des jobs
42cat <<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
54submit=qsub
55
56login=$login
57DODSDIR=$DODSDIR
58eod
59# CLIMSERV
60elif [ ${hostname:0:5} = camel ] ; then
61echo hostname-0-5 is ${hostname:0:5}
62DODSDIR=/thredds/ipsl
63cat <<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
75submit=qsub
76eod
77
78# IRENE
79elif [ ${hostname:0:5} = irene ] ; then
80echo hostname-0-5 is ${hostname:0:5}
81cat <<eod > definerep.sh
82MAIN_SE=
83TS_DA=
84TS_MO=
85MULTIDIR=
86groupe=
87eod
88cat <<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
104submit=ccc_msub
105eod
106
107# JEAN-ZAY
108elif [ ${hostname:0:5} = jean- ] ; then
109echo hostname-0-5 is ${hostname:0:5}
110cat <<eod > definerep.sh
111MAIN_SE=
112TS_DA=
113TS_MO=
114MULTIDIR=
115groupe=
116eod
117cat <<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
133submit=sbash
134eod
135fi
136
137# PC (formation et perso linux)
138# Machines locales lmd
139
140local=`pwd -P`
141
142cd ..
143ln -s ${local}/env_Multi_atlas.sh .
144cd ${local}
145
146echo -e "${noir}%%%%%%%%%%%%%%%%%%%%%%% ${rougefonce} LMDZ MULTIATLAS ${noir}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
147echo
148echo -e "${bleufonce}"To create your multi-atlas you needs :
149echo 1.  to create your multiatlas directory "example Multi01" :
150echo     mkdir -p $DODSdir/$login/lmdz/MultiSimu/Multi01
151echo 
152echo 2.  to define some characeristics of your multi-atlas "names, dates, description of simulations and atlas variables" :
153echo     cp Utils/def.txt  Utils/atlas-def ${DODSdir}/$login/lmdz/MultiSimu/Multi01/.
154echo     define "names, date, description" of simulations in file :
155echo     ${DODSdir}/$login/lmdz/MultiSimu/Multi01/def.txt
156echo     define atlas variables in file :
157echo     $DODSdir/$login/lmdz/MultiSimu/Multi01/atlas-def
158echo
159echo 3.   Add the link to the simulation outputs in your file : $local/runs.txt
160echo 
161
162### creer le job principal
163rm -f job_multi.sh
164cat entete.sh >| job_multi.sh
165cat Utils/multi.sh >> job_multi.sh
166chmod +x job_multi.sh
167
168#### scripts pour creer les atlas
169rm -f atlas.sh
170cat entete.sh >| atlas.sh
171cat Utils/atlas0.sh >> atlas.sh
172chmod +x atlas.sh
173\mv atlas.sh atlas/.
174###
175rm -f make_atlas.sh
176cat entete.sh >| make_atlas.sh
177cat Utils/make_atlas0.sh >> make_atlas.sh
178chmod +x make_atlas.sh
179\mv make_atlas.sh atlas/.
180
181cp Utils/lmdz_SE0.py tmp0.py
182sed -e s:ROOT_SIM_DIR:$ROOT_SIM_DIR:g tmp0.py > tmp.py
183sed -e s:ROOT_OBS_DIR:$ROOT_OBS_DIR:g tmp.py > lmdz_SE.py
184rm -f tmp0.py tmp.py
185\mv lmdz_SE.py atlas/.
186
187exit
188echo 4. Then you can run your multiatlas :
189echo ./job_multi.sh Multi01
190echo -e "${noir}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
Note: See TracBrowser for help on using the repository browser.