1 | #!/bin/ksh |
---|
2 | # subjob - Plot-Shellskript Version: @(#)SUBJOB 1.0 |
---|
3 | # $Id: subjob 54 2007-03-08 00:00:02Z 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 | # 23/10/07 - Marcus- further adjustments for queues on lctit |
---|
92 | |
---|
93 | |
---|
94 | # VARIABLENVEREINBARUNGEN + DEFAULTWERTE |
---|
95 | delete_dayfile=false |
---|
96 | group_number=none |
---|
97 | locat=normal |
---|
98 | no_default_queue=none |
---|
99 | no_submit=false |
---|
100 | job_catalog="~/job_queue" |
---|
101 | job_name=none |
---|
102 | local_user=$LOGNAME |
---|
103 | node_usage=shared |
---|
104 | numprocs=1 |
---|
105 | punkte="..........................................................." |
---|
106 | submcom=qsub |
---|
107 | queue=default |
---|
108 | remote_host=none |
---|
109 | remote_user="" |
---|
110 | verify=true |
---|
111 | |
---|
112 | typeset -i cputime=0 memory=0 Memory=0 minuten resttime sekunden stunden |
---|
113 | typeset -i inumprocs nodes=0 tasks_per_node=0 threads_per_task=1 |
---|
114 | typeset -L20 spalte1 |
---|
115 | typeset -R40 spalte2 |
---|
116 | typeset -L60 spalte3 |
---|
117 | |
---|
118 | |
---|
119 | |
---|
120 | # FEHLERBEHANDLUNG |
---|
121 | # BEI EXIT: |
---|
122 | trap 'if [[ $locat != normal ]] |
---|
123 | then |
---|
124 | case $locat in |
---|
125 | (option) printf "\n --> available optios can be displayed" |
---|
126 | printf " by typing:" |
---|
127 | printf "\n \"subjob ?\" \n";; |
---|
128 | (ftpcopy|parameter|scp|verify) printf "\n";; |
---|
129 | (*) printf "\n +++ unknown error" |
---|
130 | printf "\n please inform S. Raasch!\n" |
---|
131 | esac |
---|
132 | [[ -f $job_to_send ]] && rm $job_to_send |
---|
133 | printf "\n\n+++ SUBJOB killed \n\n" |
---|
134 | fi' exit |
---|
135 | |
---|
136 | |
---|
137 | # BEI TERMINAL-BREAK: |
---|
138 | trap '[[ -f $job_to_send ]] && rm $job_to_send |
---|
139 | printf "\n\n+++ SUBJOB killed \n\n" |
---|
140 | exit |
---|
141 | ' 2 |
---|
142 | |
---|
143 | |
---|
144 | |
---|
145 | |
---|
146 | # LOKALEN HOSTNAMEN FESTSTELLEN |
---|
147 | local_host=$(hostname) |
---|
148 | |
---|
149 | |
---|
150 | |
---|
151 | # HOSTSPEZIFISCHE VARIABLEN VEREINBAREN BZW. PRUEFEN, OB LOKALER HOST |
---|
152 | # UEBERHAUPT ZULAESSIG IST |
---|
153 | case $local_host in |
---|
154 | (atmos) local_addres=172.20.25.35; local_host=lcide;; |
---|
155 | (autan) local_addres=130.75.105.57; local_host=lcmuk;; |
---|
156 | (bora) local_addres=130.75.105.103; local_host=lcmuk;; |
---|
157 | (breg*-en0|berni*-en0) local_addres=130.73.230.10; local_host=ibmb;; |
---|
158 | (breva) local_addres=130.75.105.98; local_host=lcmuk;; |
---|
159 | (compute-*.local) local_addres=172.20.4.2; local_host=lcfimm;; |
---|
160 | (cs*) local_addres=136.172.44.131; local_host=nech;; |
---|
161 | (elephanta) local_addres=130.75.105.6; local_host=lcmuk;; |
---|
162 | (fimm.bccs.uib.no) local_addres=172.20.4.2; local_host=lcfimm;; |
---|
163 | (gallego) local_addres=130.75.105.10; local_host=lcmuk;; |
---|
164 | (gate|n-sx) local_addres=133.5.178.11; local_host=neck;; |
---|
165 | (gfdl5) local_addres=165.132.26.58; local_host=ibmy;; |
---|
166 | (gfdl3.yonsei.ac.kr) local_addres=165.132.26.56; local_host=decalpha;; |
---|
167 | (gregale) local_addres=130.75.105.109; local_host=lcmuk;; |
---|
168 | (hababai) local_addres=130.75.105.108; local_host=lcmuk;; |
---|
169 | (hreg*-en0|hanni*-en0) local_addres=130.75.4.10; local_host=ibmh;; |
---|
170 | (irifi) local_addres=130.75.105.104; local_host=lcmuk;; |
---|
171 | (levanto) local_addres=130.75.105.45; local_host=lcmuk;; |
---|
172 | (maestro) local_addres=130.75.105.2; local_host=lcmuk;; |
---|
173 | (nobel*) local_addres=150.183.5.101; local_host=ibms;; |
---|
174 | (orkan) local_addres=130.75.105.3; local_host=lcmuk;; |
---|
175 | (ostria) local_addres=130.75.105.106; local_host=lcmuk;; |
---|
176 | (quanero) local_addres=130.75.105.107; local_host=lcmuk;; |
---|
177 | (scirocco) local_addres=172.20.25.41; local_host=lcmuk;; |
---|
178 | (sun1|sun2) local_addres=130.75.6.1; local_host=unics;; |
---|
179 | (tgg*) local_addres=172.17.75.161; local_host=lctit;; |
---|
180 | (vorias) local_addres=172.20.25.43; local_host=lcmuk;; |
---|
181 | (*) printf "\n +++ \"$local_host\" unknown"; |
---|
182 | printf "\n please inform S. Raasch!"; |
---|
183 | locat=parameter; exit;; |
---|
184 | esac |
---|
185 | |
---|
186 | |
---|
187 | |
---|
188 | # REMOTE HOST DEFAULTMAESSIG = LOCAL HOST SETZEN |
---|
189 | remote_host=$local_host |
---|
190 | |
---|
191 | |
---|
192 | |
---|
193 | |
---|
194 | # PROZEDUROPTIONEN EINLESEN |
---|
195 | while getopts :c:dDg:h:m:n:N:O:q:t:T:u:vX: option |
---|
196 | do |
---|
197 | case $option in |
---|
198 | (c) job_catalog=$OPTARG;; |
---|
199 | (d) delete_dayfile=true;; |
---|
200 | (D) no_submit=true;; |
---|
201 | (g) group_number=$OPTARG;; |
---|
202 | (h) remote_host=$OPTARG;; |
---|
203 | (m) memory=$OPTARG;; |
---|
204 | (n) job_name=$OPTARG;; |
---|
205 | (N) node_usage=$OPTARG;; |
---|
206 | (O) threads_per_task=$OPTARG;; |
---|
207 | (q) no_default_queue=$OPTARG;; |
---|
208 | (t) cputime=$OPTARG;; |
---|
209 | (T) tasks_per_node=$OPTARG;; |
---|
210 | (u) remote_user=$OPTARG;; |
---|
211 | (v) verify=false;; |
---|
212 | (X) numprocs=$OPTARG;; |
---|
213 | (\?) printf "\n +++ Option $OPTARG unknown \n"; |
---|
214 | locat=option; exit;; |
---|
215 | esac |
---|
216 | done |
---|
217 | |
---|
218 | |
---|
219 | # JOBDATEINAMEN ALS NAECHSTES ARGUMENT HOLEN |
---|
220 | shift OPTIND-1; file_to_send=$1 |
---|
221 | |
---|
222 | |
---|
223 | # KURZE AUFRUFBESCHREIBUNG WIRD HIER AUSGEGEBEN |
---|
224 | if [ "$1" = "?" ] |
---|
225 | then |
---|
226 | (printf "\n *** subjob can be called as follows:\n" |
---|
227 | printf "\n subjob -c.. -d -D -h.. -m.. -q.. -t.. -u.. -v <jobfile>\n" |
---|
228 | printf "\n Description of available options:\n" |
---|
229 | printf "\n Option Description Default-Value" |
---|
230 | printf "\n -c job-input- and output-catalog ~/job_queue" |
---|
231 | printf "\n -d no job-protocol will be created ---" |
---|
232 | printf "\n -D only the job-file will be created ---" |
---|
233 | printf "\n -h execution host, available hosts: $remote_host" |
---|
234 | printf "\n ibm, ibmb, ibmh, ibms, ibmy, lcmuk," |
---|
235 | printf "\n lctit, nech, neck, unics" |
---|
236 | printf "\n -m memory demand per process in MByte ---" |
---|
237 | printf "\n -n jobname <jobdatei>" |
---|
238 | printf "\n -O threads per task (for OpenMP usage) 1" |
---|
239 | printf "\n -q job-queue to be used default" |
---|
240 | printf "\n -t allowed cpu-time in seconds ---" |
---|
241 | printf "\n -T tasks per node (on parallel hosts) ---" |
---|
242 | printf "\n -u username on execution host from .netrc" |
---|
243 | printf "\n -v no prompt for confirmation ---" |
---|
244 | printf "\n -X # of processors (on parallel hosts) 1" |
---|
245 | printf "\n " |
---|
246 | printf "\n The only possible positional parameter is <jobfile>:" |
---|
247 | printf "\n The complete NQS-job must be provided here." |
---|
248 | printf "\n <jobfile>=? creates this outline\n\n") | more |
---|
249 | exit |
---|
250 | fi |
---|
251 | |
---|
252 | |
---|
253 | |
---|
254 | # PRUEFEN, OB JOBDATEI ANGEGEBEN WURDE UND OB SIE AUCH EXISTIERT |
---|
255 | if [[ "$file_to_send" = "" ]] |
---|
256 | then |
---|
257 | printf "\n +++ job-file missing" |
---|
258 | locat=parameter; exit |
---|
259 | else |
---|
260 | if [[ -f $file_to_send ]] |
---|
261 | then |
---|
262 | true |
---|
263 | else |
---|
264 | printf "\n +++ job-file: " |
---|
265 | printf "\n $file_to_send" |
---|
266 | printf "\n does not exist" |
---|
267 | locat=parameter; exit |
---|
268 | fi |
---|
269 | fi |
---|
270 | |
---|
271 | |
---|
272 | |
---|
273 | # FALLS KEIN JOBNAME ANGEGEBEN WURDE, WIRD JOBNAME = JOBDATEINAME |
---|
274 | # GESETZT. VORAUSSETZUNG: JOBDATEINAME BEINHALTET KEINE PFADE |
---|
275 | if [[ $job_name = none ]] |
---|
276 | then |
---|
277 | job_name=$file_to_send |
---|
278 | fi |
---|
279 | if [[ $(echo $job_name | grep -c "/") != 0 ]] |
---|
280 | then |
---|
281 | printf "\n +++ job-file name: " |
---|
282 | printf "\n $job_name" |
---|
283 | printf "\n must not contain \"/\"-characters" |
---|
284 | locat=parameter; exit |
---|
285 | fi |
---|
286 | |
---|
287 | |
---|
288 | |
---|
289 | |
---|
290 | # HOSTSPEZIFISCHE GROESSEN VEREINBAREN BZW. ABBRUCH BEI UNZULAESSIGEM HOST |
---|
291 | # ODER WENN HOST NICHT ANGEGEBEN WURDE |
---|
292 | if [[ $remote_host = none ]] |
---|
293 | then |
---|
294 | printf "\n +++ host missing" |
---|
295 | locat=option; exit |
---|
296 | else |
---|
297 | case $remote_host in |
---|
298 | (ibm) queue=p690_standard; remote_addres=134.76.99.81; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
299 | (ibmb) queue=cpar; remote_addres=130.73.230.10; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
300 | (ibmh) queue=cpar; remote_addres=130.75.4.10; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
301 | (ibms) queue=p_normal; remote_addres=150.183.5.101; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
302 | (ibmy) queue=parallel; remote_addres=165.132.26.58; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
303 | (lcfimm) remote_addres=172.20.4.2; submcom=/opt/torque/bin/qsub;; |
---|
304 | (lctit) queue=lctit; remote_addres=172.17.75.161; submcom=/n1ge/TITECH_GRID/tools/bin/n1ge;; |
---|
305 | (nech) qsubmem=memsz_job; qsubtime=cputim_job; remote_addres=136.172.44.147; submcom="/usr/local/bin/qsub";; |
---|
306 | (neck) qsubmem=memsz_job; qsubtime=cputim_job; remote_addres=133.5.178.11; submcom="/usr/bin/nqsII/qsub";; |
---|
307 | (vpp) qsubmem=m; qsubtime=t; queue=vpp; remote_addres=130.75.4.130;; |
---|
308 | (unics) qsubmem=d; qsubtime=t; queue=unics; remote_addres=130.75.6.1;; |
---|
309 | (*) printf "\n +++ hostname \"$remote_host\" not allowed"; |
---|
310 | locat=parameter; exit;; |
---|
311 | esac |
---|
312 | fi |
---|
313 | |
---|
314 | |
---|
315 | # EVTL. PRUEFEN, OB ANGEGEBENE QUEUE ZULAESSIG IST |
---|
316 | if [[ $no_default_queue != none ]] |
---|
317 | then |
---|
318 | error=false |
---|
319 | ndq=$no_default_queue |
---|
320 | case $remote_host in |
---|
321 | (ibm) case $ndq in |
---|
322 | (p690_express|p690_standard|p690_long) error=false;; |
---|
323 | (*) error=true;; |
---|
324 | esac;; |
---|
325 | (ibmb) case $ndq in |
---|
326 | (cdata|cdev|cexp|c1|cshare|csolo|cspec) error=false;; |
---|
327 | (*) error=true;; |
---|
328 | esac;; |
---|
329 | (ibmh) case $ndq in |
---|
330 | (cdata|cdev|cexp|channi|cxxl|c1|cshare|csolo|csoloh3h|csoloh6h|csoloh12h|csoloh1d|csoloh2d|cspec) error=false;; |
---|
331 | (*) error=true;; |
---|
332 | esac;; |
---|
333 | (ibms) case $ndq in |
---|
334 | (express|normal|p_express|p_normal|p_normal_1.3|p_normal_1.7|grand) error=false;; |
---|
335 | (*) error=true;; |
---|
336 | esac;; |
---|
337 | (ibmy) case $ndq in |
---|
338 | (parallel) error=false;; |
---|
339 | (*) error=true;; |
---|
340 | esac;; |
---|
341 | (lctit) case $ndq in |
---|
342 | (novice|bes1|bes2|sla1|sla2|sla3|RAM64GB|RAM128GB) error=false;; |
---|
343 | (*) error=true;; |
---|
344 | esac;; |
---|
345 | (t3eb) case $ndq in |
---|
346 | (berte|p50|p100|p392|forfree|p25himem) error=false;; |
---|
347 | (*) error=true;; |
---|
348 | esac;; |
---|
349 | (t3eh) case $ndq in |
---|
350 | (para_t3e|em|k|l|lm|comp_t3e|c|p|ht) error=false;; |
---|
351 | (*) error=true;; |
---|
352 | esac;; |
---|
353 | (t3ej2|t3ej5) case $ndq in |
---|
354 | (low|normal|high) error=false;; |
---|
355 | (*) error=true;; |
---|
356 | esac;; |
---|
357 | (t3es) case $ndq in |
---|
358 | (batch|serial-4|pe4|p48|pe16|pe32|pe64|pe128) error=false;; |
---|
359 | (*) error=true;; |
---|
360 | esac;; |
---|
361 | (unics) case $ndq in |
---|
362 | (unics|ht) error=false;; |
---|
363 | (*) error=true;; |
---|
364 | esac;; |
---|
365 | esac |
---|
366 | if [[ $error = true ]] |
---|
367 | then |
---|
368 | printf "\n +++ queue \"$no_default_queue\" on host \"$remote_host\" not allowed" |
---|
369 | locat=parameter; exit |
---|
370 | else |
---|
371 | queue=$no_default_queue |
---|
372 | fi |
---|
373 | fi |
---|
374 | |
---|
375 | |
---|
376 | |
---|
377 | # KNOTENNUTZUNG IN ENTWICKLERQUEUE MUSS SHARED SEIN |
---|
378 | if [[ $node_usage != shared && $queue = cdev ]] |
---|
379 | then |
---|
380 | node_usage=shared |
---|
381 | fi |
---|
382 | |
---|
383 | |
---|
384 | |
---|
385 | # PRUEFEN DER CPU-ZEIT, ZEIT NACH STUNDEN, MINUTEN UND SEKUNDEN |
---|
386 | # AUFTEILEN |
---|
387 | done=false |
---|
388 | while [[ $done = false ]] |
---|
389 | do |
---|
390 | if (( $cputime <= 0 )) |
---|
391 | then |
---|
392 | printf "\n +++ wrong cpu-time or cpu-time missing" |
---|
393 | printf "\n >>> Please type cpu-time in seconds as INTEGER:" |
---|
394 | printf "\n >>> " |
---|
395 | read cputime 1>/dev/null 2>&1 |
---|
396 | else |
---|
397 | done=true |
---|
398 | fi |
---|
399 | done |
---|
400 | if [[ $remote_host = nech ]] |
---|
401 | then |
---|
402 | if (( tasks_per_node != 0 )) |
---|
403 | then |
---|
404 | (( cputime = cputime * tasks_per_node )) |
---|
405 | elif [[ $numprocs != 0 ]] |
---|
406 | then |
---|
407 | (( cputime = cputime * numprocs )) |
---|
408 | fi |
---|
409 | fi |
---|
410 | (( stunden = cputime / 3600 )) |
---|
411 | (( resttime = cputime - stunden * 3600 )) |
---|
412 | (( minuten = resttime / 60 )) |
---|
413 | (( sekunden = resttime - minuten * 60 )) |
---|
414 | timestring=${stunden}:${minuten}:${sekunden} |
---|
415 | |
---|
416 | |
---|
417 | |
---|
418 | # PRUEFEN DER KERNSPEICHERANFORDERUNG |
---|
419 | done=false |
---|
420 | while [[ $done = false ]] |
---|
421 | do |
---|
422 | if (( memory <= 0 )) |
---|
423 | then |
---|
424 | printf "\n +++ wrong memory demand or memory demand missing" |
---|
425 | printf "\n >>> Please type memory in MByte per process as INTEGER:" |
---|
426 | printf "\n >>> " |
---|
427 | read memory 1>/dev/null 2>&1 |
---|
428 | else |
---|
429 | done=true |
---|
430 | fi |
---|
431 | done |
---|
432 | |
---|
433 | if [[ $remote_host = nech || $remote_host = neck ]] |
---|
434 | then |
---|
435 | if (( tasks_per_node != 0 )) |
---|
436 | then |
---|
437 | (( Memory = memory * tasks_per_node / 1000 )) |
---|
438 | elif [[ $numprocs != 0 ]] |
---|
439 | then |
---|
440 | (( Memory = memory * numprocs / 1000 )) |
---|
441 | else |
---|
442 | (( Memory = memory / 1000 )) |
---|
443 | fi |
---|
444 | fi |
---|
445 | |
---|
446 | |
---|
447 | # SPEICHERBERECHNUNG BEI OPENMP-NUTZUNG |
---|
448 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
449 | then |
---|
450 | (( memory = memory * threads_per_task )) |
---|
451 | fi |
---|
452 | |
---|
453 | |
---|
454 | # BERECHNUNG DER ANZAHL DER ZU VERWENDENDEN KNOTEN |
---|
455 | if (( tasks_per_node != 0 )) |
---|
456 | then |
---|
457 | (( nodes = numprocs / ( tasks_per_node * threads_per_task ) )) |
---|
458 | fi |
---|
459 | |
---|
460 | |
---|
461 | |
---|
462 | # HEADER-AUSGABE |
---|
463 | if [[ $verify = true ]] |
---|
464 | then |
---|
465 | printf "\n\n" |
---|
466 | printf "#--------------------------------------------------------------# \n" |
---|
467 | spalte1=SUBJOB;spalte2=$(date) |
---|
468 | printf "| $spalte1$spalte2 | \n" |
---|
469 | printf "| | \n" |
---|
470 | printf "| values of parameters/options: | \n" |
---|
471 | spalte1=local_host$punkte; spalte2=$punkte$local_host |
---|
472 | printf "| $spalte1$spalte2 | \n" |
---|
473 | spalte1=remote_host$punkte; spalte2=$punkte$remote_host |
---|
474 | printf "| $spalte1$spalte2 | \n" |
---|
475 | spalte1=queue$punkte; spalte2=$punkte$queue |
---|
476 | printf "| $spalte1$spalte2 | \n" |
---|
477 | spalte1=memory$punkte; spalte2="$punkte$memory mb" |
---|
478 | printf "| $spalte1$spalte2 | \n" |
---|
479 | spalte1=cputime$punkte; spalte2="$punkte$cputime sec" |
---|
480 | printf "| $spalte1$spalte2 | \n" |
---|
481 | spalte1=job_name$punkte; spalte2="$punkte$job_name" |
---|
482 | printf "| $spalte1$spalte2 | \n" |
---|
483 | printf "#--------------------------------------------------------------# \n\n" |
---|
484 | |
---|
485 | |
---|
486 | # KONTROLLABFRAGE, OB ALLES O.K. |
---|
487 | antwort="dummy" |
---|
488 | while [[ $antwort != y && $antwort != Y && $antwort != n && $antwort != N ]] |
---|
489 | do |
---|
490 | read antwort?" >>> continue (y/n) ? " |
---|
491 | done |
---|
492 | if [[ $antwort = n || $antwort = N ]] |
---|
493 | then |
---|
494 | locat=verify; exit |
---|
495 | fi |
---|
496 | printf "\n" |
---|
497 | fi |
---|
498 | |
---|
499 | |
---|
500 | |
---|
501 | # ZUFALLSKENNUNG GENERIEREN UND JOBNAMEN AUF ZIELRECHNER BESTIMMEN |
---|
502 | kennung=$RANDOM |
---|
503 | job_on_remhost=${job_name}_${kennung}_$local_host |
---|
504 | job_to_send=job_to_send_$kennung |
---|
505 | if [[ $delete_dayfile = false ]] |
---|
506 | then |
---|
507 | remote_dayfile=${local_host}_${job_name}_result_$kennung |
---|
508 | local_dayfile=${remote_host}_${job_name} |
---|
509 | else |
---|
510 | remote_dayfile=/dev/null |
---|
511 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
512 | then |
---|
513 | notification='# @ notification = never' |
---|
514 | fi |
---|
515 | fi |
---|
516 | |
---|
517 | |
---|
518 | |
---|
519 | # QSUB- ODER LL-KOMMANDOS BZW. SKRIPTE GENERIEREN |
---|
520 | if [[ $(echo $remote_host | cut -c1-3) = ibm && $numprocs != 0 ]] |
---|
521 | then |
---|
522 | |
---|
523 | if [[ $remote_host = ibmy ]] |
---|
524 | then |
---|
525 | consumable_memory="" |
---|
526 | else |
---|
527 | consumable_memory="ConsumableMemory($memory mb)" |
---|
528 | fi |
---|
529 | if [[ $queue = cdev ]] |
---|
530 | then |
---|
531 | data_limit="# @ data_limit = 1.76gb" |
---|
532 | network_to_use="# @ network.mpi = sn_all,shared,ip" |
---|
533 | else |
---|
534 | if [[ $remote_host = ibms ]] |
---|
535 | then |
---|
536 | network_to_use="# @ network.mpi = csss,shared,us" |
---|
537 | elif [[ $remote_host = ibmy ]] |
---|
538 | then |
---|
539 | network_to_use="" |
---|
540 | else |
---|
541 | network_to_use="# @ network.mpi = sn_all,shared,us" |
---|
542 | data_limit="# @ data_limit = 1.76gb" |
---|
543 | fi |
---|
544 | fi |
---|
545 | |
---|
546 | cat > $job_to_send << %%END%% |
---|
547 | #!/bin/ksh |
---|
548 | |
---|
549 | # @ job_type = parallel |
---|
550 | # @ job_name = palm |
---|
551 | # @ wall_clock_limit = ${timestring},$timestring |
---|
552 | # @ resources = ConsumableCpus($threads_per_task) $consumable_memory |
---|
553 | # @ output = $remote_dayfile |
---|
554 | # @ error = $remote_dayfile |
---|
555 | # @ image_size = 50 |
---|
556 | # @ class = $queue |
---|
557 | # @ environment = OMP_NUM_THREADS=$threads_per_task; MP_SHARED_MEMORY=yes |
---|
558 | $network_to_use |
---|
559 | $data_limit |
---|
560 | $notification |
---|
561 | |
---|
562 | %%END%% |
---|
563 | |
---|
564 | if (( nodes > 0 )) |
---|
565 | then |
---|
566 | |
---|
567 | cat >> $job_to_send << %%END%% |
---|
568 | # @ node = $nodes |
---|
569 | # @ tasks_per_node = $tasks_per_node |
---|
570 | # @ node_usage = $node_usage |
---|
571 | # @ queue |
---|
572 | |
---|
573 | %%END%% |
---|
574 | |
---|
575 | else |
---|
576 | |
---|
577 | if [[ $remote_host != ibmy ]] |
---|
578 | then |
---|
579 | |
---|
580 | cat >> $job_to_send << %%END%% |
---|
581 | # @ blocking = unlimited |
---|
582 | # @ total_tasks = $numprocs |
---|
583 | # @ node_usage = $node_usage |
---|
584 | # @ queue |
---|
585 | |
---|
586 | %%END%% |
---|
587 | |
---|
588 | else |
---|
589 | |
---|
590 | cat >> $job_to_send << %%END%% |
---|
591 | # @ node = 1 |
---|
592 | # @ total_tasks = $numprocs |
---|
593 | # @ queue |
---|
594 | |
---|
595 | %%END%% |
---|
596 | |
---|
597 | fi |
---|
598 | |
---|
599 | fi |
---|
600 | |
---|
601 | elif [[ $(echo $remote_host | cut -c1-3) = ibm && $numprocs = 0 ]] |
---|
602 | then |
---|
603 | |
---|
604 | cat > $job_to_send << %%END%% |
---|
605 | #!/bin/ksh |
---|
606 | |
---|
607 | # @ job_type = serial |
---|
608 | # @ node_usage = $node_usage |
---|
609 | # @ job_name = palm |
---|
610 | # @ wall_clock_limit = ${timestring},$timestring |
---|
611 | # @ resources = ConsumableCpus(1) ConsumableMemory(1 gb) |
---|
612 | # @ output = $remote_dayfile |
---|
613 | # @ error = $remote_dayfile |
---|
614 | # @ class = $queue |
---|
615 | $notification |
---|
616 | |
---|
617 | # @ queue |
---|
618 | |
---|
619 | %%END%% |
---|
620 | |
---|
621 | elif [[ $remote_host = lcfimm ]] |
---|
622 | then |
---|
623 | |
---|
624 | if [[ $numprocs != 0 ]] |
---|
625 | then |
---|
626 | cat > $job_to_send << %%END%% |
---|
627 | #!/bin/ksh |
---|
628 | #PBS -N $job_name |
---|
629 | #PBS -A nersc |
---|
630 | #PBS -l walltime=$timestring |
---|
631 | #PBS -l nodes=${nodes}:ppn=$tasks_per_node |
---|
632 | #PBS -l pmem=${memory}mb |
---|
633 | #PBS -m abe |
---|
634 | #PBS -M igore@nersc.no |
---|
635 | #PBS -o $remote_dayfile |
---|
636 | #PBS -j oe |
---|
637 | mpd & |
---|
638 | |
---|
639 | %%END%% |
---|
640 | |
---|
641 | else |
---|
642 | cat > $job_to_send << %%END%% |
---|
643 | #!/bin/ksh |
---|
644 | #PBS -N $job_name |
---|
645 | #PBS -A nersc |
---|
646 | #PBS -l walltime=$timestring |
---|
647 | #PBS -l ncpus=1 |
---|
648 | #PBS -l pmem=${memory}mb |
---|
649 | #PBS -m abe |
---|
650 | #PBS -M igore@nersc.no |
---|
651 | #PBS -o $remote_dayfile |
---|
652 | #PBS -j oe |
---|
653 | |
---|
654 | %%END%% |
---|
655 | |
---|
656 | fi |
---|
657 | |
---|
658 | elif [[ $remote_host = nech ]] |
---|
659 | then |
---|
660 | |
---|
661 | if (( nodes > 1 )) |
---|
662 | then |
---|
663 | cat > $job_to_send << %%END%% |
---|
664 | #!/bin/ksh |
---|
665 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
666 | #PBS -l ${qsubmem}=${Memory}gb |
---|
667 | #PBS -b $nodes |
---|
668 | #PBS -o $remote_dayfile |
---|
669 | #PBS -N palm |
---|
670 | #PBS -j o |
---|
671 | #PBS -T mpisx |
---|
672 | |
---|
673 | %%END%% |
---|
674 | |
---|
675 | elif [[ $numprocs != 0 ]] |
---|
676 | then |
---|
677 | cat > $job_to_send << %%END%% |
---|
678 | #!/bin/ksh |
---|
679 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
680 | #PBS -l ${qsubmem}=${Memory}gb |
---|
681 | #PBS -o $remote_dayfile |
---|
682 | #PBS -N palm |
---|
683 | #PBS -j o |
---|
684 | |
---|
685 | %%END%% |
---|
686 | |
---|
687 | else |
---|
688 | cat > $job_to_send << %%END%% |
---|
689 | #!/bin/ksh |
---|
690 | #PBS -l ${qsubmem}=${Memory}gb,${qsubtime}=$cputime |
---|
691 | #PBS -o $remote_dayfile |
---|
692 | #PBS -j o |
---|
693 | |
---|
694 | %%END%% |
---|
695 | |
---|
696 | fi |
---|
697 | |
---|
698 | elif [[ $remote_host = neck ]] |
---|
699 | then |
---|
700 | |
---|
701 | if (( nodes > 1 )) |
---|
702 | then |
---|
703 | cat > $job_to_send << %%END%% |
---|
704 | #!/bin/ksh |
---|
705 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
706 | #PBS -l ${qsubmem}=${Memory}gb |
---|
707 | #PBS -b $nodes |
---|
708 | #PBS -o $remote_dayfile |
---|
709 | #PBS -N palm |
---|
710 | #PBS -j o |
---|
711 | #PBS -T mpisx |
---|
712 | |
---|
713 | %%END%% |
---|
714 | |
---|
715 | elif [[ $numprocs != 0 ]] |
---|
716 | then |
---|
717 | cat > $job_to_send << %%END%% |
---|
718 | #!/bin/ksh |
---|
719 | #PBS -q ${queue} |
---|
720 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
721 | #PBS -l ${qsubmem}=${Memory}gb |
---|
722 | #PBS -o $remote_dayfile |
---|
723 | #PBS -N palm |
---|
724 | #PBS -j o |
---|
725 | #PBS -T mpisx |
---|
726 | |
---|
727 | %%END%% |
---|
728 | |
---|
729 | else |
---|
730 | cat > $job_to_send << %%END%% |
---|
731 | #!/bin/ksh |
---|
732 | #PBS -l ${qsubmem}=${Memory}gb,${qsubtime}=$cputime |
---|
733 | #PBS -o $remote_dayfile |
---|
734 | #PBS -j o |
---|
735 | |
---|
736 | %%END%% |
---|
737 | |
---|
738 | fi |
---|
739 | |
---|
740 | elif [[ $remote_host = lctit ]] |
---|
741 | then |
---|
742 | cat > $job_to_send << %%END%% |
---|
743 | #!/bin/bash |
---|
744 | #$ -S /bin/bash |
---|
745 | cd $job_catalog |
---|
746 | export PATH=$PALM_BIN:\$PATH |
---|
747 | echo \$PATH |
---|
748 | |
---|
749 | %%END%% |
---|
750 | |
---|
751 | # OPTIONEN FUER SUBMIT-KOMMANDO ZUSAMMENSTELLEN |
---|
752 | # submcom="$submcom -N $job_name -sgeout $remote_dayfile -q default" |
---|
753 | submcom="$submcom -g $group_number -N $job_name -rt 4320 -sgeout $remote_dayfile -q $node_usage " |
---|
754 | |
---|
755 | else |
---|
756 | |
---|
757 | cat > $job_to_send << %%END%% |
---|
758 | # @\$-q ${queue} |
---|
759 | # @\$-l${qsubtime} $timestring |
---|
760 | # @\$-l${qsubmem} ${memory}mb |
---|
761 | # @\$-o $remote_dayfile |
---|
762 | # @\$-eo |
---|
763 | |
---|
764 | %%END%% |
---|
765 | |
---|
766 | fi |
---|
767 | |
---|
768 | |
---|
769 | # BEI RECHNUNG AUF REMOTE-MASCHINEN RUECKTRANSFER DES DAYFILES PER TRAP |
---|
770 | # BEI EXIT VERANLASSEN |
---|
771 | # VEKTORRECHNER MUSS EIGENEN JOB STARTEN, DA DORT NOHUP NICHT FUNKTIONIERT |
---|
772 | # AUF IBM IN SEOUL IST RUECKTRANSFER ZUR ZEIT GENERELL NICHT MOEGLICH |
---|
773 | if [[ $delete_dayfile = false && $remote_host != $local_host ]] |
---|
774 | then |
---|
775 | echo "set +vx" >> $job_to_send |
---|
776 | echo "trap '" >> $job_to_send |
---|
777 | echo "set +vx" >> $job_to_send |
---|
778 | if [[ $(echo $remote_host | cut -c1-3) = ibm || $(echo $remote_host | cut -c1-3) = nec || $remote_host = lctit ]] |
---|
779 | then |
---|
780 | if [[ $remote_host = ibmb || $remote_host = ibmh ]] |
---|
781 | then |
---|
782 | return_queue=c1 |
---|
783 | elif [[ $remote_host = ibms ]] |
---|
784 | then |
---|
785 | return_queue=p_normal |
---|
786 | elif [[ $remote_host = ibmy ]] |
---|
787 | then |
---|
788 | return_queue=serial |
---|
789 | elif [[ $remote_host = lctit ]] |
---|
790 | then |
---|
791 | return_queue=sla3 |
---|
792 | elif [[ $remote_host = neck ]] |
---|
793 | then |
---|
794 | return_queue=S |
---|
795 | else |
---|
796 | return_queue=unknown |
---|
797 | fi |
---|
798 | |
---|
799 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
800 | then |
---|
801 | |
---|
802 | echo "echo \"#!/bin/ksh\" >> scpjob.$kennung" >> $job_to_send |
---|
803 | echo "echo \"# @ job_type = serial\" >> scpjob.$kennung" >> $job_to_send |
---|
804 | echo "echo \"# @ job_name = transfer\" >> scpjob.$kennung" >> $job_to_send |
---|
805 | echo "echo \"# @ resources = ConsumableCpus(1) ConsumableMemory(1 gb)\" >> scpjob.$kennung" >> $job_to_send |
---|
806 | echo "echo \"# @ wall_clock_limit = 00:10:00,00:10:00\" >> scpjob.$kennung " >> $job_to_send |
---|
807 | echo "echo \"# @ output = job_queue/last_job_transfer_protocol\" >> scpjob.$kennung" >> $job_to_send |
---|
808 | echo "echo \"# @ error = job_queue/last_job_transfer_protocol\" >> scpjob.$kennung" >> $job_to_send |
---|
809 | echo "echo \"# @ class = $return_queue\" >> scpjob.$kennung" >> $job_to_send |
---|
810 | echo "echo \"# @ image_size = 10\" >> scpjob.$kennung" >> $job_to_send |
---|
811 | echo "echo \"# @ notification = never\" >> scpjob.$kennung" >> $job_to_send |
---|
812 | |
---|
813 | echo "echo \"# @ queue\" >> scpjob.$kennung" >> $job_to_send |
---|
814 | echo "echo \" \" >> scpjob.$kennung" >> $job_to_send |
---|
815 | |
---|
816 | echo "echo \"set -x\" >> scpjob.$kennung" >> $job_to_send |
---|
817 | 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 |
---|
818 | echo "echo \"exit\" >> scpjob.$kennung" >> $job_to_send |
---|
819 | |
---|
820 | elif [[ $remote_host = nech ]] |
---|
821 | then |
---|
822 | echo "cd /pf/b/${remote_user}/job_queue" >> $job_to_send |
---|
823 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
824 | echo "#PBS -l ${qsubmem}=1GB,${qsubtime}=100" >> $job_to_send |
---|
825 | echo "#PBS -o last_job_transfer_protocol" >> $job_to_send |
---|
826 | echo "#PBS -j o" >> $job_to_send |
---|
827 | echo " " >> $job_to_send |
---|
828 | echo "set -x" >> $job_to_send |
---|
829 | echo "cd /pf/b/${remote_user}/job_queue" >> $job_to_send |
---|
830 | echo "batch_scp -d -w 10 -u $local_user $local_addres $remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
831 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
832 | echo "%%END%%" >> $job_to_send |
---|
833 | |
---|
834 | elif [[ $remote_host = neck ]] |
---|
835 | then |
---|
836 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
837 | echo "#PBS -q $return_queue" >> $job_to_send |
---|
838 | echo "#PBS -l ${qsubmem}=1GB,${qsubtime}=100" >> $job_to_send |
---|
839 | echo "#PBS -o last_job_transfer_protocol" >> $job_to_send |
---|
840 | echo "#PBS -j o" >> $job_to_send |
---|
841 | echo " " >> $job_to_send |
---|
842 | echo "set -x" >> $job_to_send |
---|
843 | echo "batch_scp -d -w 10 -u $local_user $local_addres $remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
844 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
845 | echo "%%END%%" >> $job_to_send |
---|
846 | |
---|
847 | elif [[ $remote_host = lctit ]] |
---|
848 | then |
---|
849 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
850 | echo "set -x" >> $job_to_send |
---|
851 | echo "PATH=\$PATH:$job_catalog/../pub" >> $job_to_send |
---|
852 | echo "cd $job_catalog" >> $job_to_send |
---|
853 | echo "batch_scp -d -w 10 -u $local_user $local_addres $remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
854 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
855 | echo "%%END%%" >> $job_to_send |
---|
856 | |
---|
857 | else |
---|
858 | |
---|
859 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
860 | echo "# @\\\$-q $return_queue" >> $job_to_send |
---|
861 | echo "# @\\\$-l${qsubtime} 10" >> $job_to_send |
---|
862 | echo "# @\\\$-l${qsubmem} 10mb" >> $job_to_send |
---|
863 | if [[ $remote_host = t3ej2 || $remote_host = t3ej5 || $remote_host = t3es ]] |
---|
864 | then |
---|
865 | echo "# @\$-l mpp_p=0" >> $job_to_send |
---|
866 | fi |
---|
867 | echo '# @\$-lF 10mb' >> $job_to_send |
---|
868 | # echo '# @\$-o /dev/null' >> $job_to_send |
---|
869 | echo '# @\$-o job_queue/last_job_transfer_protocol' >> $job_to_send |
---|
870 | echo '# @\\\$-eo' >> $job_to_send |
---|
871 | echo " " >> $job_to_send |
---|
872 | if [[ $remote_host = t3ej2 || $remote_host = t3ej5 ]] |
---|
873 | then |
---|
874 | echo "set +vx" >> $job_to_send |
---|
875 | echo ". .profile" >> $job_to_send |
---|
876 | fi |
---|
877 | echo "set -x" >> $job_to_send |
---|
878 | echo "batch_scp -d -w 10 -u $local_user $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile > /dev/null" >> $job_to_send |
---|
879 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
880 | echo "%%END%%" >> $job_to_send |
---|
881 | fi |
---|
882 | |
---|
883 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
884 | then |
---|
885 | echo "llsubmit scpjob.$kennung" >> $job_to_send |
---|
886 | elif [[ $remote_host = lctit ]] |
---|
887 | then |
---|
888 | echo "chmod u+x scpjob.$kennung" >> $job_to_send |
---|
889 | echo "rm -rf ${job_catalog}/last_job_transfer_protocol" >> $job_to_send |
---|
890 | echo "n1ge -N jobtransfer -q $return_queue -sgeout ${job_catalog}/last_job_transfer_protocol scpjob.$kennung" >> $job_to_send |
---|
891 | echo "sleep 10" >> $job_to_send |
---|
892 | elif [[ $remote_host = t3eb || $remote_host = t3eh || $remote_host = t3ej2 || $remote_host = t3ej5 ]] |
---|
893 | then |
---|
894 | echo "qsub -J n scpjob.$kennung" >> $job_to_send |
---|
895 | elif [[ $remote_host = t3es ]] |
---|
896 | then |
---|
897 | echo "qsub -J n -s /bin/ksh scpjob.$kennung" >> $job_to_send |
---|
898 | else |
---|
899 | echo "qsub scpjob.$kennung" >> $job_to_send |
---|
900 | fi |
---|
901 | echo "rm scpjob.$kennung" >> $job_to_send |
---|
902 | if [[ $remote_host = nech ]] |
---|
903 | then |
---|
904 | echo "cd -" >> $job_to_send |
---|
905 | fi |
---|
906 | else |
---|
907 | # echo "ftpcopy -d $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
908 | echo "nohup ftpcopy -d -w 15 $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile > /dev/null &" >> $job_to_send |
---|
909 | fi |
---|
910 | echo "set -x" >> $job_to_send |
---|
911 | echo " ' exit" >> $job_to_send |
---|
912 | echo "set -x" >> $job_to_send |
---|
913 | fi |
---|
914 | |
---|
915 | |
---|
916 | |
---|
917 | # EIGENTLICHE JOB-DATEI AN QSUB-KOMMANDOS ANHAENGEN |
---|
918 | cat $file_to_send >> $job_to_send |
---|
919 | |
---|
920 | if [[ $remote_host = ibm ]] |
---|
921 | then |
---|
922 | echo " " >> $job_to_send |
---|
923 | echo "exit" >> $job_to_send |
---|
924 | fi |
---|
925 | if [[ $remote_host = lctit ]] |
---|
926 | then |
---|
927 | echo " " >> $job_to_send |
---|
928 | echo "rm ~/job_queue/$job_on_remhost" >> $job_to_send |
---|
929 | fi |
---|
930 | |
---|
931 | |
---|
932 | |
---|
933 | # USER-NAME AUF ZIELRECHNER AUS .NETRC-DATEI ERMITTELN |
---|
934 | if [[ -z $remote_user ]] |
---|
935 | then |
---|
936 | if [[ $remote_host = t3eb || $remote_host = t3eh || $remote_host = t3ej2 || $remote_host = t3ej5 || $remote_host = t3es || $remote_host = vpp ]] |
---|
937 | then |
---|
938 | grep $remote_addres ~/.netrc | read dum dum dum remote_user dum dum |
---|
939 | fi |
---|
940 | fi |
---|
941 | |
---|
942 | |
---|
943 | |
---|
944 | # JOB AUF ZIELRECHNER TRANSFERIEREN BZW. INS JOBVERZEICHNIS KOPIEREN |
---|
945 | if [[ $no_submit = false ]] |
---|
946 | then |
---|
947 | if [[ $remote_host != $local_host ]] |
---|
948 | then |
---|
949 | [[ $verify = true ]] && printf "\n >>> transfering job to \"$remote_host\"..." |
---|
950 | if [[ $remote_host = ibms || $remote_host = ibmy ]] # ssh on ibms cannot handle "~/" |
---|
951 | then |
---|
952 | job_catalog_save=$job_catalog |
---|
953 | job_catalog=job_queue |
---|
954 | elif [[ $remote_host = nech ]] |
---|
955 | then |
---|
956 | job_catalog_save=$job_catalog |
---|
957 | job_catalog=/hpf/b/${remote_user}/job_queue |
---|
958 | fi |
---|
959 | if [[ $local_host = decalpha ]] |
---|
960 | then |
---|
961 | # VERWENDUNG VON SCP AUF DECALPHA FRAGT FEHLERHAFTERWEISE |
---|
962 | # PASSWORT AB |
---|
963 | /bin/scp $job_to_send ${remote_user}@${remote_addres}:${job_catalog}/$job_on_remhost |
---|
964 | elif [[ $remote_host = nech ]] |
---|
965 | then |
---|
966 | # DATEIEN KOENNEN NUR UEBER DEN ARCHIVE-SERVER DES DKRZ |
---|
967 | # TRANSFERIERT WERDEN |
---|
968 | scp $job_to_send ${remote_user}@136.172.44.205:${job_catalog}/$job_on_remhost |
---|
969 | else |
---|
970 | scp $job_to_send ${remote_user}@${remote_addres}:${job_catalog}/$job_on_remhost |
---|
971 | fi |
---|
972 | if [[ $? = 1 ]] |
---|
973 | then |
---|
974 | locat=scp; exit |
---|
975 | fi |
---|
976 | if [[ $remote_host = ibms ]] |
---|
977 | then |
---|
978 | job_catalog=$job_catalog_save |
---|
979 | fi |
---|
980 | [[ $verify = true ]] && printf "\n >>> finished\n" |
---|
981 | else |
---|
982 | eval job_catalog=$job_catalog |
---|
983 | cp $job_to_send ${job_catalog}/$job_on_remhost |
---|
984 | fi |
---|
985 | |
---|
986 | |
---|
987 | |
---|
988 | # NQS- BZW. LOADLEVELER-JOB STARTEN |
---|
989 | if [[ $remote_host != $local_host ]] |
---|
990 | then |
---|
991 | [[ $verify = true ]] && printf "\n >>> submitting job using \"qsub\"...\n" |
---|
992 | if [[ $remote_host != lctit ]] |
---|
993 | then |
---|
994 | ssh $remote_addres -l $remote_user "cd $job_catalog; $submcom $job_on_remhost; rm $job_on_remhost" |
---|
995 | else |
---|
996 | # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
997 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
998 | # UEBERGANGSWEISE CHECK, OB N1GE ENVIRONMENT WIRKLICH VERFUEGBAR |
---|
999 | print "cd $job_catalog; chmod u+x $job_on_remhost" | ssh $remote_addres -l $remote_user > /dev/null 2>&1 |
---|
1000 | echo "first try" > send_protocol |
---|
1001 | while [[ $(cat send_protocol | grep -c "Forwarding to N1GE") = 0 ]] |
---|
1002 | do |
---|
1003 | if [[ $(cat send_protocol | grep -c "first try") = 1 ]] |
---|
1004 | then |
---|
1005 | printf "\n trying to submit job to TIT cluster..." |
---|
1006 | else |
---|
1007 | printf "\n +++ failed ... trying to submit again ..." |
---|
1008 | fi |
---|
1009 | print "cd $job_catalog; $submcom $job_on_remhost" | ssh $remote_addres -l $remote_user > send_protocol 2>&1 |
---|
1010 | cat send_protocol |
---|
1011 | done |
---|
1012 | sleep 10 |
---|
1013 | print "cd $job_catalog; rm $job_on_remhost" | ssh $remote_addres -l $remote_user > /dev/null 2>&1 |
---|
1014 | echo "$submcom $job_on_remhost" |
---|
1015 | rm send_protocol |
---|
1016 | fi |
---|
1017 | |
---|
1018 | [[ $verify = true ]] && printf " >>> o.k.\n" |
---|
1019 | else |
---|
1020 | cd $job_catalog |
---|
1021 | if [[ $(echo $local_host | cut -c1-3) = ibm ]] |
---|
1022 | then |
---|
1023 | eval $submcom $job_on_remhost |
---|
1024 | elif [[ $local_host = lcfimm ]] |
---|
1025 | then |
---|
1026 | eval $submcom $job_on_remhost |
---|
1027 | echo "$submcom $job_on_remhost" |
---|
1028 | chmod u+x $job_on_remhost |
---|
1029 | elif [[ $local_host = lctit ]] |
---|
1030 | then |
---|
1031 | eval $submcom $job_on_remhost |
---|
1032 | echo "$submcom $job_on_remhost" |
---|
1033 | chmod u+x $job_on_remhost |
---|
1034 | elif [[ $local_host = nech ]] |
---|
1035 | then |
---|
1036 | if [[ $queue = default ]] |
---|
1037 | then |
---|
1038 | eval $submcom $job_on_remhost |
---|
1039 | else |
---|
1040 | eval $submcom -q $queue $job_on_remhost |
---|
1041 | fi |
---|
1042 | else |
---|
1043 | qsub $job_on_remhost |
---|
1044 | fi |
---|
1045 | # JOBFILE DARF AUF LCTIT NICHT GELOESCHT WERDEN!! GESCHIEHT ERST AM JOBENDE |
---|
1046 | [[ $local_host != lctit ]] && rm $job_on_remhost |
---|
1047 | cd - > /dev/null |
---|
1048 | fi |
---|
1049 | fi |
---|
1050 | |
---|
1051 | |
---|
1052 | |
---|
1053 | # ABSCHLUSSARBEITEN |
---|
1054 | |
---|
1055 | if [[ $no_submit = false ]] |
---|
1056 | then |
---|
1057 | rm $job_to_send |
---|
1058 | fi |
---|
1059 | [[ $verify = true ]] && printf "\n\n *** SUBJOB finished \n\n" |
---|