1 | #!/bin/ksh |
---|
2 | # subjob - Plot-Shellskript Version: @(#)SUBJOB 1.0 |
---|
3 | # $Id: subjob 291 2009-04-16 12:07:26Z raasch $ |
---|
4 | |
---|
5 | # Prozedur zum automatischen Generieren von Batch-Jobs, die unter NQS |
---|
6 | # laufen sollen und deren Ergebnis (Dayfile) zum Job-generierenden |
---|
7 | # Host zurueckgeschickt werden sollen |
---|
8 | |
---|
9 | |
---|
10 | # letzte Aenderung: |
---|
11 | # 29/06/94 - Siggi - Beginn mit Erstellung der Originalversion |
---|
12 | # 08/07/94 - Siggi - Originalversion abgeschlossen (Version 1.0) |
---|
13 | # 06/02/98 - Siggi - berte validiert |
---|
14 | # 27/01/01 - Siggi - ground.yonsei.ac.kr validiert, Jobs zur T3E in Korea |
---|
15 | # moeglich |
---|
16 | # 08/02/01 - Siggi - alle subjob-Meldungen ins englische uebersetzt |
---|
17 | # 25/05/02 - Siggi - Unterstuetzung des LoadLeveler |
---|
18 | # 30/05/02 - Siggi - Validierung fuer ibm-Rechner in Seoul (nobel) sowie |
---|
19 | # allgemeine Anpassungen fuer ibm-Rechner |
---|
20 | # 15/10/02 - Siggi - Neue Default-Jobklasse (p_normal) fuer IBM in Seoul |
---|
21 | # Ruecktransfer des Jobprotokolls fuer diese |
---|
22 | # Maschine abgeschaltet |
---|
23 | # 31/10/02 - Siggi - berni validiert |
---|
24 | # 06/11/02 - Siggi - Neue Jobklassen auf ibmb und ibmh |
---|
25 | # 08/11/02 - Siggi - quanero validiert |
---|
26 | # 11/12/02 - Siggi - Notification fuer Transfer-Jobs abgeschaltet |
---|
27 | # 23/01/03 - Siggi - hostname nobel changed to nobela |
---|
28 | # 06/02/03 - Siggi - gregale validated |
---|
29 | # 12/02/03 - Siggi - orkan and maestro validated |
---|
30 | # 21/02/03 - Siggi - all nobel nodes in Seoul validated |
---|
31 | # 12/03/03 - Siggi - nec at DKRZ validated |
---|
32 | # 13/03/03 - Siggi - new nqs resource variable Memory |
---|
33 | # 07/04/03 - Siggi - processor request option -c on nech needs tasks per |
---|
34 | # node |
---|
35 | # 11/04/03 - Siggi - network on ibms has attribute "shared" |
---|
36 | # 31/07/03 - Siggi - nqs2 on nech implemented (provisional: -h nech2) |
---|
37 | # cxxl added to ibmh |
---|
38 | # 29/08/03 - Siggi - changes in job queues and communication system on |
---|
39 | # ibms |
---|
40 | # 24/10/03 - Siggi - using alternate hanni address 130.75.4.2 |
---|
41 | # 30/10/03 - Siggi - nech is not supported any more |
---|
42 | # 10/11/03 - Siggi - nech2 renamed to nech |
---|
43 | # 20/11/03 - Siggi - submit command on nech changed from qsub.test to qsub |
---|
44 | # 29/03/04 - Siggi - ground not supported any more, gfdl3 validated |
---|
45 | # 31/03/04 - Siggi - new option -N for node usage |
---|
46 | # 12/04/04 - Siggi - scp2 instead of scp used for transfer from decalpha |
---|
47 | # due to error in ssh installation (otherwise a prompt |
---|
48 | # for the password appears) |
---|
49 | # 23/07/04 - Siggi - changes due to the new berni configuration |
---|
50 | # (federation switch) |
---|
51 | # 01/09/04 - Gerald new job-classes on hanni |
---|
52 | # 08/09/04 - Siggi - hanni IP address changed to 130.75.4.10 |
---|
53 | # 23/11/04 - Siggi - new job class cdata on hanni and berni |
---|
54 | # 03/12/04 - Siggi - notification on ibm switched of in case of |
---|
55 | # delete_dayfile = true, node usage in cdev set to |
---|
56 | # shared |
---|
57 | # 16/02/05 - Gerald hababai validated |
---|
58 | # 29/03/05 - Micha - new job class channi on hanni |
---|
59 | # 11/05/05 - Siggi - ConsumableMemory is now required as resource keyword |
---|
60 | # on ibms |
---|
61 | # 24/05/05 - Siggi - Default queue on ibms changed from p_normal_1.3 to |
---|
62 | # p_normal |
---|
63 | # 30/06/05 - Siggi - network changed for queue cdev from "us" to "ip" |
---|
64 | # 12/07/05 - Siggi - in network.mpi on ibmh/ibmb "csss" changed to |
---|
65 | # "sn_all", new job class cexp |
---|
66 | # 08/09/05 - Siggi - IP-address of gfdl3 changed |
---|
67 | # 31/10/05 - Siggi - new job class pp on hurricane, serial jobs on |
---|
68 | # hurricane (with -X0) |
---|
69 | # 01/11/05 - Siggi - missing queue for jobs submitted on nech (for nech) |
---|
70 | # added |
---|
71 | # 30/12/05 - Siggi - change of IP adresses in subnet 130.75.105 |
---|
72 | # 09/02/06 - Siggi - ibmy admitted |
---|
73 | # 10/02/06 - Siggi - scp2 changed to /bin/scp on decalpha |
---|
74 | # 13/04/06 - Siggi - ostria admitted |
---|
75 | # 18/04/06 - Siggi - new option -O for OpenMP usage |
---|
76 | # 24/05/06 - Siggi - lctit admitted, ftpjob renamed scpjob |
---|
77 | # 25/07/06 - Siggi - gfdl5 (ibmy) admitted for submitting jobs |
---|
78 | # 27/09/06 - Siggi - breg/hreg extended with berni/hanni |
---|
79 | # 25/10/06 - Siggi - data_limit set to 1.76 GByte on hanni and berni |
---|
80 | # 28/11/06 - Siggi - levanto admitted |
---|
81 | # 13/02/07 - Siggi - hpmuk releated code removed |
---|
82 | # 01/03/07 - Siggi - adjustments for RIAM machines gate and NEC-SX8 (n-sx) |
---|
83 | # 12/04/07 - Siggi - option -f (filetransfer protocol) removed, scp only |
---|
84 | # 27/07/07 - Siggi - autan admitted |
---|
85 | # 03/08/07 - Marcus- lcfimm admitted |
---|
86 | # 08/10/07 - Siggi - further job classes added for hanni (csoloh...) |
---|
87 | # 15/10/07 - Siggi - preliminary adjustments for lctit based on Jin's |
---|
88 | # suggestions |
---|
89 | # 19/10/07 - Marcus- add new optional argument -g group_number |
---|
90 | # 19/10/07 - Siggi - a ";" was missing in the last change done by Marcus |
---|
91 | # 30/10/07 - Marcus- further adjustments for queues on lctit |
---|
92 | # 15/05/08 - Siggi - adjustments for lcxt4 (Bergen Center for Computational |
---|
93 | # Science) |
---|
94 | # 14/07/08 - Siggi - adjustments for lcsgih |
---|
95 | # 23/09/08 - Gerald- paesano admitted |
---|
96 | # 02/10/08 - Siggi - PBS adjustments for lcxt4 |
---|
97 | # 02/03/09 - Siggi - Adjustments for new NEC-SX9 at RIAM |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | # VARIABLENVEREINBARUNGEN + DEFAULTWERTE |
---|
102 | delete_dayfile=false |
---|
103 | group_number=none |
---|
104 | locat=normal |
---|
105 | no_default_queue=none |
---|
106 | no_submit=false |
---|
107 | job_catalog="~/job_queue" |
---|
108 | job_name=none |
---|
109 | local_user=$LOGNAME |
---|
110 | node_usage=shared |
---|
111 | numprocs=1 |
---|
112 | punkte="..........................................................." |
---|
113 | submcom=qsub |
---|
114 | queue=default |
---|
115 | remote_host=none |
---|
116 | remote_user="" |
---|
117 | verify=true |
---|
118 | |
---|
119 | typeset -i cputime=0 memory=0 Memory=0 minuten resttime sekunden stunden |
---|
120 | typeset -i inumprocs nodes=0 tasks_per_node=0 threads_per_task=1 |
---|
121 | typeset -L20 spalte1 |
---|
122 | typeset -R40 spalte2 |
---|
123 | typeset -L60 spalte3 |
---|
124 | |
---|
125 | |
---|
126 | |
---|
127 | # FEHLERBEHANDLUNG |
---|
128 | # BEI EXIT: |
---|
129 | trap 'if [[ $locat != normal ]] |
---|
130 | then |
---|
131 | case $locat in |
---|
132 | (option) printf "\n --> available optios can be displayed" |
---|
133 | printf " by typing:" |
---|
134 | printf "\n \"subjob ?\" \n";; |
---|
135 | (ftpcopy|parameter|scp|verify) printf "\n";; |
---|
136 | (*) printf "\n +++ unknown error" |
---|
137 | printf "\n please inform S. Raasch!\n" |
---|
138 | esac |
---|
139 | [[ -f $job_to_send ]] && rm $job_to_send |
---|
140 | printf "\n\n+++ SUBJOB killed \n\n" |
---|
141 | fi' exit |
---|
142 | |
---|
143 | |
---|
144 | # BEI TERMINAL-BREAK: |
---|
145 | trap '[[ -f $job_to_send ]] && rm $job_to_send |
---|
146 | printf "\n\n+++ SUBJOB killed \n\n" |
---|
147 | exit |
---|
148 | ' 2 |
---|
149 | |
---|
150 | |
---|
151 | |
---|
152 | |
---|
153 | # LOKALEN HOSTNAMEN FESTSTELLEN |
---|
154 | local_host=$(hostname) |
---|
155 | |
---|
156 | |
---|
157 | |
---|
158 | # HOSTSPEZIFISCHE VARIABLEN VEREINBAREN BZW. PRUEFEN, OB LOKALER HOST |
---|
159 | # UEBERHAUPT ZULAESSIG IST |
---|
160 | case $local_host in |
---|
161 | (atmos) local_addres=172.20.25.35; local_host=lcide;; |
---|
162 | (autan) local_addres=130.75.105.57; local_host=lcmuk;; |
---|
163 | (bora) local_addres=130.75.105.103; local_host=lcmuk;; |
---|
164 | (bicegate1) local_addres=130.73.232.102; local_host=lcsgib;; |
---|
165 | (bicegate2) local_addres=130.73.232.103; local_host=lcsgib;; |
---|
166 | (breg*-en0|berni*-en0) local_addres=130.73.230.10; local_host=ibmb;; |
---|
167 | (breva) local_addres=130.75.105.98; local_host=lcmuk;; |
---|
168 | (b01*) local_addres=130.73.232.102; local_host=lcsgib;; |
---|
169 | (compute-*.local) local_addres=172.20.4.2; local_host=lcfimm;; |
---|
170 | (cs*) local_addres=136.172.44.131; local_host=nech;; |
---|
171 | (elephanta) local_addres=130.75.105.6; local_host=lcmuk;; |
---|
172 | (fimm.bccs.uib.no) local_addres=172.20.4.2; local_host=lcfimm;; |
---|
173 | (gallego) local_addres=130.75.105.10; local_host=lcmuk;; |
---|
174 | (gfdl5) local_addres=165.132.26.58; local_host=ibmy;; |
---|
175 | (gfdl3.yonsei.ac.kr) local_addres=165.132.26.56; local_host=decalpha;; |
---|
176 | (gregale) local_addres=130.75.105.109; local_host=lcmuk;; |
---|
177 | (hababai) local_addres=130.75.105.108; local_host=lcmuk;; |
---|
178 | (hexagon.bccs.uib.no) local_addres=129.177.20.113; local_host=lcxt4;; |
---|
179 | (hicegate1) local_addres=130.75.4.102; local_host=lcsgih;; |
---|
180 | (hicegate2) local_addres=130.75.4.103; local_host=lcsgih;; |
---|
181 | (hreg*-en0|hanni*-en0) local_addres=130.75.4.10; local_host=ibmh;; |
---|
182 | (h01*) local_addres=130.75.4.102; local_host=lcsgih;; |
---|
183 | (irifi) local_addres=130.75.105.104; local_host=lcmuk;; |
---|
184 | (levanto) local_addres=130.75.105.45; local_host=lcmuk;; |
---|
185 | (maestro) local_addres=130.75.105.2; local_host=lcmuk;; |
---|
186 | (nid*) local_addres=129.177.20.113; local_host=lcxt4;; |
---|
187 | (nobel*) local_addres=150.183.5.101; local_host=ibms;; |
---|
188 | (orkan) local_addres=130.75.105.3; local_host=lcmuk;; |
---|
189 | (ostria) local_addres=130.75.105.106; local_host=lcmuk;; |
---|
190 | (paesano) local_addres=130.75.105.46; local_host=lcmuk;; |
---|
191 | (quanero) local_addres=130.75.105.107; local_host=lcmuk;; |
---|
192 | (scirocco) local_addres=172.20.25.41; local_host=lcmuk;; |
---|
193 | (sun1|sun2) local_addres=130.75.6.1; local_host=unics;; |
---|
194 | (sx-*) local_addres=172.16.1.131; local_host=necriam;; |
---|
195 | (r1*) local_addres=130.75.4.102; local_host=lcsgih;; |
---|
196 | (r2*) local_addres=130.73.232.102; local_host=lcsgib;; |
---|
197 | (tgg*) local_addres=172.17.75.161; local_host=lctit;; |
---|
198 | (vorias) local_addres=172.20.25.43; local_host=lcmuk;; |
---|
199 | (*) printf "\n +++ \"$local_host\" unknown"; |
---|
200 | printf "\n please inform S. Raasch!"; |
---|
201 | locat=parameter; exit;; |
---|
202 | esac |
---|
203 | |
---|
204 | |
---|
205 | |
---|
206 | # REMOTE HOST DEFAULTMAESSIG = LOCAL HOST SETZEN |
---|
207 | remote_host=$local_host |
---|
208 | |
---|
209 | |
---|
210 | |
---|
211 | |
---|
212 | # PROZEDUROPTIONEN EINLESEN |
---|
213 | while getopts :c:dDg:h:m:n:N:O:q:t:T:u:vX: option |
---|
214 | do |
---|
215 | case $option in |
---|
216 | (c) job_catalog=$OPTARG;; |
---|
217 | (d) delete_dayfile=true;; |
---|
218 | (D) no_submit=true;; |
---|
219 | (g) group_number=$OPTARG;; |
---|
220 | (h) remote_host=$OPTARG;; |
---|
221 | (m) memory=$OPTARG;; |
---|
222 | (n) job_name=$OPTARG;; |
---|
223 | (N) node_usage=$OPTARG;; |
---|
224 | (O) threads_per_task=$OPTARG;; |
---|
225 | (q) no_default_queue=$OPTARG;; |
---|
226 | (t) cputime=$OPTARG;; |
---|
227 | (T) tasks_per_node=$OPTARG;; |
---|
228 | (u) remote_user=$OPTARG;; |
---|
229 | (v) verify=false;; |
---|
230 | (X) numprocs=$OPTARG;; |
---|
231 | (\?) printf "\n +++ Option $OPTARG unknown \n"; |
---|
232 | locat=option; exit;; |
---|
233 | esac |
---|
234 | done |
---|
235 | |
---|
236 | |
---|
237 | # JOBDATEINAMEN ALS NAECHSTES ARGUMENT HOLEN |
---|
238 | shift OPTIND-1; file_to_send=$1 |
---|
239 | |
---|
240 | |
---|
241 | # KURZE AUFRUFBESCHREIBUNG WIRD HIER AUSGEGEBEN |
---|
242 | if [ "$1" = "?" ] |
---|
243 | then |
---|
244 | (printf "\n *** subjob can be called as follows:\n" |
---|
245 | printf "\n subjob -c.. -d -D -h.. -m.. -q.. -t.. -u.. -v <jobfile>\n" |
---|
246 | printf "\n Description of available options:\n" |
---|
247 | printf "\n Option Description Default-Value" |
---|
248 | printf "\n -c job-input- and output-catalog ~/job_queue" |
---|
249 | printf "\n -d no job-protocol will be created ---" |
---|
250 | printf "\n -D only the job-file will be created ---" |
---|
251 | printf "\n -h execution host, available hosts: $remote_host" |
---|
252 | printf "\n ibm, ibmb, ibmh, ibms, ibmy, lcmuk," |
---|
253 | printf "\n lctit, nech, necriam, unics" |
---|
254 | printf "\n -m memory demand per process in MByte ---" |
---|
255 | printf "\n -n jobname <jobdatei>" |
---|
256 | printf "\n -O threads per task (for OpenMP usage) 1" |
---|
257 | printf "\n -q job-queue to be used default" |
---|
258 | printf "\n -t allowed cpu-time in seconds ---" |
---|
259 | printf "\n -T tasks per node (on parallel hosts) ---" |
---|
260 | printf "\n -u username on execution host from .netrc" |
---|
261 | printf "\n -v no prompt for confirmation ---" |
---|
262 | printf "\n -X # of processors (on parallel hosts) 1" |
---|
263 | printf "\n " |
---|
264 | printf "\n The only possible positional parameter is <jobfile>:" |
---|
265 | printf "\n The complete NQS-job must be provided here." |
---|
266 | printf "\n <jobfile>=? creates this outline\n\n") | more |
---|
267 | exit |
---|
268 | fi |
---|
269 | |
---|
270 | |
---|
271 | |
---|
272 | # PRUEFEN, OB JOBDATEI ANGEGEBEN WURDE UND OB SIE AUCH EXISTIERT |
---|
273 | if [[ "$file_to_send" = "" ]] |
---|
274 | then |
---|
275 | printf "\n +++ job-file missing" |
---|
276 | locat=parameter; exit |
---|
277 | else |
---|
278 | if [[ -f $file_to_send ]] |
---|
279 | then |
---|
280 | true |
---|
281 | else |
---|
282 | printf "\n +++ job-file: " |
---|
283 | printf "\n $file_to_send" |
---|
284 | printf "\n does not exist" |
---|
285 | locat=parameter; exit |
---|
286 | fi |
---|
287 | fi |
---|
288 | |
---|
289 | |
---|
290 | |
---|
291 | # FALLS KEIN JOBNAME ANGEGEBEN WURDE, WIRD JOBNAME = JOBDATEINAME |
---|
292 | # GESETZT. VORAUSSETZUNG: JOBDATEINAME BEINHALTET KEINE PFADE |
---|
293 | if [[ $job_name = none ]] |
---|
294 | then |
---|
295 | job_name=$file_to_send |
---|
296 | fi |
---|
297 | if [[ $(echo $job_name | grep -c "/") != 0 ]] |
---|
298 | then |
---|
299 | printf "\n +++ job-file name: " |
---|
300 | printf "\n $job_name" |
---|
301 | printf "\n must not contain \"/\"-characters" |
---|
302 | locat=parameter; exit |
---|
303 | fi |
---|
304 | |
---|
305 | |
---|
306 | |
---|
307 | |
---|
308 | # HOSTSPEZIFISCHE GROESSEN VEREINBAREN BZW. ABBRUCH BEI UNZULAESSIGEM HOST |
---|
309 | # ODER WENN HOST NICHT ANGEGEBEN WURDE |
---|
310 | if [[ $remote_host = none ]] |
---|
311 | then |
---|
312 | printf "\n +++ host missing" |
---|
313 | locat=option; exit |
---|
314 | else |
---|
315 | case $remote_host in |
---|
316 | (ibm) queue=p690_standard; remote_addres=134.76.99.81; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
317 | (ibmb) queue=cpar; remote_addres=130.73.230.10; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
318 | (ibmh) queue=cpar; remote_addres=130.75.4.10; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
319 | (ibms) queue=p_normal; remote_addres=150.183.5.101; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
320 | (ibmy) queue=parallel; remote_addres=165.132.26.58; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
321 | (lcfimm) remote_addres=172.20.4.2; submcom=/opt/torque/bin/qsub;; |
---|
322 | (lcsgib) queue=smallq; remote_addres=130.73.232.103; submcom=/opt/moab/bin/msub;; |
---|
323 | (lcsgih) queue=smallq; remote_addres=130.75.4.103; submcom=/opt/moab/bin/msub;; |
---|
324 | (lctit) queue=lctit; remote_addres=172.17.75.161; submcom=/n1ge/TITECH_GRID/tools/bin/n1ge;; |
---|
325 | (lcxt4) remote_addres=129.177.20.113; submcom=/opt/torque/2.3.0/bin/qsub;; |
---|
326 | (nech) qsubmem=memsz_job; qsubtime=cputim_job; remote_addres=136.172.44.147; submcom="/usr/local/bin/qsub";; |
---|
327 | (necriam) qsubmem=memsz_job; qsubtime=cputim_job; remote_addres=172.16.1.131; submcom="/usr/bin/nqsII/qsub";; |
---|
328 | (vpp) qsubmem=m; qsubtime=t; queue=vpp; remote_addres=130.75.4.130;; |
---|
329 | (unics) qsubmem=d; qsubtime=t; queue=unics; remote_addres=130.75.6.1;; |
---|
330 | (*) printf "\n +++ hostname \"$remote_host\" not allowed"; |
---|
331 | locat=parameter; exit;; |
---|
332 | esac |
---|
333 | fi |
---|
334 | |
---|
335 | |
---|
336 | # EVTL. PRUEFEN, OB ANGEGEBENE QUEUE ZULAESSIG IST |
---|
337 | if [[ $no_default_queue != none ]] |
---|
338 | then |
---|
339 | error=false |
---|
340 | ndq=$no_default_queue |
---|
341 | case $remote_host in |
---|
342 | (ibm) case $ndq in |
---|
343 | (p690_express|p690_standard|p690_long) error=false;; |
---|
344 | (*) error=true;; |
---|
345 | esac;; |
---|
346 | (ibmb) case $ndq in |
---|
347 | (cdata|cdev|cexp|c1|cshare|csolo|cspec) error=false;; |
---|
348 | (*) error=true;; |
---|
349 | esac;; |
---|
350 | (ibmh) case $ndq in |
---|
351 | (cdata|cdev|cexp|channi|cxxl|c1|cshare|csolo|csoloh3h|csoloh6h|csoloh12h|csoloh1d|csoloh2d|cspec) error=false;; |
---|
352 | (*) error=true;; |
---|
353 | esac;; |
---|
354 | (ibms) case $ndq in |
---|
355 | (express|normal|p_express|p_normal|p_normal_1.3|p_normal_1.7|grand) error=false;; |
---|
356 | (*) error=true;; |
---|
357 | esac;; |
---|
358 | (ibmy) case $ndq in |
---|
359 | (parallel) error=false;; |
---|
360 | (*) error=true;; |
---|
361 | esac;; |
---|
362 | (lcsgib|lcsgih) case $ndq in |
---|
363 | (testq|smallq|bigq) error=false;; |
---|
364 | (*) error=true;; |
---|
365 | esac;; |
---|
366 | (lctit) case $ndq in |
---|
367 | (novice|sla1|sla2|sla3|RAM64GB|RAM128GB) error=false;; |
---|
368 | (*) error=true;; |
---|
369 | esac;; |
---|
370 | (t3eb) case $ndq in |
---|
371 | (berte|p50|p100|p392|forfree|p25himem) error=false;; |
---|
372 | (*) error=true;; |
---|
373 | esac;; |
---|
374 | (necriam) case $ndq in |
---|
375 | (SP|SS|P6) error=false;; |
---|
376 | (*) error=true;; |
---|
377 | esac;; |
---|
378 | (t3eh) case $ndq in |
---|
379 | (para_t3e|em|k|l|lm|comp_t3e|c|p|ht) error=false;; |
---|
380 | (*) error=true;; |
---|
381 | esac;; |
---|
382 | (t3ej2|t3ej5) case $ndq in |
---|
383 | (low|normal|high) error=false;; |
---|
384 | (*) error=true;; |
---|
385 | esac;; |
---|
386 | (t3es) case $ndq in |
---|
387 | (batch|serial-4|pe4|p48|pe16|pe32|pe64|pe128) error=false;; |
---|
388 | (*) error=true;; |
---|
389 | esac;; |
---|
390 | (unics) case $ndq in |
---|
391 | (unics|ht) error=false;; |
---|
392 | (*) error=true;; |
---|
393 | esac;; |
---|
394 | esac |
---|
395 | if [[ $error = true ]] |
---|
396 | then |
---|
397 | printf "\n +++ queue \"$no_default_queue\" on host \"$remote_host\" not allowed" |
---|
398 | locat=parameter; exit |
---|
399 | else |
---|
400 | queue=$no_default_queue |
---|
401 | fi |
---|
402 | fi |
---|
403 | |
---|
404 | |
---|
405 | |
---|
406 | # KNOTENNUTZUNG IN ENTWICKLERQUEUE MUSS SHARED SEIN |
---|
407 | if [[ $node_usage != shared && $queue = cdev ]] |
---|
408 | then |
---|
409 | node_usage=shared |
---|
410 | fi |
---|
411 | |
---|
412 | |
---|
413 | |
---|
414 | # PRUEFEN DER CPU-ZEIT, ZEIT NACH STUNDEN, MINUTEN UND SEKUNDEN |
---|
415 | # AUFTEILEN |
---|
416 | done=false |
---|
417 | while [[ $done = false ]] |
---|
418 | do |
---|
419 | if (( $cputime <= 0 )) |
---|
420 | then |
---|
421 | printf "\n +++ wrong cpu-time or cpu-time missing" |
---|
422 | printf "\n >>> Please type cpu-time in seconds as INTEGER:" |
---|
423 | printf "\n >>> " |
---|
424 | read cputime 1>/dev/null 2>&1 |
---|
425 | else |
---|
426 | done=true |
---|
427 | fi |
---|
428 | done |
---|
429 | if [[ $remote_host = nech ]] |
---|
430 | then |
---|
431 | if (( tasks_per_node != 0 )) |
---|
432 | then |
---|
433 | (( cputime = cputime * tasks_per_node )) |
---|
434 | elif [[ $numprocs != 0 ]] |
---|
435 | then |
---|
436 | (( cputime = cputime * numprocs )) |
---|
437 | fi |
---|
438 | fi |
---|
439 | (( stunden = cputime / 3600 )) |
---|
440 | (( resttime = cputime - stunden * 3600 )) |
---|
441 | (( minuten = resttime / 60 )) |
---|
442 | (( sekunden = resttime - minuten * 60 )) |
---|
443 | timestring=${stunden}:${minuten}:${sekunden} |
---|
444 | |
---|
445 | |
---|
446 | |
---|
447 | # PRUEFEN DER KERNSPEICHERANFORDERUNG |
---|
448 | done=false |
---|
449 | while [[ $done = false ]] |
---|
450 | do |
---|
451 | if (( memory <= 0 )) |
---|
452 | then |
---|
453 | printf "\n +++ wrong memory demand or memory demand missing" |
---|
454 | printf "\n >>> Please type memory in MByte per process as INTEGER:" |
---|
455 | printf "\n >>> " |
---|
456 | read memory 1>/dev/null 2>&1 |
---|
457 | else |
---|
458 | done=true |
---|
459 | fi |
---|
460 | done |
---|
461 | |
---|
462 | if [[ $remote_host = nech || $remote_host = necriam ]] |
---|
463 | then |
---|
464 | if (( tasks_per_node != 0 )) |
---|
465 | then |
---|
466 | (( Memory = memory * tasks_per_node / 1000 )) |
---|
467 | elif [[ $numprocs != 0 ]] |
---|
468 | then |
---|
469 | (( Memory = memory * numprocs / 1000 )) |
---|
470 | else |
---|
471 | (( Memory = memory / 1000 )) |
---|
472 | fi |
---|
473 | fi |
---|
474 | |
---|
475 | |
---|
476 | # SPEICHERBERECHNUNG BEI OPENMP-NUTZUNG |
---|
477 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
478 | then |
---|
479 | (( memory = memory * threads_per_task )) |
---|
480 | fi |
---|
481 | |
---|
482 | |
---|
483 | # BERECHNUNG DER ANZAHL DER ZU VERWENDENDEN KNOTEN |
---|
484 | if (( tasks_per_node != 0 )) |
---|
485 | then |
---|
486 | (( nodes = numprocs / ( tasks_per_node * threads_per_task ) )) |
---|
487 | fi |
---|
488 | |
---|
489 | |
---|
490 | |
---|
491 | # HEADER-AUSGABE |
---|
492 | if [[ $verify = true ]] |
---|
493 | then |
---|
494 | printf "\n\n" |
---|
495 | printf "#--------------------------------------------------------------# \n" |
---|
496 | spalte1=SUBJOB;spalte2=$(date) |
---|
497 | printf "| $spalte1$spalte2 | \n" |
---|
498 | printf "| | \n" |
---|
499 | printf "| values of parameters/options: | \n" |
---|
500 | spalte1=local_host$punkte; spalte2=$punkte$local_host |
---|
501 | printf "| $spalte1$spalte2 | \n" |
---|
502 | spalte1=remote_host$punkte; spalte2=$punkte$remote_host |
---|
503 | printf "| $spalte1$spalte2 | \n" |
---|
504 | spalte1=queue$punkte; spalte2=$punkte$queue |
---|
505 | printf "| $spalte1$spalte2 | \n" |
---|
506 | spalte1=memory$punkte; spalte2="$punkte$memory mb" |
---|
507 | printf "| $spalte1$spalte2 | \n" |
---|
508 | spalte1=cputime$punkte; spalte2="$punkte$cputime sec" |
---|
509 | printf "| $spalte1$spalte2 | \n" |
---|
510 | spalte1=job_name$punkte; spalte2="$punkte$job_name" |
---|
511 | printf "| $spalte1$spalte2 | \n" |
---|
512 | printf "#--------------------------------------------------------------# \n\n" |
---|
513 | |
---|
514 | |
---|
515 | # KONTROLLABFRAGE, OB ALLES O.K. |
---|
516 | antwort="dummy" |
---|
517 | while [[ $antwort != y && $antwort != Y && $antwort != n && $antwort != N ]] |
---|
518 | do |
---|
519 | read antwort?" >>> continue (y/n) ? " |
---|
520 | done |
---|
521 | if [[ $antwort = n || $antwort = N ]] |
---|
522 | then |
---|
523 | locat=verify; exit |
---|
524 | fi |
---|
525 | printf "\n" |
---|
526 | fi |
---|
527 | |
---|
528 | |
---|
529 | |
---|
530 | # ZUFALLSKENNUNG GENERIEREN UND JOBNAMEN AUF ZIELRECHNER BESTIMMEN |
---|
531 | kennung=$RANDOM |
---|
532 | job_on_remhost=${job_name}_${kennung}_$local_host |
---|
533 | job_to_send=job_to_send_$kennung |
---|
534 | if [[ $delete_dayfile = false ]] |
---|
535 | then |
---|
536 | remote_dayfile=${local_host}_${job_name}_result_$kennung |
---|
537 | local_dayfile=${remote_host}_${job_name} |
---|
538 | else |
---|
539 | remote_dayfile=/dev/null |
---|
540 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
541 | then |
---|
542 | notification='# @ notification = never' |
---|
543 | fi |
---|
544 | fi |
---|
545 | |
---|
546 | |
---|
547 | |
---|
548 | # QSUB- ODER LL-KOMMANDOS BZW. SKRIPTE GENERIEREN |
---|
549 | if [[ $(echo $remote_host | cut -c1-3) = ibm && $numprocs != 0 ]] |
---|
550 | then |
---|
551 | |
---|
552 | if [[ $remote_host = ibmy ]] |
---|
553 | then |
---|
554 | consumable_memory="" |
---|
555 | else |
---|
556 | consumable_memory="ConsumableMemory($memory mb)" |
---|
557 | fi |
---|
558 | if [[ $queue = cdev ]] |
---|
559 | then |
---|
560 | data_limit="# @ data_limit = 1.76gb" |
---|
561 | network_to_use="# @ network.mpi = sn_all,shared,ip" |
---|
562 | else |
---|
563 | if [[ $remote_host = ibms ]] |
---|
564 | then |
---|
565 | network_to_use="# @ network.mpi = csss,shared,us" |
---|
566 | elif [[ $remote_host = ibmy ]] |
---|
567 | then |
---|
568 | network_to_use="" |
---|
569 | else |
---|
570 | network_to_use="# @ network.mpi = sn_all,shared,us" |
---|
571 | data_limit="# @ data_limit = 1.76gb" |
---|
572 | fi |
---|
573 | fi |
---|
574 | |
---|
575 | cat > $job_to_send << %%END%% |
---|
576 | #!/bin/ksh |
---|
577 | |
---|
578 | # @ job_type = parallel |
---|
579 | # @ job_name = palm |
---|
580 | # @ wall_clock_limit = ${timestring},$timestring |
---|
581 | # @ resources = ConsumableCpus($threads_per_task) $consumable_memory |
---|
582 | # @ output = $remote_dayfile |
---|
583 | # @ error = $remote_dayfile |
---|
584 | # @ image_size = 50 |
---|
585 | # @ class = $queue |
---|
586 | # @ environment = OMP_NUM_THREADS=$threads_per_task; MP_SHARED_MEMORY=yes |
---|
587 | $network_to_use |
---|
588 | $data_limit |
---|
589 | $notification |
---|
590 | |
---|
591 | %%END%% |
---|
592 | |
---|
593 | if (( nodes > 0 )) |
---|
594 | then |
---|
595 | |
---|
596 | cat >> $job_to_send << %%END%% |
---|
597 | # @ node = $nodes |
---|
598 | # @ tasks_per_node = $tasks_per_node |
---|
599 | # @ node_usage = $node_usage |
---|
600 | # @ queue |
---|
601 | |
---|
602 | %%END%% |
---|
603 | |
---|
604 | else |
---|
605 | |
---|
606 | if [[ $remote_host != ibmy ]] |
---|
607 | then |
---|
608 | |
---|
609 | cat >> $job_to_send << %%END%% |
---|
610 | # @ blocking = unlimited |
---|
611 | # @ total_tasks = $numprocs |
---|
612 | # @ node_usage = $node_usage |
---|
613 | # @ queue |
---|
614 | |
---|
615 | %%END%% |
---|
616 | |
---|
617 | else |
---|
618 | |
---|
619 | cat >> $job_to_send << %%END%% |
---|
620 | # @ node = 1 |
---|
621 | # @ total_tasks = $numprocs |
---|
622 | # @ queue |
---|
623 | |
---|
624 | %%END%% |
---|
625 | |
---|
626 | fi |
---|
627 | |
---|
628 | fi |
---|
629 | |
---|
630 | elif [[ $(echo $remote_host | cut -c1-3) = ibm && $numprocs = 0 ]] |
---|
631 | then |
---|
632 | |
---|
633 | cat > $job_to_send << %%END%% |
---|
634 | #!/bin/ksh |
---|
635 | |
---|
636 | # @ job_type = serial |
---|
637 | # @ node_usage = $node_usage |
---|
638 | # @ job_name = palm |
---|
639 | # @ wall_clock_limit = ${timestring},$timestring |
---|
640 | # @ resources = ConsumableCpus(1) ConsumableMemory(1 gb) |
---|
641 | # @ output = $remote_dayfile |
---|
642 | # @ error = $remote_dayfile |
---|
643 | # @ class = $queue |
---|
644 | $notification |
---|
645 | |
---|
646 | # @ queue |
---|
647 | |
---|
648 | %%END%% |
---|
649 | |
---|
650 | elif [[ $remote_host = lcfimm ]] |
---|
651 | then |
---|
652 | |
---|
653 | if [[ $numprocs != 0 ]] |
---|
654 | then |
---|
655 | cat > $job_to_send << %%END%% |
---|
656 | #!/bin/ksh |
---|
657 | #PBS -N $job_name |
---|
658 | #PBS -A geofysisk |
---|
659 | #PBS -l walltime=$timestring |
---|
660 | #PBS -l nodes=${nodes}:ppn=$tasks_per_node |
---|
661 | #PBS -l pmem=${memory}mb |
---|
662 | #PBS -m abe |
---|
663 | #PBS -M bjorn.maronga@student.uib.no |
---|
664 | #PBS -o $remote_dayfile |
---|
665 | #PBS -j oe |
---|
666 | mpd & |
---|
667 | |
---|
668 | %%END%% |
---|
669 | |
---|
670 | else |
---|
671 | cat > $job_to_send << %%END%% |
---|
672 | #!/bin/ksh |
---|
673 | #PBS -N $job_name |
---|
674 | #PBS -A geofysisk |
---|
675 | #PBS -l walltime=$timestring |
---|
676 | #PBS -l ncpus=1 |
---|
677 | #PBS -l pmem=${memory}mb |
---|
678 | #PBS -m abe |
---|
679 | #PBS -M bjorn.maronga@student.uib.no |
---|
680 | #PBS -o $remote_dayfile |
---|
681 | #PBS -j oe |
---|
682 | |
---|
683 | %%END%% |
---|
684 | |
---|
685 | fi |
---|
686 | |
---|
687 | elif [[ $remote_host = lcsgih || $remote_host = lcsgib ]] |
---|
688 | then |
---|
689 | |
---|
690 | if [[ $queue = testq ]] |
---|
691 | then |
---|
692 | queue_directive="#PBS -q $queue" |
---|
693 | else |
---|
694 | queue_directive="" |
---|
695 | fi |
---|
696 | |
---|
697 | if [[ $numprocs != 0 ]] |
---|
698 | then |
---|
699 | cat > $job_to_send << %%END%% |
---|
700 | #!/bin/bash |
---|
701 | #PBS -N $job_name |
---|
702 | #PBS -l walltime=$timestring |
---|
703 | #PBS -l nodes=$nodes:ppn=${tasks_per_node} |
---|
704 | #PBS -l feature=$sgi_feature |
---|
705 | #PBS -l naccesspolicy=$node_usage |
---|
706 | #PBS -o $remote_dayfile |
---|
707 | #PBS -j oe |
---|
708 | $queue_directive |
---|
709 | |
---|
710 | . /usr/share/modules/init/bash |
---|
711 | module load $mpilib |
---|
712 | # module load mvapich2/1.2rc1-intel |
---|
713 | # module load mvapich2 |
---|
714 | module load netcdf |
---|
715 | export LD_LIBRARY_PATH=/sw/intel/cce/10.1.015/lib:/sw/intel/fce/10.1.015/lib:/sw/dataformats/netcdf/3.6.2/lib:\$LD_LIBRARY_PATH |
---|
716 | echo ld_library_path=\$LD_LIBRARY_PATH |
---|
717 | |
---|
718 | %%END%% |
---|
719 | |
---|
720 | else |
---|
721 | cat > $job_to_send << %%END%% |
---|
722 | #PBS -S /bin/bash |
---|
723 | #PBS -N $job_name |
---|
724 | #PBS -l walltime=$timestring |
---|
725 | #PBS -l ncpus=1 |
---|
726 | #PBS -o $remote_dayfile |
---|
727 | #PBS -e $remote_dayfile |
---|
728 | |
---|
729 | %%END%% |
---|
730 | |
---|
731 | fi |
---|
732 | |
---|
733 | elif [[ $remote_host = lcxt4 ]] |
---|
734 | then |
---|
735 | |
---|
736 | if [[ $numprocs != 0 ]] |
---|
737 | then |
---|
738 | cat > $job_to_send << %%END%% |
---|
739 | #!/bin/ksh |
---|
740 | #PBS -S /bin/ksh |
---|
741 | #PBS -N $job_name |
---|
742 | #PBS -A geofysisk |
---|
743 | #PBS -j oe |
---|
744 | #PBS -l walltime=$timestring |
---|
745 | #PBS -l mppwidth=${numprocs} |
---|
746 | #PBS -l mppnppn=${tasks_per_node} |
---|
747 | #PBS -m abe |
---|
748 | #PBS -M bjorn.maronga@student.uib.no |
---|
749 | #PBS -o $remote_dayfile |
---|
750 | |
---|
751 | %%END%% |
---|
752 | |
---|
753 | else |
---|
754 | cat > $job_to_send << %%END%% |
---|
755 | #!/bin/ksh |
---|
756 | #PBS -S /bin/ksh |
---|
757 | #PBS -N $job_name |
---|
758 | #PBS -A geofysisk |
---|
759 | #PBS -j oe |
---|
760 | #PBS -l walltime=$timestring |
---|
761 | #PBS -l ncpus=1 |
---|
762 | #PBS -l pmem=${memory}mb |
---|
763 | #PBS -m abe |
---|
764 | #PBS -M bjorn.maronga@student.uib.no |
---|
765 | #PBS -o $remote_dayfile |
---|
766 | |
---|
767 | %%END%% |
---|
768 | |
---|
769 | fi |
---|
770 | |
---|
771 | elif [[ $remote_host = nech ]] |
---|
772 | then |
---|
773 | |
---|
774 | if (( nodes > 1 )) |
---|
775 | then |
---|
776 | cat > $job_to_send << %%END%% |
---|
777 | #!/bin/ksh |
---|
778 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
779 | #PBS -l ${qsubmem}=${Memory}gb |
---|
780 | #PBS -b $nodes |
---|
781 | #PBS -o $remote_dayfile |
---|
782 | #PBS -N palm |
---|
783 | #PBS -j o |
---|
784 | #PBS -T mpisx |
---|
785 | |
---|
786 | %%END%% |
---|
787 | |
---|
788 | elif [[ $numprocs != 0 ]] |
---|
789 | then |
---|
790 | cat > $job_to_send << %%END%% |
---|
791 | #!/bin/ksh |
---|
792 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
793 | #PBS -l ${qsubmem}=${Memory}gb |
---|
794 | #PBS -o $remote_dayfile |
---|
795 | #PBS -N palm |
---|
796 | #PBS -j o |
---|
797 | |
---|
798 | %%END%% |
---|
799 | |
---|
800 | else |
---|
801 | cat > $job_to_send << %%END%% |
---|
802 | #!/bin/ksh |
---|
803 | #PBS -l ${qsubmem}=${Memory}gb,${qsubtime}=$cputime |
---|
804 | #PBS -o $remote_dayfile |
---|
805 | #PBS -j o |
---|
806 | |
---|
807 | %%END%% |
---|
808 | |
---|
809 | fi |
---|
810 | |
---|
811 | elif [[ $remote_host = necriam ]] |
---|
812 | then |
---|
813 | |
---|
814 | if (( nodes > 1 )) |
---|
815 | then |
---|
816 | cat > $job_to_send << %%END%% |
---|
817 | #!/bin/ksh |
---|
818 | #PBS -b $nodes |
---|
819 | #PBS -o $remote_dayfile |
---|
820 | #PBS -N $job_name |
---|
821 | #PBS -j o |
---|
822 | #PBS -v MPIPROGINV=YES |
---|
823 | |
---|
824 | %%END%% |
---|
825 | |
---|
826 | elif [[ $numprocs != 0 ]] |
---|
827 | then |
---|
828 | cat > $job_to_send << %%END%% |
---|
829 | #!/bin/ksh |
---|
830 | #PBS -q ${queue} |
---|
831 | #PBS -o $remote_dayfile |
---|
832 | #PBS -N $job_name |
---|
833 | #PBS -j o |
---|
834 | #PBS -v MPIPROGINV=YES |
---|
835 | |
---|
836 | %%END%% |
---|
837 | |
---|
838 | else |
---|
839 | cat > $job_to_send << %%END%% |
---|
840 | #!/bin/ksh |
---|
841 | #PBS -o $remote_dayfile |
---|
842 | #PBS -j o |
---|
843 | |
---|
844 | %%END%% |
---|
845 | |
---|
846 | fi |
---|
847 | |
---|
848 | elif [[ $remote_host = lctit ]] |
---|
849 | then |
---|
850 | cat > $job_to_send << %%END%% |
---|
851 | #!/bin/bash |
---|
852 | #$ -S /bin/bash |
---|
853 | cd $job_catalog |
---|
854 | export PATH=$PALM_BIN:\$PATH |
---|
855 | echo \$PATH |
---|
856 | |
---|
857 | %%END%% |
---|
858 | |
---|
859 | # OPTIONEN FUER SUBMIT-KOMMANDO ZUSAMMENSTELLEN |
---|
860 | # submcom="$submcom -N $job_name -sgeout $remote_dayfile -q default" |
---|
861 | submcom="$submcom -g $group_number -N $job_name -rt 4320 -sgeout $remote_dayfile -q $node_usage " |
---|
862 | |
---|
863 | else |
---|
864 | |
---|
865 | cat > $job_to_send << %%END%% |
---|
866 | # @\$-q ${queue} |
---|
867 | # @\$-l${qsubtime} $timestring |
---|
868 | # @\$-l${qsubmem} ${memory}mb |
---|
869 | # @\$-o $remote_dayfile |
---|
870 | # @\$-eo |
---|
871 | |
---|
872 | %%END%% |
---|
873 | |
---|
874 | fi |
---|
875 | |
---|
876 | |
---|
877 | # BEI RECHNUNG AUF REMOTE-MASCHINEN RUECKTRANSFER DES DAYFILES PER TRAP |
---|
878 | # BEI EXIT VERANLASSEN |
---|
879 | # VEKTORRECHNER MUSS EIGENEN JOB STARTEN, DA DORT NOHUP NICHT FUNKTIONIERT |
---|
880 | # AUF IBM IN SEOUL IST RUECKTRANSFER ZUR ZEIT GENERELL NICHT MOEGLICH |
---|
881 | if [[ $delete_dayfile = false && $remote_host != $local_host ]] |
---|
882 | then |
---|
883 | echo "set +vx" >> $job_to_send |
---|
884 | echo "trap '" >> $job_to_send |
---|
885 | echo "set +vx" >> $job_to_send |
---|
886 | if [[ $(echo $remote_host | cut -c1-3) = ibm || $(echo $remote_host | cut -c1-5) = lcsgi || $(echo $remote_host | cut -c1-3) = nec || $remote_host = lctit ]] |
---|
887 | then |
---|
888 | if [[ $remote_host = ibmb || $remote_host = ibmh ]] |
---|
889 | then |
---|
890 | return_queue=c1 |
---|
891 | elif [[ $remote_host = ibms ]] |
---|
892 | then |
---|
893 | return_queue=p_normal |
---|
894 | elif [[ $remote_host = ibmy ]] |
---|
895 | then |
---|
896 | return_queue=serial |
---|
897 | elif [[ $remote_host = lctit ]] |
---|
898 | then |
---|
899 | return_queue=sla3 |
---|
900 | elif [[ $remote_host = necriam ]] |
---|
901 | then |
---|
902 | return_queue=SP |
---|
903 | else |
---|
904 | return_queue=unknown |
---|
905 | fi |
---|
906 | |
---|
907 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
908 | then |
---|
909 | |
---|
910 | echo "echo \"#!/bin/ksh\" >> scpjob.$kennung" >> $job_to_send |
---|
911 | echo "echo \"# @ job_type = serial\" >> scpjob.$kennung" >> $job_to_send |
---|
912 | echo "echo \"# @ job_name = transfer\" >> scpjob.$kennung" >> $job_to_send |
---|
913 | echo "echo \"# @ resources = ConsumableCpus(1) ConsumableMemory(1 gb)\" >> scpjob.$kennung" >> $job_to_send |
---|
914 | echo "echo \"# @ wall_clock_limit = 00:10:00,00:10:00\" >> scpjob.$kennung " >> $job_to_send |
---|
915 | echo "echo \"# @ output = job_queue/last_job_transfer_protocol\" >> scpjob.$kennung" >> $job_to_send |
---|
916 | echo "echo \"# @ error = job_queue/last_job_transfer_protocol\" >> scpjob.$kennung" >> $job_to_send |
---|
917 | echo "echo \"# @ class = $return_queue\" >> scpjob.$kennung" >> $job_to_send |
---|
918 | echo "echo \"# @ image_size = 10\" >> scpjob.$kennung" >> $job_to_send |
---|
919 | echo "echo \"# @ notification = never\" >> scpjob.$kennung" >> $job_to_send |
---|
920 | |
---|
921 | echo "echo \"# @ queue\" >> scpjob.$kennung" >> $job_to_send |
---|
922 | echo "echo \" \" >> scpjob.$kennung" >> $job_to_send |
---|
923 | |
---|
924 | echo "echo \"set -x\" >> scpjob.$kennung" >> $job_to_send |
---|
925 | echo "echo \"batch_scp -d -w 10 -u $local_user $local_addres ${job_catalog}/$remote_dayfile \\\"$job_catalog\\\" $local_dayfile\" >> scpjob.$kennung" >> $job_to_send |
---|
926 | echo "echo \"exit\" >> scpjob.$kennung" >> $job_to_send |
---|
927 | |
---|
928 | elif [[ $remote_host = nech ]] |
---|
929 | then |
---|
930 | echo "cd /pf/b/${remote_user}/job_queue" >> $job_to_send |
---|
931 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
932 | echo "#PBS -l ${qsubmem}=1GB,${qsubtime}=100" >> $job_to_send |
---|
933 | echo "#PBS -o last_job_transfer_protocol" >> $job_to_send |
---|
934 | echo "#PBS -j o" >> $job_to_send |
---|
935 | echo " " >> $job_to_send |
---|
936 | echo "set -x" >> $job_to_send |
---|
937 | echo "cd /pf/b/${remote_user}/job_queue" >> $job_to_send |
---|
938 | echo "batch_scp -d -w 10 -u $local_user $local_addres $remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
939 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
940 | echo "%%END%%" >> $job_to_send |
---|
941 | |
---|
942 | elif [[ $remote_host = necriam ]] |
---|
943 | then |
---|
944 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
945 | echo "#PBS -q $return_queue" >> $job_to_send |
---|
946 | echo "#PBS -o last_job_transfer_protocol" >> $job_to_send |
---|
947 | echo "#PBS -j o" >> $job_to_send |
---|
948 | echo " " >> $job_to_send |
---|
949 | echo "set -x" >> $job_to_send |
---|
950 | echo "batch_scp -d -w 10 -u $local_user $local_addres $remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
951 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
952 | echo "%%END%%" >> $job_to_send |
---|
953 | |
---|
954 | elif [[ $(echo $remote_host | cut -c1-5) = lcsgi ]] |
---|
955 | then |
---|
956 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
957 | echo "#!/bin/bash" >> $job_to_send |
---|
958 | echo "#PBS -N job_protocol_transfer" >> $job_to_send |
---|
959 | echo "#PBS -l walltime=00:02:00" >> $job_to_send |
---|
960 | echo "#PBS -l nodes=1:ppn=1" >> $job_to_send |
---|
961 | echo "#PBS -l feature=xe" >> $job_to_send |
---|
962 | echo "#PBS -o \$HOME/job_queue/last_job_transfer_protocol" >> $job_to_send |
---|
963 | echo "#PBS -j oe" >> $job_to_send |
---|
964 | echo " " >> $job_to_send |
---|
965 | echo ". /usr/share/modules/init/bash" >> $job_to_send |
---|
966 | echo "set -x" >> $job_to_send |
---|
967 | echo "batch_scp -d -w 10 -u $local_user $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
968 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
969 | echo "%%END%%" >> $job_to_send |
---|
970 | |
---|
971 | elif [[ $remote_host = lctit ]] |
---|
972 | then |
---|
973 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
974 | echo "set -x" >> $job_to_send |
---|
975 | echo "PATH=\$PATH:$job_catalog/../pub" >> $job_to_send |
---|
976 | echo "cd $job_catalog" >> $job_to_send |
---|
977 | echo "batch_scp -d -w 10 -u $local_user $local_addres $remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
978 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
979 | echo "%%END%%" >> $job_to_send |
---|
980 | |
---|
981 | else |
---|
982 | |
---|
983 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
984 | echo "# @\\\$-q $return_queue" >> $job_to_send |
---|
985 | echo "# @\\\$-l${qsubtime} 10" >> $job_to_send |
---|
986 | echo "# @\\\$-l${qsubmem} 10mb" >> $job_to_send |
---|
987 | if [[ $remote_host = t3ej2 || $remote_host = t3ej5 || $remote_host = t3es ]] |
---|
988 | then |
---|
989 | echo "# @\$-l mpp_p=0" >> $job_to_send |
---|
990 | fi |
---|
991 | echo '# @\$-lF 10mb' >> $job_to_send |
---|
992 | # echo '# @\$-o /dev/null' >> $job_to_send |
---|
993 | echo '# @\$-o job_queue/last_job_transfer_protocol' >> $job_to_send |
---|
994 | echo '# @\\\$-eo' >> $job_to_send |
---|
995 | echo " " >> $job_to_send |
---|
996 | if [[ $remote_host = t3ej2 || $remote_host = t3ej5 ]] |
---|
997 | then |
---|
998 | echo "set +vx" >> $job_to_send |
---|
999 | echo ". .profile" >> $job_to_send |
---|
1000 | fi |
---|
1001 | echo "set -x" >> $job_to_send |
---|
1002 | echo "batch_scp -d -w 10 -u $local_user $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile > /dev/null" >> $job_to_send |
---|
1003 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
1004 | echo "%%END%%" >> $job_to_send |
---|
1005 | fi |
---|
1006 | |
---|
1007 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
1008 | then |
---|
1009 | echo "llsubmit scpjob.$kennung" >> $job_to_send |
---|
1010 | elif [[ $(echo $remote_host | cut -c1-5) = lcsgi ]] |
---|
1011 | then |
---|
1012 | echo "chmod u+x scpjob.$kennung" >> $job_to_send |
---|
1013 | echo "msub scpjob.$kennung" >> $job_to_send |
---|
1014 | elif [[ $remote_host = lctit ]] |
---|
1015 | then |
---|
1016 | echo "chmod u+x scpjob.$kennung" >> $job_to_send |
---|
1017 | echo "rm -rf ${job_catalog}/last_job_transfer_protocol" >> $job_to_send |
---|
1018 | echo "n1ge -N jobtransfer -q $return_queue -sgeout ${job_catalog}/last_job_transfer_protocol scpjob.$kennung" >> $job_to_send |
---|
1019 | echo "sleep 10" >> $job_to_send |
---|
1020 | elif [[ $remote_host = t3eb || $remote_host = t3eh || $remote_host = t3ej2 || $remote_host = t3ej5 ]] |
---|
1021 | then |
---|
1022 | echo "qsub -J n scpjob.$kennung" >> $job_to_send |
---|
1023 | elif [[ $remote_host = t3es ]] |
---|
1024 | then |
---|
1025 | echo "qsub -J n -s /bin/ksh scpjob.$kennung" >> $job_to_send |
---|
1026 | else |
---|
1027 | echo "qsub scpjob.$kennung" >> $job_to_send |
---|
1028 | fi |
---|
1029 | echo "rm scpjob.$kennung" >> $job_to_send |
---|
1030 | if [[ $remote_host = nech ]] |
---|
1031 | then |
---|
1032 | echo "cd -" >> $job_to_send |
---|
1033 | fi |
---|
1034 | else |
---|
1035 | # echo "ftpcopy -d $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
1036 | echo "nohup ftpcopy -d -w 15 $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile > /dev/null &" >> $job_to_send |
---|
1037 | fi |
---|
1038 | echo "set -x" >> $job_to_send |
---|
1039 | echo " ' exit" >> $job_to_send |
---|
1040 | echo "set -x" >> $job_to_send |
---|
1041 | fi |
---|
1042 | |
---|
1043 | |
---|
1044 | |
---|
1045 | # EIGENTLICHE JOB-DATEI AN QSUB-KOMMANDOS ANHAENGEN |
---|
1046 | cat $file_to_send >> $job_to_send |
---|
1047 | |
---|
1048 | if [[ $remote_host = ibm ]] |
---|
1049 | then |
---|
1050 | echo " " >> $job_to_send |
---|
1051 | echo "exit" >> $job_to_send |
---|
1052 | fi |
---|
1053 | if [[ $remote_host = lctit ]] |
---|
1054 | then |
---|
1055 | echo " " >> $job_to_send |
---|
1056 | echo "rm ~/job_queue/$job_on_remhost" >> $job_to_send |
---|
1057 | fi |
---|
1058 | |
---|
1059 | |
---|
1060 | |
---|
1061 | # USER-NAME AUF ZIELRECHNER AUS .NETRC-DATEI ERMITTELN |
---|
1062 | if [[ -z $remote_user ]] |
---|
1063 | then |
---|
1064 | if [[ $remote_host = t3eb || $remote_host = t3eh || $remote_host = t3ej2 || $remote_host = t3ej5 || $remote_host = t3es || $remote_host = vpp ]] |
---|
1065 | then |
---|
1066 | grep $remote_addres ~/.netrc | read dum dum dum remote_user dum dum |
---|
1067 | fi |
---|
1068 | fi |
---|
1069 | |
---|
1070 | |
---|
1071 | |
---|
1072 | # JOB AUF ZIELRECHNER TRANSFERIEREN BZW. INS JOBVERZEICHNIS KOPIEREN |
---|
1073 | if [[ $no_submit = false ]] |
---|
1074 | then |
---|
1075 | if [[ $remote_host != $local_host ]] |
---|
1076 | then |
---|
1077 | [[ $verify = true ]] && printf "\n >>> transfering job to \"$remote_host\"..." |
---|
1078 | if [[ $remote_host = ibms || $remote_host = ibmy ]] # ssh on ibms cannot handle "~/" |
---|
1079 | then |
---|
1080 | job_catalog_save=$job_catalog |
---|
1081 | job_catalog=job_queue |
---|
1082 | elif [[ $remote_host = nech ]] |
---|
1083 | then |
---|
1084 | job_catalog_save=$job_catalog |
---|
1085 | job_catalog=/hpf/b/${remote_user}/job_queue |
---|
1086 | fi |
---|
1087 | if [[ $local_host = decalpha ]] |
---|
1088 | then |
---|
1089 | # VERWENDUNG VON SCP AUF DECALPHA FRAGT FEHLERHAFTERWEISE |
---|
1090 | # PASSWORT AB |
---|
1091 | /bin/scp $job_to_send ${remote_user}@${remote_addres}:${job_catalog}/$job_on_remhost |
---|
1092 | elif [[ $remote_host = nech ]] |
---|
1093 | then |
---|
1094 | # DATEIEN KOENNEN NUR UEBER DEN ARCHIVE-SERVER DES DKRZ |
---|
1095 | # TRANSFERIERT WERDEN |
---|
1096 | scp $job_to_send ${remote_user}@136.172.44.205:${job_catalog}/$job_on_remhost |
---|
1097 | else |
---|
1098 | scp $job_to_send ${remote_user}@${remote_addres}:${job_catalog}/$job_on_remhost |
---|
1099 | fi |
---|
1100 | if [[ $? = 1 ]] |
---|
1101 | then |
---|
1102 | locat=scp; exit |
---|
1103 | fi |
---|
1104 | if [[ $remote_host = ibms ]] |
---|
1105 | then |
---|
1106 | job_catalog=$job_catalog_save |
---|
1107 | fi |
---|
1108 | [[ $verify = true ]] && printf "\n >>> finished\n" |
---|
1109 | else |
---|
1110 | eval job_catalog=$job_catalog |
---|
1111 | cp $job_to_send ${job_catalog}/$job_on_remhost |
---|
1112 | fi |
---|
1113 | |
---|
1114 | |
---|
1115 | |
---|
1116 | # NQS- BZW. LOADLEVELER-JOB STARTEN |
---|
1117 | if [[ $remote_host != $local_host ]] |
---|
1118 | then |
---|
1119 | [[ $verify = true ]] && printf "\n >>> submitting job using \"qsub\"...\n" |
---|
1120 | if [[ $remote_host != lctit ]] |
---|
1121 | then |
---|
1122 | ssh $remote_addres -l $remote_user "cd $job_catalog; $submcom $job_on_remhost; rm $job_on_remhost" |
---|
1123 | else |
---|
1124 | # TIT ERLAUBT NUR DIE AUSFï¿œHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
1125 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
1126 | # UEBERGANGSWEISE CHECK, OB N1GE ENVIRONMENT WIRKLICH VERFUEGBAR |
---|
1127 | print "cd $job_catalog; chmod u+x $job_on_remhost" | ssh $remote_addres -l $remote_user > /dev/null 2>&1 |
---|
1128 | echo "first try" > send_protocol |
---|
1129 | while [[ $(cat send_protocol | grep -c "Forwarding to N1GE") = 0 ]] |
---|
1130 | do |
---|
1131 | if [[ $(cat send_protocol | grep -c "first try") = 1 ]] |
---|
1132 | then |
---|
1133 | printf "\n trying to submit job to TIT cluster..." |
---|
1134 | else |
---|
1135 | printf "\n +++ failed ... trying to submit again ..." |
---|
1136 | fi |
---|
1137 | print "cd $job_catalog; $submcom $job_on_remhost" | ssh $remote_addres -l $remote_user > send_protocol 2>&1 |
---|
1138 | cat send_protocol |
---|
1139 | done |
---|
1140 | sleep 10 |
---|
1141 | print "cd $job_catalog; rm $job_on_remhost" | ssh $remote_addres -l $remote_user > /dev/null 2>&1 |
---|
1142 | echo "$submcom $job_on_remhost" |
---|
1143 | rm send_protocol |
---|
1144 | fi |
---|
1145 | |
---|
1146 | [[ $verify = true ]] && printf " >>> o.k.\n" |
---|
1147 | else |
---|
1148 | cd $job_catalog |
---|
1149 | if [[ $(echo $local_host | cut -c1-5) = lcsgi || $(echo $local_host | cut -c1-3) = ibm ]] |
---|
1150 | then |
---|
1151 | eval $submcom $job_on_remhost |
---|
1152 | elif [[ $local_host = lcfimm || $local_host = lctit || $localhost = lcxt4 ]] |
---|
1153 | then |
---|
1154 | eval $submcom $job_on_remhost |
---|
1155 | echo "$submcom $job_on_remhost" |
---|
1156 | chmod u+x $job_on_remhost |
---|
1157 | elif [[ $local_host = nech ]] |
---|
1158 | then |
---|
1159 | if [[ $queue = default ]] |
---|
1160 | then |
---|
1161 | eval $submcom $job_on_remhost |
---|
1162 | else |
---|
1163 | eval $submcom -q $queue $job_on_remhost |
---|
1164 | fi |
---|
1165 | else |
---|
1166 | qsub $job_on_remhost |
---|
1167 | fi |
---|
1168 | # JOBFILE DARF AUF LCTIT NICHT GELOESCHT WERDEN!! GESCHIEHT ERST AM JOBENDE |
---|
1169 | [[ $local_host != lctit ]] && rm $job_on_remhost |
---|
1170 | cd - > /dev/null |
---|
1171 | fi |
---|
1172 | fi |
---|
1173 | |
---|
1174 | |
---|
1175 | |
---|
1176 | # ABSCHLUSSARBEITEN |
---|
1177 | |
---|
1178 | if [[ $no_submit = false ]] |
---|
1179 | then |
---|
1180 | rm $job_to_send |
---|
1181 | fi |
---|
1182 | [[ $verify = true ]] && printf "\n\n *** SUBJOB finished \n\n" |
---|