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