1 | #!/bin/ksh |
---|
2 | # subjob - Plot-Shellskript Version: @(#)SUBJOB 1.0 |
---|
3 | # $Id: subjob 181 2008-07-30 07:07:47Z 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 | |
---|
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=lcsgih;; |
---|
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=lcsgih;; |
---|
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) remote_addres=130.73.232.102; submcom=/opt/torque/bin/qsub;; |
---|
315 | (lcsgih) remote_addres=130.75.4.102; submcom=/opt/torque/bin/qsub;; |
---|
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 | (lctit) case $ndq in |
---|
355 | (novice|sla1|sla2|sla3|RAM64GB|RAM128GB) error=false;; |
---|
356 | (*) error=true;; |
---|
357 | esac;; |
---|
358 | (t3eb) case $ndq in |
---|
359 | (berte|p50|p100|p392|forfree|p25himem) error=false;; |
---|
360 | (*) error=true;; |
---|
361 | esac;; |
---|
362 | (t3eh) case $ndq in |
---|
363 | (para_t3e|em|k|l|lm|comp_t3e|c|p|ht) error=false;; |
---|
364 | (*) error=true;; |
---|
365 | esac;; |
---|
366 | (t3ej2|t3ej5) case $ndq in |
---|
367 | (low|normal|high) error=false;; |
---|
368 | (*) error=true;; |
---|
369 | esac;; |
---|
370 | (t3es) case $ndq in |
---|
371 | (batch|serial-4|pe4|p48|pe16|pe32|pe64|pe128) error=false;; |
---|
372 | (*) error=true;; |
---|
373 | esac;; |
---|
374 | (unics) case $ndq in |
---|
375 | (unics|ht) error=false;; |
---|
376 | (*) error=true;; |
---|
377 | esac;; |
---|
378 | esac |
---|
379 | if [[ $error = true ]] |
---|
380 | then |
---|
381 | printf "\n +++ queue \"$no_default_queue\" on host \"$remote_host\" not allowed" |
---|
382 | locat=parameter; exit |
---|
383 | else |
---|
384 | queue=$no_default_queue |
---|
385 | fi |
---|
386 | fi |
---|
387 | |
---|
388 | |
---|
389 | |
---|
390 | # KNOTENNUTZUNG IN ENTWICKLERQUEUE MUSS SHARED SEIN |
---|
391 | if [[ $node_usage != shared && $queue = cdev ]] |
---|
392 | then |
---|
393 | node_usage=shared |
---|
394 | fi |
---|
395 | |
---|
396 | |
---|
397 | |
---|
398 | # PRUEFEN DER CPU-ZEIT, ZEIT NACH STUNDEN, MINUTEN UND SEKUNDEN |
---|
399 | # AUFTEILEN |
---|
400 | done=false |
---|
401 | while [[ $done = false ]] |
---|
402 | do |
---|
403 | if (( $cputime <= 0 )) |
---|
404 | then |
---|
405 | printf "\n +++ wrong cpu-time or cpu-time missing" |
---|
406 | printf "\n >>> Please type cpu-time in seconds as INTEGER:" |
---|
407 | printf "\n >>> " |
---|
408 | read cputime 1>/dev/null 2>&1 |
---|
409 | else |
---|
410 | done=true |
---|
411 | fi |
---|
412 | done |
---|
413 | if [[ $remote_host = nech ]] |
---|
414 | then |
---|
415 | if (( tasks_per_node != 0 )) |
---|
416 | then |
---|
417 | (( cputime = cputime * tasks_per_node )) |
---|
418 | elif [[ $numprocs != 0 ]] |
---|
419 | then |
---|
420 | (( cputime = cputime * numprocs )) |
---|
421 | fi |
---|
422 | fi |
---|
423 | (( stunden = cputime / 3600 )) |
---|
424 | (( resttime = cputime - stunden * 3600 )) |
---|
425 | (( minuten = resttime / 60 )) |
---|
426 | (( sekunden = resttime - minuten * 60 )) |
---|
427 | timestring=${stunden}:${minuten}:${sekunden} |
---|
428 | |
---|
429 | |
---|
430 | |
---|
431 | # PRUEFEN DER KERNSPEICHERANFORDERUNG |
---|
432 | done=false |
---|
433 | while [[ $done = false ]] |
---|
434 | do |
---|
435 | if (( memory <= 0 )) |
---|
436 | then |
---|
437 | printf "\n +++ wrong memory demand or memory demand missing" |
---|
438 | printf "\n >>> Please type memory in MByte per process as INTEGER:" |
---|
439 | printf "\n >>> " |
---|
440 | read memory 1>/dev/null 2>&1 |
---|
441 | else |
---|
442 | done=true |
---|
443 | fi |
---|
444 | done |
---|
445 | |
---|
446 | if [[ $remote_host = nech || $remote_host = neck ]] |
---|
447 | then |
---|
448 | if (( tasks_per_node != 0 )) |
---|
449 | then |
---|
450 | (( Memory = memory * tasks_per_node / 1000 )) |
---|
451 | elif [[ $numprocs != 0 ]] |
---|
452 | then |
---|
453 | (( Memory = memory * numprocs / 1000 )) |
---|
454 | else |
---|
455 | (( Memory = memory / 1000 )) |
---|
456 | fi |
---|
457 | fi |
---|
458 | |
---|
459 | |
---|
460 | # SPEICHERBERECHNUNG BEI OPENMP-NUTZUNG |
---|
461 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
462 | then |
---|
463 | (( memory = memory * threads_per_task )) |
---|
464 | fi |
---|
465 | |
---|
466 | |
---|
467 | # BERECHNUNG DER ANZAHL DER ZU VERWENDENDEN KNOTEN |
---|
468 | if (( tasks_per_node != 0 )) |
---|
469 | then |
---|
470 | (( nodes = numprocs / ( tasks_per_node * threads_per_task ) )) |
---|
471 | fi |
---|
472 | |
---|
473 | |
---|
474 | |
---|
475 | # HEADER-AUSGABE |
---|
476 | if [[ $verify = true ]] |
---|
477 | then |
---|
478 | printf "\n\n" |
---|
479 | printf "#--------------------------------------------------------------# \n" |
---|
480 | spalte1=SUBJOB;spalte2=$(date) |
---|
481 | printf "| $spalte1$spalte2 | \n" |
---|
482 | printf "| | \n" |
---|
483 | printf "| values of parameters/options: | \n" |
---|
484 | spalte1=local_host$punkte; spalte2=$punkte$local_host |
---|
485 | printf "| $spalte1$spalte2 | \n" |
---|
486 | spalte1=remote_host$punkte; spalte2=$punkte$remote_host |
---|
487 | printf "| $spalte1$spalte2 | \n" |
---|
488 | spalte1=queue$punkte; spalte2=$punkte$queue |
---|
489 | printf "| $spalte1$spalte2 | \n" |
---|
490 | spalte1=memory$punkte; spalte2="$punkte$memory mb" |
---|
491 | printf "| $spalte1$spalte2 | \n" |
---|
492 | spalte1=cputime$punkte; spalte2="$punkte$cputime sec" |
---|
493 | printf "| $spalte1$spalte2 | \n" |
---|
494 | spalte1=job_name$punkte; spalte2="$punkte$job_name" |
---|
495 | printf "| $spalte1$spalte2 | \n" |
---|
496 | printf "#--------------------------------------------------------------# \n\n" |
---|
497 | |
---|
498 | |
---|
499 | # KONTROLLABFRAGE, OB ALLES O.K. |
---|
500 | antwort="dummy" |
---|
501 | while [[ $antwort != y && $antwort != Y && $antwort != n && $antwort != N ]] |
---|
502 | do |
---|
503 | read antwort?" >>> continue (y/n) ? " |
---|
504 | done |
---|
505 | if [[ $antwort = n || $antwort = N ]] |
---|
506 | then |
---|
507 | locat=verify; exit |
---|
508 | fi |
---|
509 | printf "\n" |
---|
510 | fi |
---|
511 | |
---|
512 | |
---|
513 | |
---|
514 | # ZUFALLSKENNUNG GENERIEREN UND JOBNAMEN AUF ZIELRECHNER BESTIMMEN |
---|
515 | kennung=$RANDOM |
---|
516 | job_on_remhost=${job_name}_${kennung}_$local_host |
---|
517 | job_to_send=job_to_send_$kennung |
---|
518 | if [[ $delete_dayfile = false ]] |
---|
519 | then |
---|
520 | remote_dayfile=${local_host}_${job_name}_result_$kennung |
---|
521 | local_dayfile=${remote_host}_${job_name} |
---|
522 | else |
---|
523 | remote_dayfile=/dev/null |
---|
524 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
525 | then |
---|
526 | notification='# @ notification = never' |
---|
527 | fi |
---|
528 | fi |
---|
529 | |
---|
530 | |
---|
531 | |
---|
532 | # QSUB- ODER LL-KOMMANDOS BZW. SKRIPTE GENERIEREN |
---|
533 | if [[ $(echo $remote_host | cut -c1-3) = ibm && $numprocs != 0 ]] |
---|
534 | then |
---|
535 | |
---|
536 | if [[ $remote_host = ibmy ]] |
---|
537 | then |
---|
538 | consumable_memory="" |
---|
539 | else |
---|
540 | consumable_memory="ConsumableMemory($memory mb)" |
---|
541 | fi |
---|
542 | if [[ $queue = cdev ]] |
---|
543 | then |
---|
544 | data_limit="# @ data_limit = 1.76gb" |
---|
545 | network_to_use="# @ network.mpi = sn_all,shared,ip" |
---|
546 | else |
---|
547 | if [[ $remote_host = ibms ]] |
---|
548 | then |
---|
549 | network_to_use="# @ network.mpi = csss,shared,us" |
---|
550 | elif [[ $remote_host = ibmy ]] |
---|
551 | then |
---|
552 | network_to_use="" |
---|
553 | else |
---|
554 | network_to_use="# @ network.mpi = sn_all,shared,us" |
---|
555 | data_limit="# @ data_limit = 1.76gb" |
---|
556 | fi |
---|
557 | fi |
---|
558 | |
---|
559 | cat > $job_to_send << %%END%% |
---|
560 | #!/bin/ksh |
---|
561 | |
---|
562 | # @ job_type = parallel |
---|
563 | # @ job_name = palm |
---|
564 | # @ wall_clock_limit = ${timestring},$timestring |
---|
565 | # @ resources = ConsumableCpus($threads_per_task) $consumable_memory |
---|
566 | # @ output = $remote_dayfile |
---|
567 | # @ error = $remote_dayfile |
---|
568 | # @ image_size = 50 |
---|
569 | # @ class = $queue |
---|
570 | # @ environment = OMP_NUM_THREADS=$threads_per_task; MP_SHARED_MEMORY=yes |
---|
571 | $network_to_use |
---|
572 | $data_limit |
---|
573 | $notification |
---|
574 | |
---|
575 | %%END%% |
---|
576 | |
---|
577 | if (( nodes > 0 )) |
---|
578 | then |
---|
579 | |
---|
580 | cat >> $job_to_send << %%END%% |
---|
581 | # @ node = $nodes |
---|
582 | # @ tasks_per_node = $tasks_per_node |
---|
583 | # @ node_usage = $node_usage |
---|
584 | # @ queue |
---|
585 | |
---|
586 | %%END%% |
---|
587 | |
---|
588 | else |
---|
589 | |
---|
590 | if [[ $remote_host != ibmy ]] |
---|
591 | then |
---|
592 | |
---|
593 | cat >> $job_to_send << %%END%% |
---|
594 | # @ blocking = unlimited |
---|
595 | # @ total_tasks = $numprocs |
---|
596 | # @ node_usage = $node_usage |
---|
597 | # @ queue |
---|
598 | |
---|
599 | %%END%% |
---|
600 | |
---|
601 | else |
---|
602 | |
---|
603 | cat >> $job_to_send << %%END%% |
---|
604 | # @ node = 1 |
---|
605 | # @ total_tasks = $numprocs |
---|
606 | # @ queue |
---|
607 | |
---|
608 | %%END%% |
---|
609 | |
---|
610 | fi |
---|
611 | |
---|
612 | fi |
---|
613 | |
---|
614 | elif [[ $(echo $remote_host | cut -c1-3) = ibm && $numprocs = 0 ]] |
---|
615 | then |
---|
616 | |
---|
617 | cat > $job_to_send << %%END%% |
---|
618 | #!/bin/ksh |
---|
619 | |
---|
620 | # @ job_type = serial |
---|
621 | # @ node_usage = $node_usage |
---|
622 | # @ job_name = palm |
---|
623 | # @ wall_clock_limit = ${timestring},$timestring |
---|
624 | # @ resources = ConsumableCpus(1) ConsumableMemory(1 gb) |
---|
625 | # @ output = $remote_dayfile |
---|
626 | # @ error = $remote_dayfile |
---|
627 | # @ class = $queue |
---|
628 | $notification |
---|
629 | |
---|
630 | # @ queue |
---|
631 | |
---|
632 | %%END%% |
---|
633 | |
---|
634 | elif [[ $remote_host = lcfimm ]] |
---|
635 | then |
---|
636 | |
---|
637 | if [[ $numprocs != 0 ]] |
---|
638 | then |
---|
639 | cat > $job_to_send << %%END%% |
---|
640 | #!/bin/ksh |
---|
641 | #PBS -N $job_name |
---|
642 | #PBS -A nersc |
---|
643 | #PBS -l walltime=$timestring |
---|
644 | #PBS -l nodes=${nodes}:ppn=$tasks_per_node |
---|
645 | #PBS -l pmem=${memory}mb |
---|
646 | #PBS -m abe |
---|
647 | #PBS -M igore@nersc.no |
---|
648 | #PBS -o $remote_dayfile |
---|
649 | #PBS -j oe |
---|
650 | mpd & |
---|
651 | |
---|
652 | %%END%% |
---|
653 | |
---|
654 | else |
---|
655 | cat > $job_to_send << %%END%% |
---|
656 | #!/bin/ksh |
---|
657 | #PBS -N $job_name |
---|
658 | #PBS -A nersc |
---|
659 | #PBS -l walltime=$timestring |
---|
660 | #PBS -l ncpus=1 |
---|
661 | #PBS -l pmem=${memory}mb |
---|
662 | #PBS -m abe |
---|
663 | #PBS -M igore@nersc.no |
---|
664 | #PBS -o $remote_dayfile |
---|
665 | #PBS -j oe |
---|
666 | |
---|
667 | %%END%% |
---|
668 | |
---|
669 | fi |
---|
670 | |
---|
671 | elif [[ $remote_host = lcsgih || $remote_host = lcsgib ]] |
---|
672 | then |
---|
673 | |
---|
674 | if [[ $numprocs != 0 ]] |
---|
675 | then |
---|
676 | cat > $job_to_send << %%END%% |
---|
677 | #!/bin/bash |
---|
678 | #PBS -N $job_name |
---|
679 | #PBS -l walltime=$timestring |
---|
680 | #PBS -l nodes=$nodes:ppn=${tasks_per_node} |
---|
681 | #PBS -l feature=$sgi_feature |
---|
682 | #PBS -l naccesspolicy=$node_usage |
---|
683 | #PBS -o $remote_dayfile |
---|
684 | #PBS -j oe |
---|
685 | |
---|
686 | . /usr/share/modules/init/bash |
---|
687 | module load mvapich/mvapich-0.9.9-intel |
---|
688 | # module load mvapich2/1.2-intel |
---|
689 | module load netcdf |
---|
690 | 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 |
---|
691 | echo ld_library_path=\$LD_LIBRARY_PATH |
---|
692 | |
---|
693 | %%END%% |
---|
694 | |
---|
695 | else |
---|
696 | cat > $job_to_send << %%END%% |
---|
697 | #PBS -S /bin/bash |
---|
698 | #PBS -N $job_name |
---|
699 | #PBS -l walltime=$timestring |
---|
700 | #PBS -l ncpus=1 |
---|
701 | #PBS -o $remote_dayfile |
---|
702 | #PBS -e $remote_dayfile |
---|
703 | |
---|
704 | %%END%% |
---|
705 | |
---|
706 | fi |
---|
707 | |
---|
708 | elif [[ $remote_host = lcxt4 ]] |
---|
709 | then |
---|
710 | |
---|
711 | if [[ $numprocs != 0 ]] |
---|
712 | then |
---|
713 | cat > $job_to_send << %%END%% |
---|
714 | #!/bin/ksh |
---|
715 | #PBS -S /bin/ksh |
---|
716 | #PBS -N $job_name |
---|
717 | #PBS -A nersc |
---|
718 | #PBS -l walltime=$timestring |
---|
719 | #PBS -l mppwidth=${numprocs} |
---|
720 | #PBS -l mppnppn=${tasks_per_node} |
---|
721 | #PBS -m abe |
---|
722 | #PBS -M igore@nersc.no |
---|
723 | #PBS -o $remote_dayfile |
---|
724 | #PBS -e $remote_dayfile |
---|
725 | |
---|
726 | %%END%% |
---|
727 | |
---|
728 | else |
---|
729 | cat > $job_to_send << %%END%% |
---|
730 | #!/bin/ksh |
---|
731 | #PBS -S /bin/ksh |
---|
732 | #PBS -N $job_name |
---|
733 | #PBS -A nersc |
---|
734 | #PBS -l walltime=$timestring |
---|
735 | #PBS -l ncpus=1 |
---|
736 | #PBS -l pmem=${memory}mb |
---|
737 | #PBS -m abe |
---|
738 | #PBS -M igore@nersc.no |
---|
739 | #PBS -o $remote_dayfile |
---|
740 | #PBS -e $remote_dayfile |
---|
741 | |
---|
742 | %%END%% |
---|
743 | |
---|
744 | fi |
---|
745 | |
---|
746 | elif [[ $remote_host = nech ]] |
---|
747 | then |
---|
748 | |
---|
749 | if (( nodes > 1 )) |
---|
750 | then |
---|
751 | cat > $job_to_send << %%END%% |
---|
752 | #!/bin/ksh |
---|
753 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
754 | #PBS -l ${qsubmem}=${Memory}gb |
---|
755 | #PBS -b $nodes |
---|
756 | #PBS -o $remote_dayfile |
---|
757 | #PBS -N palm |
---|
758 | #PBS -j o |
---|
759 | #PBS -T mpisx |
---|
760 | |
---|
761 | %%END%% |
---|
762 | |
---|
763 | elif [[ $numprocs != 0 ]] |
---|
764 | then |
---|
765 | cat > $job_to_send << %%END%% |
---|
766 | #!/bin/ksh |
---|
767 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
768 | #PBS -l ${qsubmem}=${Memory}gb |
---|
769 | #PBS -o $remote_dayfile |
---|
770 | #PBS -N palm |
---|
771 | #PBS -j o |
---|
772 | |
---|
773 | %%END%% |
---|
774 | |
---|
775 | else |
---|
776 | cat > $job_to_send << %%END%% |
---|
777 | #!/bin/ksh |
---|
778 | #PBS -l ${qsubmem}=${Memory}gb,${qsubtime}=$cputime |
---|
779 | #PBS -o $remote_dayfile |
---|
780 | #PBS -j o |
---|
781 | |
---|
782 | %%END%% |
---|
783 | |
---|
784 | fi |
---|
785 | |
---|
786 | elif [[ $remote_host = neck ]] |
---|
787 | then |
---|
788 | |
---|
789 | if (( nodes > 1 )) |
---|
790 | then |
---|
791 | cat > $job_to_send << %%END%% |
---|
792 | #!/bin/ksh |
---|
793 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
794 | #PBS -l ${qsubmem}=${Memory}gb |
---|
795 | #PBS -b $nodes |
---|
796 | #PBS -o $remote_dayfile |
---|
797 | #PBS -N palm |
---|
798 | #PBS -j o |
---|
799 | #PBS -T mpisx |
---|
800 | |
---|
801 | %%END%% |
---|
802 | |
---|
803 | elif [[ $numprocs != 0 ]] |
---|
804 | then |
---|
805 | cat > $job_to_send << %%END%% |
---|
806 | #!/bin/ksh |
---|
807 | #PBS -q ${queue} |
---|
808 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
809 | #PBS -l ${qsubmem}=${Memory}gb |
---|
810 | #PBS -o $remote_dayfile |
---|
811 | #PBS -N palm |
---|
812 | #PBS -j o |
---|
813 | #PBS -T mpisx |
---|
814 | |
---|
815 | %%END%% |
---|
816 | |
---|
817 | else |
---|
818 | cat > $job_to_send << %%END%% |
---|
819 | #!/bin/ksh |
---|
820 | #PBS -l ${qsubmem}=${Memory}gb,${qsubtime}=$cputime |
---|
821 | #PBS -o $remote_dayfile |
---|
822 | #PBS -j o |
---|
823 | |
---|
824 | %%END%% |
---|
825 | |
---|
826 | fi |
---|
827 | |
---|
828 | elif [[ $remote_host = lctit ]] |
---|
829 | then |
---|
830 | cat > $job_to_send << %%END%% |
---|
831 | #!/bin/bash |
---|
832 | #$ -S /bin/bash |
---|
833 | cd $job_catalog |
---|
834 | export PATH=$PALM_BIN:\$PATH |
---|
835 | echo \$PATH |
---|
836 | |
---|
837 | %%END%% |
---|
838 | |
---|
839 | # OPTIONEN FUER SUBMIT-KOMMANDO ZUSAMMENSTELLEN |
---|
840 | # submcom="$submcom -N $job_name -sgeout $remote_dayfile -q default" |
---|
841 | submcom="$submcom -g $group_number -N $job_name -rt 4320 -sgeout $remote_dayfile -q $node_usage " |
---|
842 | |
---|
843 | else |
---|
844 | |
---|
845 | cat > $job_to_send << %%END%% |
---|
846 | # @\$-q ${queue} |
---|
847 | # @\$-l${qsubtime} $timestring |
---|
848 | # @\$-l${qsubmem} ${memory}mb |
---|
849 | # @\$-o $remote_dayfile |
---|
850 | # @\$-eo |
---|
851 | |
---|
852 | %%END%% |
---|
853 | |
---|
854 | fi |
---|
855 | |
---|
856 | |
---|
857 | # BEI RECHNUNG AUF REMOTE-MASCHINEN RUECKTRANSFER DES DAYFILES PER TRAP |
---|
858 | # BEI EXIT VERANLASSEN |
---|
859 | # VEKTORRECHNER MUSS EIGENEN JOB STARTEN, DA DORT NOHUP NICHT FUNKTIONIERT |
---|
860 | # AUF IBM IN SEOUL IST RUECKTRANSFER ZUR ZEIT GENERELL NICHT MOEGLICH |
---|
861 | if [[ $delete_dayfile = false && $remote_host != $local_host ]] |
---|
862 | then |
---|
863 | echo "set +vx" >> $job_to_send |
---|
864 | echo "trap '" >> $job_to_send |
---|
865 | echo "set +vx" >> $job_to_send |
---|
866 | 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 ]] |
---|
867 | then |
---|
868 | if [[ $remote_host = ibmb || $remote_host = ibmh ]] |
---|
869 | then |
---|
870 | return_queue=c1 |
---|
871 | elif [[ $remote_host = ibms ]] |
---|
872 | then |
---|
873 | return_queue=p_normal |
---|
874 | elif [[ $remote_host = ibmy ]] |
---|
875 | then |
---|
876 | return_queue=serial |
---|
877 | elif [[ $remote_host = lctit ]] |
---|
878 | then |
---|
879 | return_queue=sla3 |
---|
880 | elif [[ $remote_host = neck ]] |
---|
881 | then |
---|
882 | return_queue=S |
---|
883 | else |
---|
884 | return_queue=unknown |
---|
885 | fi |
---|
886 | |
---|
887 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
888 | then |
---|
889 | |
---|
890 | echo "echo \"#!/bin/ksh\" >> scpjob.$kennung" >> $job_to_send |
---|
891 | echo "echo \"# @ job_type = serial\" >> scpjob.$kennung" >> $job_to_send |
---|
892 | echo "echo \"# @ job_name = transfer\" >> scpjob.$kennung" >> $job_to_send |
---|
893 | echo "echo \"# @ resources = ConsumableCpus(1) ConsumableMemory(1 gb)\" >> scpjob.$kennung" >> $job_to_send |
---|
894 | echo "echo \"# @ wall_clock_limit = 00:10:00,00:10:00\" >> scpjob.$kennung " >> $job_to_send |
---|
895 | echo "echo \"# @ output = job_queue/last_job_transfer_protocol\" >> scpjob.$kennung" >> $job_to_send |
---|
896 | echo "echo \"# @ error = job_queue/last_job_transfer_protocol\" >> scpjob.$kennung" >> $job_to_send |
---|
897 | echo "echo \"# @ class = $return_queue\" >> scpjob.$kennung" >> $job_to_send |
---|
898 | echo "echo \"# @ image_size = 10\" >> scpjob.$kennung" >> $job_to_send |
---|
899 | echo "echo \"# @ notification = never\" >> scpjob.$kennung" >> $job_to_send |
---|
900 | |
---|
901 | echo "echo \"# @ queue\" >> scpjob.$kennung" >> $job_to_send |
---|
902 | echo "echo \" \" >> scpjob.$kennung" >> $job_to_send |
---|
903 | |
---|
904 | echo "echo \"set -x\" >> scpjob.$kennung" >> $job_to_send |
---|
905 | 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 |
---|
906 | echo "echo \"exit\" >> scpjob.$kennung" >> $job_to_send |
---|
907 | |
---|
908 | elif [[ $remote_host = nech ]] |
---|
909 | then |
---|
910 | echo "cd /pf/b/${remote_user}/job_queue" >> $job_to_send |
---|
911 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
912 | echo "#PBS -l ${qsubmem}=1GB,${qsubtime}=100" >> $job_to_send |
---|
913 | echo "#PBS -o last_job_transfer_protocol" >> $job_to_send |
---|
914 | echo "#PBS -j o" >> $job_to_send |
---|
915 | echo " " >> $job_to_send |
---|
916 | echo "set -x" >> $job_to_send |
---|
917 | echo "cd /pf/b/${remote_user}/job_queue" >> $job_to_send |
---|
918 | echo "batch_scp -d -w 10 -u $local_user $local_addres $remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
919 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
920 | echo "%%END%%" >> $job_to_send |
---|
921 | |
---|
922 | elif [[ $remote_host = neck ]] |
---|
923 | then |
---|
924 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
925 | echo "#PBS -q $return_queue" >> $job_to_send |
---|
926 | echo "#PBS -l ${qsubmem}=1GB,${qsubtime}=100" >> $job_to_send |
---|
927 | echo "#PBS -o last_job_transfer_protocol" >> $job_to_send |
---|
928 | echo "#PBS -j o" >> $job_to_send |
---|
929 | echo " " >> $job_to_send |
---|
930 | echo "set -x" >> $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 [[ $(echo $remote_host | cut -c1-5) = lcsgi ]] |
---|
936 | then |
---|
937 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
938 | echo "#!/bin/bash" >> $job_to_send |
---|
939 | echo "#PBS -N job_protocol_transfer" >> $job_to_send |
---|
940 | echo "#PBS -l walltime=00:02:00" >> $job_to_send |
---|
941 | echo "#PBS -l nodes=1:ppn=1" >> $job_to_send |
---|
942 | echo "#PBS -l feature=xe" >> $job_to_send |
---|
943 | echo "#PBS -l naccesspolicy=shared" >> $job_to_send |
---|
944 | echo "#PBS -o \$HOME/job_queue/last_job_transfer_protocol" >> $job_to_send |
---|
945 | echo "#PBS -j oe" >> $job_to_send |
---|
946 | echo " " >> $job_to_send |
---|
947 | echo ". /usr/share/modules/init/bash" >> $job_to_send |
---|
948 | echo "set -x" >> $job_to_send |
---|
949 | echo "batch_scp -d -w 10 -u $local_user $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
950 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
951 | echo "%%END%%" >> $job_to_send |
---|
952 | |
---|
953 | elif [[ $remote_host = lctit ]] |
---|
954 | then |
---|
955 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
956 | echo "set -x" >> $job_to_send |
---|
957 | echo "PATH=\$PATH:$job_catalog/../pub" >> $job_to_send |
---|
958 | echo "cd $job_catalog" >> $job_to_send |
---|
959 | echo "batch_scp -d -w 10 -u $local_user $local_addres $remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
960 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
961 | echo "%%END%%" >> $job_to_send |
---|
962 | |
---|
963 | else |
---|
964 | |
---|
965 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
966 | echo "# @\\\$-q $return_queue" >> $job_to_send |
---|
967 | echo "# @\\\$-l${qsubtime} 10" >> $job_to_send |
---|
968 | echo "# @\\\$-l${qsubmem} 10mb" >> $job_to_send |
---|
969 | if [[ $remote_host = t3ej2 || $remote_host = t3ej5 || $remote_host = t3es ]] |
---|
970 | then |
---|
971 | echo "# @\$-l mpp_p=0" >> $job_to_send |
---|
972 | fi |
---|
973 | echo '# @\$-lF 10mb' >> $job_to_send |
---|
974 | # echo '# @\$-o /dev/null' >> $job_to_send |
---|
975 | echo '# @\$-o job_queue/last_job_transfer_protocol' >> $job_to_send |
---|
976 | echo '# @\\\$-eo' >> $job_to_send |
---|
977 | echo " " >> $job_to_send |
---|
978 | if [[ $remote_host = t3ej2 || $remote_host = t3ej5 ]] |
---|
979 | then |
---|
980 | echo "set +vx" >> $job_to_send |
---|
981 | echo ". .profile" >> $job_to_send |
---|
982 | fi |
---|
983 | echo "set -x" >> $job_to_send |
---|
984 | echo "batch_scp -d -w 10 -u $local_user $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile > /dev/null" >> $job_to_send |
---|
985 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
986 | echo "%%END%%" >> $job_to_send |
---|
987 | fi |
---|
988 | |
---|
989 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
990 | then |
---|
991 | echo "llsubmit scpjob.$kennung" >> $job_to_send |
---|
992 | elif [[ $(echo $remote_host | cut -c1-5) = lcsgi ]] |
---|
993 | then |
---|
994 | echo "chmod u+x scpjob.$kennung" >> $job_to_send |
---|
995 | echo "msub scpjob.$kennung" >> $job_to_send |
---|
996 | elif [[ $remote_host = lctit ]] |
---|
997 | then |
---|
998 | echo "chmod u+x scpjob.$kennung" >> $job_to_send |
---|
999 | echo "rm -rf ${job_catalog}/last_job_transfer_protocol" >> $job_to_send |
---|
1000 | echo "n1ge -N jobtransfer -q $return_queue -sgeout ${job_catalog}/last_job_transfer_protocol scpjob.$kennung" >> $job_to_send |
---|
1001 | echo "sleep 10" >> $job_to_send |
---|
1002 | elif [[ $remote_host = t3eb || $remote_host = t3eh || $remote_host = t3ej2 || $remote_host = t3ej5 ]] |
---|
1003 | then |
---|
1004 | echo "qsub -J n scpjob.$kennung" >> $job_to_send |
---|
1005 | elif [[ $remote_host = t3es ]] |
---|
1006 | then |
---|
1007 | echo "qsub -J n -s /bin/ksh scpjob.$kennung" >> $job_to_send |
---|
1008 | else |
---|
1009 | echo "qsub scpjob.$kennung" >> $job_to_send |
---|
1010 | fi |
---|
1011 | echo "rm scpjob.$kennung" >> $job_to_send |
---|
1012 | if [[ $remote_host = nech ]] |
---|
1013 | then |
---|
1014 | echo "cd -" >> $job_to_send |
---|
1015 | fi |
---|
1016 | else |
---|
1017 | # echo "ftpcopy -d $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
1018 | echo "nohup ftpcopy -d -w 15 $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile > /dev/null &" >> $job_to_send |
---|
1019 | fi |
---|
1020 | echo "set -x" >> $job_to_send |
---|
1021 | echo " ' exit" >> $job_to_send |
---|
1022 | echo "set -x" >> $job_to_send |
---|
1023 | fi |
---|
1024 | |
---|
1025 | |
---|
1026 | |
---|
1027 | # EIGENTLICHE JOB-DATEI AN QSUB-KOMMANDOS ANHAENGEN |
---|
1028 | cat $file_to_send >> $job_to_send |
---|
1029 | |
---|
1030 | if [[ $remote_host = ibm ]] |
---|
1031 | then |
---|
1032 | echo " " >> $job_to_send |
---|
1033 | echo "exit" >> $job_to_send |
---|
1034 | fi |
---|
1035 | if [[ $remote_host = lctit ]] |
---|
1036 | then |
---|
1037 | echo " " >> $job_to_send |
---|
1038 | echo "rm ~/job_queue/$job_on_remhost" >> $job_to_send |
---|
1039 | fi |
---|
1040 | |
---|
1041 | |
---|
1042 | |
---|
1043 | # USER-NAME AUF ZIELRECHNER AUS .NETRC-DATEI ERMITTELN |
---|
1044 | if [[ -z $remote_user ]] |
---|
1045 | then |
---|
1046 | if [[ $remote_host = t3eb || $remote_host = t3eh || $remote_host = t3ej2 || $remote_host = t3ej5 || $remote_host = t3es || $remote_host = vpp ]] |
---|
1047 | then |
---|
1048 | grep $remote_addres ~/.netrc | read dum dum dum remote_user dum dum |
---|
1049 | fi |
---|
1050 | fi |
---|
1051 | |
---|
1052 | |
---|
1053 | |
---|
1054 | # JOB AUF ZIELRECHNER TRANSFERIEREN BZW. INS JOBVERZEICHNIS KOPIEREN |
---|
1055 | if [[ $no_submit = false ]] |
---|
1056 | then |
---|
1057 | if [[ $remote_host != $local_host ]] |
---|
1058 | then |
---|
1059 | [[ $verify = true ]] && printf "\n >>> transfering job to \"$remote_host\"..." |
---|
1060 | if [[ $remote_host = ibms || $remote_host = ibmy ]] # ssh on ibms cannot handle "~/" |
---|
1061 | then |
---|
1062 | job_catalog_save=$job_catalog |
---|
1063 | job_catalog=job_queue |
---|
1064 | elif [[ $remote_host = nech ]] |
---|
1065 | then |
---|
1066 | job_catalog_save=$job_catalog |
---|
1067 | job_catalog=/hpf/b/${remote_user}/job_queue |
---|
1068 | fi |
---|
1069 | if [[ $local_host = decalpha ]] |
---|
1070 | then |
---|
1071 | # VERWENDUNG VON SCP AUF DECALPHA FRAGT FEHLERHAFTERWEISE |
---|
1072 | # PASSWORT AB |
---|
1073 | /bin/scp $job_to_send ${remote_user}@${remote_addres}:${job_catalog}/$job_on_remhost |
---|
1074 | elif [[ $remote_host = nech ]] |
---|
1075 | then |
---|
1076 | # DATEIEN KOENNEN NUR UEBER DEN ARCHIVE-SERVER DES DKRZ |
---|
1077 | # TRANSFERIERT WERDEN |
---|
1078 | scp $job_to_send ${remote_user}@136.172.44.205:${job_catalog}/$job_on_remhost |
---|
1079 | else |
---|
1080 | scp $job_to_send ${remote_user}@${remote_addres}:${job_catalog}/$job_on_remhost |
---|
1081 | fi |
---|
1082 | if [[ $? = 1 ]] |
---|
1083 | then |
---|
1084 | locat=scp; exit |
---|
1085 | fi |
---|
1086 | if [[ $remote_host = ibms ]] |
---|
1087 | then |
---|
1088 | job_catalog=$job_catalog_save |
---|
1089 | fi |
---|
1090 | [[ $verify = true ]] && printf "\n >>> finished\n" |
---|
1091 | else |
---|
1092 | eval job_catalog=$job_catalog |
---|
1093 | cp $job_to_send ${job_catalog}/$job_on_remhost |
---|
1094 | fi |
---|
1095 | |
---|
1096 | |
---|
1097 | |
---|
1098 | # NQS- BZW. LOADLEVELER-JOB STARTEN |
---|
1099 | if [[ $remote_host != $local_host ]] |
---|
1100 | then |
---|
1101 | [[ $verify = true ]] && printf "\n >>> submitting job using \"qsub\"...\n" |
---|
1102 | if [[ $remote_host != lctit ]] |
---|
1103 | then |
---|
1104 | ssh $remote_addres -l $remote_user "cd $job_catalog; $submcom $job_on_remhost; rm $job_on_remhost" |
---|
1105 | else |
---|
1106 | # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
1107 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
1108 | # UEBERGANGSWEISE CHECK, OB N1GE ENVIRONMENT WIRKLICH VERFUEGBAR |
---|
1109 | print "cd $job_catalog; chmod u+x $job_on_remhost" | ssh $remote_addres -l $remote_user > /dev/null 2>&1 |
---|
1110 | echo "first try" > send_protocol |
---|
1111 | while [[ $(cat send_protocol | grep -c "Forwarding to N1GE") = 0 ]] |
---|
1112 | do |
---|
1113 | if [[ $(cat send_protocol | grep -c "first try") = 1 ]] |
---|
1114 | then |
---|
1115 | printf "\n trying to submit job to TIT cluster..." |
---|
1116 | else |
---|
1117 | printf "\n +++ failed ... trying to submit again ..." |
---|
1118 | fi |
---|
1119 | print "cd $job_catalog; $submcom $job_on_remhost" | ssh $remote_addres -l $remote_user > send_protocol 2>&1 |
---|
1120 | cat send_protocol |
---|
1121 | done |
---|
1122 | sleep 10 |
---|
1123 | print "cd $job_catalog; rm $job_on_remhost" | ssh $remote_addres -l $remote_user > /dev/null 2>&1 |
---|
1124 | echo "$submcom $job_on_remhost" |
---|
1125 | rm send_protocol |
---|
1126 | fi |
---|
1127 | |
---|
1128 | [[ $verify = true ]] && printf " >>> o.k.\n" |
---|
1129 | else |
---|
1130 | cd $job_catalog |
---|
1131 | if [[ $(echo $local_host | cut -c1-3) = ibm ]] |
---|
1132 | then |
---|
1133 | eval $submcom $job_on_remhost |
---|
1134 | elif [[ $local_host = lcfimm || $local_host = lctit || $localhost = lcxt4 ]] |
---|
1135 | then |
---|
1136 | eval $submcom $job_on_remhost |
---|
1137 | echo "$submcom $job_on_remhost" |
---|
1138 | chmod u+x $job_on_remhost |
---|
1139 | elif [[ $local_host = nech ]] |
---|
1140 | then |
---|
1141 | if [[ $queue = default ]] |
---|
1142 | then |
---|
1143 | eval $submcom $job_on_remhost |
---|
1144 | else |
---|
1145 | eval $submcom -q $queue $job_on_remhost |
---|
1146 | fi |
---|
1147 | else |
---|
1148 | qsub $job_on_remhost |
---|
1149 | fi |
---|
1150 | # JOBFILE DARF AUF LCTIT NICHT GELOESCHT WERDEN!! GESCHIEHT ERST AM JOBENDE |
---|
1151 | [[ $local_host != lctit ]] && rm $job_on_remhost |
---|
1152 | cd - > /dev/null |
---|
1153 | fi |
---|
1154 | fi |
---|
1155 | |
---|
1156 | |
---|
1157 | |
---|
1158 | # ABSCHLUSSARBEITEN |
---|
1159 | |
---|
1160 | if [[ $no_submit = false ]] |
---|
1161 | then |
---|
1162 | rm $job_to_send |
---|
1163 | fi |
---|
1164 | [[ $verify = true ]] && printf "\n\n *** SUBJOB finished \n\n" |
---|