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