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