source: palm/trunk/SCRIPTS/subjob @ 1046

Last change on this file since 1046 was 1046, checked in by maronga, 11 years ago

put scripts and utilities under GPL

  • Property svn:keywords set to Id Rev
File size: 52.9 KB
Line 
1#!/bin/ksh
2#--------------------------------------------------------------------------------#
3# This file is part of PALM.
4#
5# PALM is free software: you can redistribute it and/or modify it under the terms
6# of the GNU General Public License as published by the Free Software Foundation,
7# either version 3 of the License, or (at your option) any later version.
8#
9# PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License along with
14# PALM. If not, see <http://www.gnu.org/licenses/>.
15#
16# Copyright 1997-2012  Leibniz University Hannover
17#--------------------------------------------------------------------------------#
18#
19# Current revisions:
20# -----------------
21# code put under GPL (PALM 3.9)
22#
23# Former revisions:
24# -----------------
25# $Id: subjob 1046 2012-11-09 14:38:45Z maronga $
26
27# subjob - Plot-Shellskript         Version:  @(#)SUBJOB 1.0
28     # Prozedur zum automatischen Generieren von Batch-Jobs, die unter NQS
29     # laufen sollen und deren Ergebnis (Dayfile) zum Job-generierenden
30     # Host zurueckgeschickt werden sollen
31
32
33     # letzte Aenderung:
34     # 29/06/94 - Siggi - Beginn mit Erstellung der Originalversion
35     # 08/07/94 - Siggi - Originalversion abgeschlossen (Version 1.0)
36     # 06/02/98 - Siggi - berte validiert
37     # 27/01/01 - Siggi - ground.yonsei.ac.kr validiert, Jobs zur T3E in Korea
38     #                    moeglich
39     # 08/02/01 - Siggi - alle subjob-Meldungen ins englische uebersetzt
40     # 25/05/02 - Siggi - Unterstuetzung des LoadLeveler
41     # 30/05/02 - Siggi - Validierung fuer ibm-Rechner in Seoul (nobel) sowie
42     #                    allgemeine Anpassungen fuer ibm-Rechner
43     # 15/10/02 - Siggi - Neue Default-Jobklasse (p_normal) fuer IBM in Seoul
44     #                    Ruecktransfer des Jobprotokolls fuer diese
45     #                    Maschine abgeschaltet
46     # 31/10/02 - Siggi - berni validiert
47     # 06/11/02 - Siggi - Neue Jobklassen auf ibmb und ibmh
48     # 08/11/02 - Siggi - quanero validiert
49     # 11/12/02 - Siggi - Notification fuer Transfer-Jobs abgeschaltet
50     # 23/01/03 - Siggi - hostname nobel changed to nobela
51     # 06/02/03 - Siggi - gregale validated
52     # 12/02/03 - Siggi - orkan and maestro validated
53     # 21/02/03 - Siggi - all nobel nodes in Seoul validated
54     # 12/03/03 - Siggi - nec at DKRZ validated
55     # 13/03/03 - Siggi - new nqs resource variable Memory
56     # 07/04/03 - Siggi - processor request option -c on nech needs tasks per
57     #                    node
58     # 11/04/03 - Siggi - network on ibms has attribute "shared"
59     # 31/07/03 - Siggi - nqs2 on nech implemented (provisional: -h nech2)
60     #                    cxxl added to ibmh
61     # 29/08/03 - Siggi - changes in job queues and communication system on
62     #                    ibms
63     # 24/10/03 - Siggi - using alternate hanni address 130.75.4.2
64     # 30/10/03 - Siggi - nech is not supported any more
65     # 10/11/03 - Siggi - nech2 renamed to nech
66     # 20/11/03 - Siggi - submit command on nech changed from qsub.test to qsub
67     # 29/03/04 - Siggi - ground not supported any more, gfdl3 validated
68     # 31/03/04 - Siggi - new option -N for node usage
69     # 12/04/04 - Siggi - scp2 instead of scp used for transfer from decalpha
70     #                    due to error in ssh installation (otherwise a prompt
71     #                    for the password appears)
72     # 23/07/04 - Siggi - changes due to the new berni configuration
73     #                    (federation switch)
74     # 01/09/04 - Gerald  new job-classes on hanni
75     # 08/09/04 - Siggi - hanni IP address changed to 130.75.4.10
76     # 23/11/04 - Siggi - new job class cdata on hanni and berni
77     # 03/12/04 - Siggi - notification on ibm switched of in case of
78     #                    delete_dayfile = true, node usage in cdev set to
79     #                    shared
80     # 16/02/05 - Gerald  hababai validated
81     # 29/03/05 - Micha - new job class channi on hanni
82     # 11/05/05 - Siggi - ConsumableMemory is now required as resource keyword
83     #                    on ibms
84     # 24/05/05 - Siggi - Default queue on ibms changed from p_normal_1.3 to
85     #                    p_normal
86     # 30/06/05 - Siggi - network changed for queue cdev from "us" to "ip"
87     # 12/07/05 - Siggi - in network.mpi on ibmh/ibmb "csss" changed to
88     #                    "sn_all", new job class cexp
89     # 08/09/05 - Siggi - IP-address of gfdl3 changed
90     # 31/10/05 - Siggi - new job class pp on hurricane, serial jobs on
91     #                    hurricane (with -X0)
92     # 01/11/05 - Siggi - missing queue for jobs submitted on nech (for nech)
93     #                    added
94     # 30/12/05 - Siggi - change of IP adresses in subnet 130.75.105
95     # 09/02/06 - Siggi - ibmy admitted
96     # 10/02/06 - Siggi - scp2 changed to /bin/scp on decalpha
97     # 13/04/06 - Siggi - ostria admitted
98     # 18/04/06 - Siggi - new option -O for OpenMP usage
99     # 24/05/06 - Siggi - lctit admitted, ftpjob renamed scpjob
100     # 25/07/06 - Siggi - gfdl5 (ibmy) admitted for submitting jobs
101     # 27/09/06 - Siggi - breg/hreg extended with berni/hanni
102     # 25/10/06 - Siggi - data_limit set to 1.76 GByte on hanni and berni
103     # 28/11/06 - Siggi - levanto admitted
104     # 13/02/07 - Siggi - hpmuk releated code removed
105     # 01/03/07 - Siggi - adjustments for RIAM machines gate and NEC-SX8 (n-sx)
106     # 12/04/07 - Siggi - option -f (filetransfer protocol) removed, scp only
107     # 27/07/07 - Siggi - autan admitted
108     # 03/08/07 - Marcus- lcfimm admitted
109     # 08/10/07 - Siggi - further job classes added for hanni (csoloh...)
110     # 15/10/07 - Siggi - preliminary adjustments for lctit based on Jin's
111     #                    suggestions
112     # 19/10/07 - Marcus- add new optional argument -g group_number
113     # 19/10/07 - Siggi - a ";" was missing in the last change done by Marcus
114     # 30/10/07 - Marcus- further adjustments for queues on lctit
115     # 15/05/08 - Siggi - adjustments for lcxt4 (Bergen Center for Computational
116     #                    Science)
117     # 14/07/08 - Siggi - adjustments for lcsgih
118     # 23/09/08 - Gerald- paesano admitted
119     # 02/10/08 - Siggi - PBS adjustments for lcxt4
120     # 02/03/09 - Siggi - Adjustments for new NEC-SX9 at RIAM
121     # 16/04/09 - Marcus- Adjustments for lcsgib and lcsgih
122     # 21/04/09 - Siggi - adjustments for new IBM at DKRZ, which is now ibmh
123     # 18/05/09 - Siggi - Settings for serial jobs on lcsgi changed
124     # 24/06/09 - BjornM- adjustments for lcxt4 (loading modules manually)
125     # 08/07/09 - Siggi - option -e added (email notification on lcsgih/b)
126     # 20/07/09 - Siggi - On lcsgi, jobs for returning the job protocol are
127     #                    now run on the data nodes (feature=data)
128     # 25/08/09 - BjornM- adapted for lck
129     # 26/08/09 - Marcus- caurus admitted; optional qos feature hiprio on lcsgi
130     # 03/09/09 - Siggi - PBS sgi feature directive only used if explicitly
131     #                    set in the config file by the user
132     # 16/10/09 - Carolin-adjustments for archiving on SGI-ICE of binary files;
133     #                    adding special1q
134     # 01/12/09 - BjornM- re-adjustments for lcxt4, added sno (130.75.105.113)
135     # 16/10/09 - Carolin-adding permq
136     # 01/02/10 - Siggi - adapted for lcxt5m and lckyoto (Fujitsu HX600)
137     # 03/02/10 - Siggi - bug in serial jobs removed
138     # 26/02/10 - BjornM- re-adjustments for lcxt4 (new modules, email
139     #                    notification)
140     # 01/03/10 - Siggi - loading of modules controlled by environment variable
141     #                    module_calls
142     # 17/08/10 - BjornM- re-adjustments for lcxt4 (location of qsub)
143     # 25/08/10 - BjornM- account geofysisk replaced by guest for lcxt4
144     # 25/08/10 - Siggi - new variable project_account in pbs-statements for
145     #                    lcxt4
146     # 08/12/10 - Siggi - initialization of the module command changed for
147     #                    SGI-ICE/lcsgi
148     #                    adjustments for Kyushu Univ. (lcrte, ibmku)
149     # 14/12/10 - Siggi - adjustments for new Tsubame system at Tokyo
150     #                    institute of technology (lctit)
151     # 02/02/11 - Siggi - further asjustments for Tsubame concerning openMP
152     # 06/03/11 - Siggi - adjustments for ibmkisti
153     # 17/03/11 - Siggi - adjustments for openmp usage on ibmkisti
154     # 03/04/11 - Micha - added lckordi
155     # 17/08/11 - Siggi - hicegate0 added
156     # 18/08/11 - Siggi - workaround on lcsgi in order to avoid appends to file
157     #                    last_job_transfer_protocol
158     # 21/08/11 - Siggi - inferno admitted
159     # 29/11/11 - Siggi - adjustments for lcsgih/lcsgib queues, pingui admitted
160     # 21/12/11 - Theres- solano admitted
161     # 31/01/12 - Matthias - adjustments for ibmh
162     # 02/05/12 - Bjoern  - lcxt4 is now lcxe6, adjustments for lcxe6,
163     #                      bugfixes for the parameter file check, initial
164     #                      commands on ssh calls sourced out to .mrun.config
165     # 02/10/12 - Siggi - adjustments for lcsb
166     # 01/11/12 - Siggi - adjustments for lckiaps
167
168
169
170    # VARIABLENVEREINBARUNGEN + DEFAULTWERTE
171 delete_dayfile=false
172 email_notification=none
173 group_number=none
174 locat=normal
175 no_default_queue=none
176 no_submit=false
177 job_catalog="~/job_queue"
178 job_name=none
179 local_user=$LOGNAME
180 node_usage=shared
181 numprocs=0
182 punkte="..........................................................."
183 submcom=qsub
184 queue=default
185 remote_host=none
186 remote_user=""
187 verify=true
188
189 typeset  -i   cputime=memory=Memory=0  minuten  resttime  sekunden  stunden
190 typeset  -i   inumprocs  mpi_tasks=nodes=processes_per_node=0 tasks_per_node=threads_per_task=1
191 typeset  -L20 spalte1
192 typeset  -R40 spalte2
193 typeset  -L60 spalte3
194
195
196
197    # FEHLERBEHANDLUNG
198    # BEI EXIT:
199 trap 'if [[ $locat != normal ]]
200       then
201          case  $locat  in
202             (option)  printf "\n  --> available optios can be displayed"
203                       printf " by typing:"
204                       printf "\n      \"subjob ?\" \n";;
205             (ftpcopy|parameter|scp|verify)  printf "\n";;
206             (*)       printf "\n  +++ unknown error"
207                       printf "\n      please inform S. Raasch!\n"
208          esac
209          [[ -f $job_to_send ]]  &&  rm  $job_to_send
210          printf "\n\n+++ SUBJOB killed \n\n"
211       fi' exit
212
213
214    # BEI TERMINAL-BREAK:
215 trap '[[ -f $job_to_send ]]  &&  rm  $job_to_send
216       printf "\n\n+++ SUBJOB killed \n\n"
217       exit
218      ' 2
219
220
221
222
223    # LOKALEN HOSTNAMEN FESTSTELLEN
224 local_host=$(hostname)
225
226
227
228    # HOSTSPEZIFISCHE VARIABLEN VEREINBAREN BZW. PRUEFEN, OB LOKALER HOST
229    # UEBERHAUPT ZULAESSIG IST
230    # Note: One of the entries for "lck" or "lckordi" always has to be
231    # comment out, because the hostname (node*) is same for both machines
232 case  $local_host  in
233     (atmos)                 local_addres=172.20.25.35;   local_host=lcide;;
234     (autan)                 local_addres=130.75.105.57;  local_host=lcmuk;;
235     (bora)                  local_addres=130.75.105.103; local_host=lcmuk;;
236     (bd1)                   local_addres=130.73.232.64;  local_host=lcsgib;;
237     (bd2)                   local_addres=130.73.232.65;  local_host=lcsgib;;
238     (bd3)                   local_addres=130.73.232.66;  local_host=lcsgib;;
239     (bd4)                   local_addres=130.73.232.67;  local_host=lcsgib;;
240     (b01*|bicegate1)        local_addres=130.73.232.102; local_host=lcsgib;;
241     (bicegate2)             local_addres=130.73.232.103; local_host=lcsgib;;
242     (blizzard1)             local_addres=136.172.40.15;  local_host=ibmh;;
243     (breva)                 local_addres=130.75.105.98;  local_host=lcmuk;;
244     (caurus)                local_addres=130.75.105.19;  local_host=lcmuk;;
245     (climate*)              local_addres=165.132.26.68;  local_host=lcyon;;
246     (compute-*.local)       local_addres=172.20.4.2;     local_host=lcfimm;;
247     (cs*)                   local_addres=136.172.44.131; local_host=nech;;
248     (elephanta)             local_addres=130.75.105.6;   local_host=lcmuk;;
249     (fimm.bccs.uib.no)      local_addres=172.20.4.2;     local_host=lcfimm;;
250     (node*)                 local_addres=165.132.26.61   local_host=lck;;
251   #  (node*)                 local_addres=210.219.61.8    local_host=lckordi;;
252     (gaia*)                 local_addres=150.183.146.24; local_host=ibmkisti;;
253     (gallego)               local_addres=130.75.105.10;  local_host=lcmuk;;
254     (gfdl5)                 local_addres=165.132.26.58;  local_host=ibmy;;
255     (gfdl3.yonsei.ac.kr)    local_addres=165.132.26.56;  local_host=decalpha;;
256     (gregale)               local_addres=130.75.105.109; local_host=lcmuk;;
257     (hababai)               local_addres=130.75.105.108; local_host=lcmuk;;
258     (hexagon.bccs.uib.no)   local_addres=129.177.20.113; local_host=lcxe6;;
259     (hd1)                   local_addres=130.75.4.104;   local_host=lcsgih;;
260     (hd2)                   local_addres=130.75.4.105;   local_host=lcsgih;;
261     (hd3)                   local_addres=130.75.4.106;   local_host=lcsgih;;
262     (hd4)                   local_addres=130.75.4.107;   local_host=lcsgih;;
263     (hicegate0)             local_addres=130.75.4.101;   local_host=lcsgih;;
264     (h01*|hicegate1)        local_addres=130.75.4.102;   local_host=lcsgih;;
265     (hicegate2)             local_addres=130.75.4.103;   local_host=lcsgih;;
266     (hx*)                   local_addres=133.3.51.11;    local_host=lckyoto;;
267     (inferno)               local_addres=130.75.105.5;   local_host=lcmuk;;
268     (irifi)                 local_addres=130.75.105.104; local_host=lcmuk;;
269     (sno)                   local_addres=130.75.105.113; local_host=lcmuk;;
270     (levanto)               local_addres=130.75.105.45;  local_host=lcmuk;;
271     (login*)                local_addres=118.128.66.223; local_host=lckiaps;;
272     (maestro)               local_addres=130.75.105.2;   local_host=lcmuk;;
273     (meteo-login*)          local_addres=193.166.211.144;local_host=lcxt5m;;
274     (hexagon*)              local_addres=129.177.20.113; local_host=lcxe6;;
275     (nobel*)                local_addres=150.183.5.101;  local_host=ibms;;
276     (orkan)                 local_addres=130.75.105.3;   local_host=lcmuk;;
277     (ostria)                local_addres=130.75.105.106; local_host=lcmuk;;
278     (paesano)               local_addres=130.75.105.46;  local_host=lcmuk;;
279     (pingui)                local_addres=134.106.74.118; local_host=lcfor;;
280     (quanero)               local_addres=130.75.105.107; local_host=lcmuk;;
281     (rte*)                  local_addres=133.5.185.60;   local_host=lcrte;;
282     (scirocco)              local_addres=172.20.25.41;   local_host=lcmuk;;
283     (solano)                local_addres=130.75.105.110; local_host=lcmuk;;
284     (sun1|sun2)             local_addres=130.75.6.1;     local_host=unics;;
285     (sx-*)                  local_addres=172.16.1.131;   local_host=necriam;;
286     (r1*)                   local_addres=130.75.4.102;   local_host=lcsgih;;
287     (r2*)                   local_addres=130.73.232.102; local_host=lcsgib;;
288     (t2a*)                  local_addres=10.1.6.165;     local_host=lctit;;
289     (urban*)                local_addres=147.46.30.151   local_host=lcsb;;
290     (vorias)                local_addres=172.20.25.43;   local_host=lcmuk;;
291     (*.cc.kyushu-u.ac.jp)   local_addres=133.5.4.129;    local_host=ibmku;;
292     (*)                     printf "\n  +++ \"$local_host\" unknown";
293                             printf "\n      please inform S. Raasch!";
294                             locat=parameter; exit;;
295 esac
296
297
298
299    # REMOTE HOST DEFAULTMAESSIG = LOCAL HOST SETZEN
300 remote_host=$local_host
301
302
303
304
305    # PROZEDUROPTIONEN EINLESEN
306 while  getopts  :c:dDe:g:h:m:n:N:O:q:t:T:u:vX:  option
307 do
308   case  $option  in
309       (c)   job_catalog=$OPTARG;;
310       (d)   delete_dayfile=true;;
311       (D)   no_submit=true;;
312       (e)   email_notification=$OPTARG;;
313       (g)   group_number=$OPTARG;;
314       (h)   remote_host=$OPTARG;;
315       (m)   memory=$OPTARG;;
316       (n)   job_name=$OPTARG;;
317       (N)   node_usage=$OPTARG;;
318       (O)   threads_per_task=$OPTARG;;
319       (q)   no_default_queue=$OPTARG;;
320       (t)   cputime=$OPTARG;;
321       (T)   tasks_per_node=$OPTARG;;
322       (u)   remote_user=$OPTARG;;
323       (v)   verify=false;;
324       (X)   numprocs=$OPTARG;;
325       (\?)  printf "\n  +++ Option $OPTARG unknown \n";
326             locat=option; exit;;
327   esac
328 done
329
330
331    # JOBDATEINAMEN ALS NAECHSTES ARGUMENT HOLEN
332 shift OPTIND-1; file_to_send=$1
333
334
335    # KURZE AUFRUFBESCHREIBUNG WIRD HIER AUSGEGEBEN
336 if [ "$1" = "?" ]
337 then
338   (printf "\n  *** subjob can be called as follows:\n"
339    printf "\n      subjob -c.. -d -D -h.. -m.. -q.. -t.. -u.. -v  <jobfile>\n"
340    printf "\n      Description of available options:\n"
341    printf "\n      Option  Description                         Default-Value"
342    printf "\n        -c    job-input- and output-catalog       ~/job_queue"
343    printf "\n        -d    no job-protocol will be created     ---"
344    printf "\n        -D    only the job-file will be created   ---"
345    printf "\n        -h    execution host, available hosts:    $remote_host"
346    printf "\n              ibm, ibmh, ibmkisti, ibmku, ibms, ibmy, lc...,"
347    printf "\n              lckiaps, lctit, nech, necriam, unics"
348    printf "\n        -m    memory demand per process in MByte  ---"
349    printf "\n        -n    jobname                             <jobdatei>"
350    printf "\n        -O    threads per task (for OpenMP usage) 1"
351    printf "\n        -q    job-queue to be used                default"
352    printf "\n        -t    allowed cpu-time in seconds         ---"
353    printf "\n        -T    tasks per node (on parallel hosts)  ---"
354    printf "\n        -u    username on execution host          from .netrc"
355    printf "\n        -v    no prompt for confirmation          ---"
356    printf "\n        -X    # of processors (on parallel hosts) 1"
357    printf "\n "
358    printf "\n      The only possible positional parameter is <jobfile>:"
359    printf "\n      The complete NQS-job must be provided here."
360    printf "\n      <jobfile>=? creates this outline\n\n") | more
361    exit
362 fi
363
364
365
366    # PRUEFEN, OB JOBDATEI ANGEGEBEN WURDE UND OB SIE AUCH EXISTIERT
367 if [[ "$file_to_send" = "" ]]
368 then
369    printf "\n  +++ job-file missing"
370    locat=parameter; exit
371 else
372    if [[ -f $file_to_send ]]
373    then
374       true
375    else
376       printf "\n  +++ job-file: "
377       printf "\n           $file_to_send"
378       printf "\n      does not exist"
379       locat=parameter; exit
380    fi
381 fi
382
383
384
385    # FALLS KEIN JOBNAME ANGEGEBEN WURDE, WIRD JOBNAME = JOBDATEINAME
386    # GESETZT. VORAUSSETZUNG: JOBDATEINAME BEINHALTET KEINE PFADE
387 if [[ $job_name = none ]]
388 then
389    job_name=$file_to_send
390 fi
391 if [[ $(echo $job_name | grep -c "/") != 0 ]]
392 then
393    printf "\n  +++ job-file name: "
394    printf "\n           $job_name"
395    printf "\n      must not contain \"/\"-characters"
396    locat=parameter; exit
397 fi
398
399
400
401
402    # HOSTSPEZIFISCHE GROESSEN VEREINBAREN BZW. ABBRUCH BEI UNZULAESSIGEM HOST
403    # ODER WENN HOST NICHT ANGEGEBEN WURDE
404 if [[ $remote_host = none ]]
405 then
406    printf "\n  +++ host missing"
407    locat=option; exit
408 else
409    case  $remote_host  in
410        (ibm)     queue=p690_standard; remote_addres=134.76.99.81; submcom=/usr/lpp/LoadL/full/bin/llsubmit;;
411        (ibmh)    queue=no_class; remote_addres=136.172.40.15; submcom=/usr/lpp/LoadL/full/bin/llsubmit;;
412        (ibmkisti) queue=class.32plus; remote_addres=150.183.146.24; submcom=/usr/lpp/LoadL/full/bin/llsubmit;;
413        (ibmku)   queue=s4; remote_addres=133.5.4.129; submcom=/usr/local/bin/llsubmit;;
414        (ibms)    queue=p_normal; remote_addres=150.183.5.101; submcom=/usr/lpp/LoadL/full/bin/llsubmit;;
415        (ibmy)    queue=parallel; remote_addres=165.132.26.58; submcom=/usr/lpp/LoadL/full/bin/llsubmit;;
416        (lcfimm)  remote_addres=172.20.4.2; submcom=/opt/torque/bin/qsub;;
417        (lckyoto) remote_addres=133.3.51.11; submcom=/thin/local/bin/qsub;;
418        (lcsgib)  queue=smallq; remote_addres=130.73.232.104; submcom=/opt/moab/bin/msub;;
419        (lcsgih)  queue=smallq; remote_addres=130.75.4.101; submcom=/opt/moab/bin/msub;;
420        (lck)     remote_addres=165.132.26.61; submcom=/usr/torque/bin/qsub;;
421        (lckiaps) remote_addres=118.128.66.223; submcom=/cm/shared/apps/pbspro/11.0.2.110766/bin/qsub;;
422        (lckordi) remote_addres=210.219.61.8; submcom=/usr/torque/bin/qsub;;
423        (lcsb)    remote_addres=147.46.30.151; submcom=/usr/torque/bin/qsub;;
424        (lctit)   queue=S; remote_addres=10.1.6.165; submcom=/opt/pbs/tools/bin/t2sub;;
425        (lcxe6)   remote_addres=129.177.20.113; submcom=/opt/torque/2.5.10/bin/qsub;;
426        (lcxt5m)  remote_addres=193.166.211.144; submcom=/opt/pbs/10.1.0.91350/bin/qsub;;
427        (lcyon)   remote_addres=165.132.26.68; submcom=/usr/torque/bin/qsub;;
428        (nech)    qsubmem=memsz_job; qsubtime=cputim_job; remote_addres=136.172.44.147; submcom="/usr/local/bin/qsub";;
429        (necriam) qsubmem=memsz_job; qsubtime=cputim_job; remote_addres=172.16.1.131; submcom="/usr/bin/nqsII/qsub";;
430        (vpp)     qsubmem=m; qsubtime=t; queue=vpp; remote_addres=130.75.4.130;;
431        (unics)   qsubmem=d; qsubtime=t; queue=unics; remote_addres=130.75.6.1;;
432        (*)       printf "\n  +++ hostname \"$remote_host\" not allowed";
433                  locat=parameter; exit;;
434    esac
435 fi
436
437
438    # EVTL. PRUEFEN, OB ANGEGEBENE QUEUE ZULAESSIG IST
439 if [[ $no_default_queue != none ]]
440 then
441    error=false
442    ndq=$no_default_queue
443    case  $remote_host  in
444        (ibm)    case  $ndq  in
445                     (p690_express|p690_standard|p690_long)  error=false;;
446                     (*)                                     error=true;;
447                 esac;;
448        (ibmh)   case  $ndq  in
449                     (no_class)  error=false;;
450                     (*)                                     error=true;;
451                 esac;;
452        (ibmkisti)   case  $ndq  in
453                     (class.32plus|class.1-2|class.2-32)  error=false;;
454                     (*)                                     error=true;;
455                 esac;;
456        (ibmku)  case  $ndq  in
457                     (sdbg1|sdbg2|sdbg4|s4|s16|s32|s32-s)    error=false;;
458                     (*)                                     error=true;;
459                 esac;;
460        (ibms)   case  $ndq  in
461                     (express|normal|p_express|p_normal|p_normal_1.3|p_normal_1.7|grand)     error=false;;
462                     (*)                                     error=true;;
463                 esac;;
464        (ibmy)   case  $ndq  in
465                     (parallel)                              error=false;;
466                     (*)                                     error=true;;
467                 esac;;
468        (lckiaps) case  $ndq  in
469                     (express|normal)                        error=false;;
470                     (*)                                     error=true;;
471                 esac;;
472        (lckyoto) case  $ndq  in
473                     (eh|ph)                                 error=false;;
474                     (*)                                     error=true;;
475                 esac;;
476        (lcsgib|lcsgih)   case  $ndq  in
477                     (testq|serialq|smallq|mediumq|bigq|workq|dataq|permq|special1q)       error=false;;
478                     (*)                                     error=true;;
479                 esac;;
480        (lctit)  case  $ndq  in
481                     (G|L128|L256|L512H|S|S96|V)             error=false;;
482                     (*)                                     error=true;;
483                 esac;;
484        (t3eb)   case  $ndq  in
485                     (berte|p50|p100|p392|forfree|p25himem)  error=false;;
486                     (*)    error=true;;
487                 esac;;
488        (necriam) case  $ndq  in
489                     (SP|SS|P6)  error=false;;
490                     (*)    error=true;;
491                 esac;;
492        (t3eh)   case  $ndq  in
493                     (para_t3e|em|k|l|lm|comp_t3e|c|p|ht)  error=false;;
494                     (*)    error=true;;
495                 esac;;
496        (t3ej2|t3ej5)  case  $ndq  in
497                     (low|normal|high)  error=false;;
498                     (*)    error=true;;
499                 esac;;
500        (t3es)  case  $ndq  in
501                     (batch|serial-4|pe4|p48|pe16|pe32|pe64|pe128)  error=false;;
502                     (*)    error=true;;
503                 esac;;
504        (unics)  case  $ndq  in
505                     (unics|ht)  error=false;;
506                     (*)         error=true;;
507                 esac;;
508    esac
509    if [[ $error = true ]]
510    then
511       printf "\n  +++ queue \"$no_default_queue\" on host \"$remote_host\" not allowed"
512       locat=parameter; exit
513    else
514       queue=$no_default_queue
515    fi
516 fi
517
518
519
520    # PRUEFEN DER CPU-ZEIT, ZEIT NACH STUNDEN, MINUTEN UND SEKUNDEN
521    # AUFTEILEN
522 done=false
523 while [[ $done = false ]]
524 do
525    if (( $cputime <= 0 ))
526    then
527       printf "\n  +++ wrong cpu-time or cpu-time missing"
528       printf "\n  >>> Please type cpu-time in seconds as INTEGER:"
529       printf "\n  >>> "
530       read  cputime  1>/dev/null  2>&1
531    else
532       done=true
533    fi
534 done
535 if [[ $remote_host = nech ]]
536 then
537    if (( tasks_per_node != 0 ))
538    then
539       (( cputime = cputime * tasks_per_node ))
540    elif [[ $numprocs != 0 ]]
541    then
542       (( cputime = cputime * numprocs ))
543    fi
544 fi
545 (( stunden  = cputime / 3600 ))
546 (( resttime = cputime - stunden * 3600 ))
547 (( minuten  = resttime / 60 ))
548 (( sekunden = resttime - minuten * 60 ))
549 timestring=${stunden}:${minuten}:${sekunden}
550
551
552
553    # PRUEFEN DER KERNSPEICHERANFORDERUNG
554 done=false
555 while [[ $done = false ]]
556 do
557    if (( memory <= 0 ))
558    then
559       printf "\n  +++ wrong memory demand or memory demand missing"
560       printf "\n  >>> Please type memory in  MByte per process  as INTEGER:"
561       printf "\n  >>> "
562       read  memory  1>/dev/null  2>&1
563    else
564       done=true
565    fi
566 done
567
568 if [[ $remote_host = nech  ||  $remote_host = necriam ]]
569 then
570    if (( tasks_per_node != 0 ))
571    then
572       (( Memory = memory * tasks_per_node / 1000 ))
573    elif [[ $numprocs != 0 ]]
574    then
575       (( Memory = memory * numprocs / 1000 ))
576    else
577       (( Memory = memory / 1000 ))
578    fi
579 elif [[ $remote_host = lctit ]]
580 then
581    (( Memory = memory * tasks_per_node / 1000 ))
582 fi
583
584
585    # SPEICHERBERECHNUNG BEI OPENMP-NUTZUNG
586 if [[ $(echo $remote_host | cut -c1-3) = ibm ]]
587 then
588    (( memory = memory * threads_per_task ))
589 fi
590
591
592    # BERECHNUNG DER ANZAHL DER ZU VERWENDENDEN KNOTEN
593 if (( tasks_per_node != 0 ))
594 then
595    (( nodes = numprocs / ( tasks_per_node * threads_per_task ) ))
596 fi
597
598    # Calculate number of processes per node
599 (( processes_per_node = tasks_per_node * threads_per_task ))
600
601    # Calculate number of MPI tasks
602 (( mpi_tasks = numprocs / threads_per_task ))
603
604
605    # HEADER-AUSGABE
606 if [[ $verify = true ]]
607 then
608    printf "\n\n"
609    printf "#--------------------------------------------------------------# \n"
610    spalte1=SUBJOB;spalte2=$(date)
611    printf "| $spalte1$spalte2 | \n"
612    printf "|                                                              | \n"
613    printf "| values of parameters/options:                                | \n"
614    spalte1=local_host$punkte; spalte2=$punkte$local_host
615    printf "| $spalte1$spalte2 | \n"
616    spalte1=remote_host$punkte; spalte2=$punkte$remote_host
617    printf "| $spalte1$spalte2 | \n"
618    spalte1=queue$punkte; spalte2=$punkte$queue
619    printf "| $spalte1$spalte2 | \n"
620    spalte1=memory$punkte; spalte2="$punkte$memory mb"
621    printf "| $spalte1$spalte2 | \n"
622    spalte1=cputime$punkte; spalte2="$punkte$cputime sec"
623    printf "| $spalte1$spalte2 | \n"
624    spalte1=job_name$punkte; spalte2="$punkte$job_name"
625    printf "| $spalte1$spalte2 | \n"
626    printf "#--------------------------------------------------------------# \n\n"
627
628
629       # KONTROLLABFRAGE, OB ALLES O.K.
630    antwort="dummy"
631    while [[ $antwort != y  &&  $antwort != Y  &&  $antwort != n  &&  $antwort != N ]]
632    do
633       read antwort?" >>> continue (y/n) ? "
634    done
635    if [[ $antwort = n  ||  $antwort = N ]]
636    then
637       locat=verify; exit
638    fi
639    printf "\n"
640 fi
641
642
643
644    # ZUFALLSKENNUNG GENERIEREN UND JOBNAMEN AUF ZIELRECHNER BESTIMMEN
645 kennung=$RANDOM
646 job_on_remhost=${job_name}_${kennung}_$local_host
647 job_to_send=job_to_send_$kennung
648 if [[ $delete_dayfile = false ]]
649 then
650    remote_dayfile=${local_host}_${job_name}_result_$kennung
651    local_dayfile=${remote_host}_${job_name}
652 else
653    remote_dayfile=/dev/null
654 fi
655
656
657
658    # Generate the batch job scripts (qsub/msub/LoadLeveler)
659 if [[ $(echo $remote_host | cut -c1-3) = ibm  &&  $numprocs != 0 ]]
660 then
661
662       # General LoadLeveler settings
663    execute_in_shell="#!/bin/ksh"
664    use_shell="# @ shell = /bin/ksh"
665    consumable_memory="ConsumableMemory($memory mb)"
666    class="# @ class = $queue"
667    environment="# @ environment = OMP_NUM_THREADS=$threads_per_task; MP_SHARED_MEMORY=yes"
668    network_to_use="# @ network.mpi = sn_all,shared,us"
669    data_limit="# @ data_limit = 1.76gb"
670    image_size="# @ image_size = 50"
671    wall_clock_limit="# @ wall_clock_limit = ${timestring},$timestring"
672
673    if [[ $email_notification = none ]]
674    then
675       notify_user=""
676    else
677       notify_user="# @ notify_user = $email_notification"
678       if [[ $delete_dayfile = true ]]
679       then
680          notification='# @ notification = never'
681       fi
682    fi
683
684    if [[ $remote_host = ibmh ]]
685    then
686       data_limit=""
687       network_to_use=""
688       class=""
689       environment=""
690       rset="# @ rset = RSET_MCM_AFFINITY"
691       task_affinity="# @ task_affinity = core(1)"
692    elif [[ $remote_host = ibmkisti ]]
693    then
694       network_to_use="# @ network.MPI = sn_all,shared,US"
695       wall_clock_limit="# @ wall_clock_limit = $timestring"
696       if [[ $threads_per_task = 1 ]]
697       then
698          rset="# @ rset = RSET_MCM_AFFINITY"
699          mcm_affinity_options="# @ mcm_affinity_options = mcm_mem_pref mcm_sni_none mcm_distribute"
700       fi
701       environment=""
702       use_shell=""
703       data_limit=""
704       image_size=""
705    elif [[ $remote_host = ibmku ]]
706    then
707       execute_in_shell="#!/usr/bin/ksh"
708       use_shell="# @ shell = /usr/bin/ksh"
709       consumable_memory=""
710       environment=""
711       network_to_use="# @ network.mpi = sn_all,shared,us"
712       data_limit=""
713       image_size=""
714    elif [[ $remote_host = ibms ]]
715    then
716       network_to_use="# @ network.mpi = csss,shared,us"
717    elif [[ $remote_host = ibmy ]]
718    then
719       consumable_memory=""
720       network_to_use=""
721    fi
722
723    cat > $job_to_send << %%END%%
724$execute_in_shell
725$use_shell
726
727# @ job_type = parallel
728# @ job_name = $job_name
729# @ resources = ConsumableCpus($threads_per_task) $consumable_memory
730# @ output = $remote_dayfile
731# @ error = $remote_dayfile
732$wall_clock_limit
733$image_size
734$class
735$environment
736$network_to_use
737$data_limit
738$rset
739$mcm_affinity_options
740$task_affinity
741$notification
742$notify_user
743
744%%END%%
745
746    if (( nodes > 0 ))
747    then
748
749       if [[ $remote_host != ibmkisti ]]
750       then
751
752          cat >> $job_to_send << %%END%%
753# @ node = $nodes
754# @ tasks_per_node = $processes_per_node
755# @ node_usage = $node_usage
756# @ queue
757
758%%END%%
759
760       else
761
762          cat >> $job_to_send << %%END%%
763# @ total_tasks = $mpi_tasks
764# @ blocking = unlimited
765# @ queue
766
767%%END%%
768
769       fi
770
771    else
772
773       if [[ $remote_host != ibmy ]]
774       then
775
776          cat >> $job_to_send << %%END%%
777# @ blocking = unlimited
778# @ total_tasks = $numprocs
779# @ node_usage = $node_usage
780# @ queue
781
782%%END%%
783
784       else
785
786          cat >> $job_to_send << %%END%%
787# @ node = 1
788# @ total_tasks = $numprocs
789# @ queue
790
791%%END%%
792
793       fi
794
795    fi
796
797       # workaround because of silly job filter on ibmkisti
798    if [[ $remote_host = ibmkisti  &&  $threads_per_task != 1 ]]
799    then
800       echo  "export OMP_NUM_THREADS=$threads_per_task"  >>  $job_to_send
801    fi
802
803 elif [[ $(echo $remote_host | cut -c1-3) = ibm  &&  $numprocs = 0 ]]
804 then
805
806    cat > $job_to_send << %%END%%
807#!/bin/ksh
808
809# @ job_type = serial
810# @ node_usage = $node_usage
811# @ job_name = palm
812# @ wall_clock_limit = ${timestring},$timestring
813# @ resources = ConsumableCpus(1) ConsumableMemory(1 gb)
814# @ output = $remote_dayfile
815# @ error = $remote_dayfile
816$class
817$notification
818
819# @ queue
820
821%%END%%
822
823 elif [[ $remote_host = lcfimm ]]
824 then
825
826    if [[ $numprocs != 0 ]]
827    then
828       cat > $job_to_send << %%END%%
829#!/bin/ksh
830#PBS -N $job_name
831#PBS -A $project_account
832#PBS -l walltime=$timestring
833#PBS -l nodes=${nodes}:ppn=$processes_per_node
834#PBS -l pmem=${memory}mb
835#PBS -m abe
836#PBS -o $remote_dayfile
837#PBS -j oe
838mpd &
839
840%%END%%
841
842    else
843       cat > $job_to_send << %%END%%
844#!/bin/ksh
845#PBS -N $job_name
846#PBS -A $project_account
847#PBS -l walltime=$timestring
848#PBS -l ncpus=1
849#PBS -l pmem=${memory}mb
850#PBS -m abe
851#PBS -o $remote_dayfile
852#PBS -j oe
853
854%%END%%
855
856    fi
857
858 elif [[ $remote_host = lck || $remote_host = lckordi || $remote_host = lcsb ]]
859 then
860
861    if [[ $numprocs != 0 ]]
862    then
863       cat > $job_to_send << %%END%%
864#!/bin/ksh
865#PBS -N $job_name
866#PBS -l walltime=$timestring
867#PBS -l ncpus=$numprocs
868#PBS -l pmem=${memory}mb
869#PBS -o $remote_dayfile
870#PBS -l nodes=$nodes:ppn=${processes_per_node}
871#PBS -j oe
872
873mpd &
874
875%%END%%
876
877    else
878       cat > $job_to_send << %%END%%
879#!/bin/ksh
880#PBS -N $job_name
881#PBS -l walltime=$timestring
882#PBS -l ncpus=1
883#PBS -l pmem=${memory}mb
884#PBS -o $remote_dayfile
885#PBS -j oe
886
887%%END%%
888
889    fi
890
891 elif [[ $remote_host = lckiaps ]]
892 then
893
894    if [[ $numprocs != 0 ]]
895    then
896       cat > $job_to_send << %%END%%
897#!/bin/ksh
898#PBS -N $job_name
899#PBS -l walltime=$timestring
900#PBS -l select=1:ncpus=$numprocs
901#PBS -l pmem=${memory}mb
902#PBS -q $queue
903#PBS -o $remote_dayfile
904#PBS -j oe
905#PBS -V
906
907%%END%%
908
909    else
910       cat > $job_to_send << %%END%%
911#!/bin/ksh
912#PBS -N $job_name
913#PBS -l walltime=$timestring
914#PBS -l ncpus=1
915#PBS -l pmem=${memory}mb
916#PBS -o $remote_dayfile
917#PBS -j oe
918
919%%END%%
920
921    fi
922
923 elif [[ $remote_host = lcyon ]]
924 then
925
926    if [[ $numprocs != 0 ]]
927    then
928       cat > $job_to_send << %%END%%
929#!/bin/ksh
930#PBS -N $job_name
931#PBS -l walltime=$timestring
932#PBS -l ncpus=$numprocs
933#PBS -l pmem=${memory}mb
934#PBS -o $remote_dayfile
935#PBS -j oe
936
937%%END%%
938
939    else
940       cat > $job_to_send << %%END%%
941#!/bin/ksh
942#PBS -N $job_name
943#PBS -l walltime=$timestring
944#PBS -l ncpus=1
945#PBS -l pmem=${memory}mb
946#PBS -o $remote_dayfile
947#PBS -j oe
948
949%%END%%
950
951    fi
952
953 elif [[ $remote_host = lcsgih  ||  $remote_host = lcsgib ]]
954 then
955
956    if [[ "$sgi_feature" != "" ]]
957    then
958       feature_directive="#PBS -l feature=$sgi_feature"
959    else
960       feature_directive=""
961    fi
962
963    if [[ $queue = dataq || $queue = permq ]]
964    then
965       feature_directive="#PBS -l feature=data"
966    fi
967
968    if [[ $queue = testq  || $queue = mediumq  ||  $queue = bigq  ||  $queue = workq  ||  $queue = dataq  ||  $queue = permq ||  $queue = serialq  ||  $queue = special1q ]]
969    then
970       queue_directive="#PBS -q $queue"
971    else
972       queue_directive=""
973    fi
974
975    if [[ $email_notification = none ]]
976    then
977       email_directive=""
978    else
979       email_directive="#PBS -M $email_notification"
980    fi
981
982    if [[ $numprocs != 0 ]]
983    then
984       cat > $job_to_send << %%END%%
985#!/bin/bash
986#PBS -N $job_name
987#PBS -l walltime=$timestring
988#PBS -l nodes=$nodes:ppn=${processes_per_node}
989#PBS -l naccesspolicy=$node_usage
990#PBS -o $remote_dayfile
991#PBS -j oe
992$feature_directive
993$queue_directive
994$email_directive
995
996eval \`/sw/swdist/bin/modulesinit\`
997#. /usr/share/modules/init/bash
998$init_cmds
999$module_calls
1000
1001echo ld_library_path=\$LD_LIBRARY_PATH
1002
1003%%END%%
1004
1005    else
1006       cat > $job_to_send << %%END%%
1007#PBS -S /bin/bash
1008#PBS -N $job_name
1009#PBS -l walltime=$timestring
1010#PBS -l ncpus=1
1011#PBS -o $remote_dayfile
1012#PBS -j oe
1013$queue_directive
1014$email_directive
1015
1016eval \`/sw/swdist/bin/modulesinit\`
1017#. /usr/share/modules/init/bash
1018$init_cmds
1019$module_calls
1020
1021%%END%%
1022
1023    fi
1024
1025 elif [[ $remote_host = lcxe6 ]]
1026 then
1027
1028    if [[ $numprocs != 0 ]]
1029    then
1030       cat > $job_to_send << %%END%%
1031#!/bin/ksh
1032#PBS -S /bin/ksh
1033#PBS -N $job_name
1034#PBS -A $project_account
1035#PBS -j oe
1036#PBS -l walltime=$timestring
1037#PBS -l mppwidth=${numprocs}
1038#PBS -l mppnppn=${processes_per_node}
1039#PBS -m abe
1040#PBS -o $remote_dayfile
1041$email_directive
1042
1043$init_cmds
1044$module_calls
1045
1046%%END%%
1047
1048    else
1049       cat > $job_to_send << %%END%%
1050#!/bin/ksh
1051#PBS -S /bin/ksh
1052#PBS -N $job_name
1053#PBS -A $project_account
1054#PBS -j oe
1055#PBS -l walltime=$timestring
1056#PBS -l ncpus=1
1057#PBS -l pmem=${memory}mb
1058#PBS -m abe
1059$email_directive
1060#PBS -o $remote_dayfile
1061
1062$init_cmds
1063$module_calls
1064
1065%%END%%
1066
1067    fi
1068
1069 elif [[ $remote_host = lckyoto ]]
1070 then
1071
1072       cat > $job_to_send << %%END%%
1073#!/bin/ksh
1074# @\$-o $remote_dayfile
1075# @\$-eo -oi
1076# @\$-lP 16
1077# @\$-lp 1
1078# @\$-lm 28gb  -llm unlimited -ls unlimited
1079# @\$-q $queue
1080# @\$-Pvn abs_pack
1081##for intel? @\$-Pvn abs_unpack -Pvs unpack -Pvc unpack
1082#. /thin/local/etc/setprofile/intel-11.0.sh
1083#. /thin/local/etc/setprofile/mvapich2-1.4+intel-11.0.sh
1084. ~/.myprofile
1085#. /home2/t/t51254/palm/current_version/myprofile
1086#. /thin/apps/pgi/mpi.sh
1087#
1088env
1089#
1090set -x
1091
1092%%END%%
1093
1094 elif [[ $remote_host = lcxt5m ]]
1095 then
1096
1097    if [[ $numprocs != 0 ]]
1098    then
1099       cat > $job_to_send << %%END%%
1100#!/bin/ksh
1101#PBS -S /bin/ksh
1102#PBS -N $job_name
1103#PBS -j oe
1104#PBS -l walltime=$timestring
1105#PBS -l mppwidth=${numprocs}
1106#PBS -l mppnppn=${processes_per_node}
1107#PBS -m abe
1108#PBS -o $remote_dayfile
1109
1110$init_cmds
1111$module_calls
1112
1113%%END%%
1114
1115    else
1116       cat > $job_to_send << %%END%%
1117#!/bin/ksh
1118#PBS -S /bin/ksh
1119#PBS -N $job_name
1120#PBS -j oe
1121#PBS -l walltime=$timestring
1122#PBS -l ncpus=1
1123#PBS -l pmem=${memory}mb
1124#PBS -m abe
1125#PBS -o $remote_dayfile
1126
1127$init_cmds
1128$module_calls
1129
1130%%END%%
1131
1132    fi
1133
1134 elif [[ $remote_host = nech ]]
1135 then
1136
1137    if (( nodes > 1 ))
1138    then
1139       cat > $job_to_send << %%END%%
1140#!/bin/ksh
1141#PBS -l cpunum_prc=$processes_per_node,cputim_job=$cputime
1142#PBS -l ${qsubmem}=${Memory}gb
1143#PBS -b $nodes
1144#PBS -o $remote_dayfile
1145#PBS -N palm
1146#PBS -j o
1147#PBS -T mpisx
1148
1149%%END%%
1150
1151    elif [[ $numprocs != 0 ]]
1152    then
1153       cat > $job_to_send << %%END%%
1154#!/bin/ksh
1155#PBS -l cpunum_prc=$processes_per_node,cputim_job=$cputime
1156#PBS -l ${qsubmem}=${Memory}gb
1157#PBS -o $remote_dayfile
1158#PBS -N palm
1159#PBS -j o
1160
1161%%END%%
1162
1163    else
1164       cat > $job_to_send << %%END%%
1165#!/bin/ksh
1166#PBS -l ${qsubmem}=${Memory}gb,${qsubtime}=$cputime
1167#PBS -o $remote_dayfile
1168#PBS -j o
1169
1170%%END%%
1171
1172    fi
1173
1174 elif [[ $remote_host = necriam ]]
1175 then
1176
1177    if (( nodes > 1 ))
1178    then
1179       cat > $job_to_send << %%END%%
1180#!/bin/ksh
1181#PBS -b $nodes
1182#PBS -o $remote_dayfile
1183#PBS -N $job_name
1184#PBS -j o
1185#PBS -v MPIPROGINV=YES
1186
1187%%END%%
1188
1189    elif [[ $numprocs != 0 ]]
1190    then
1191       cat > $job_to_send << %%END%%
1192#!/bin/ksh
1193#PBS -q ${queue}
1194#PBS -o $remote_dayfile
1195#PBS -N $job_name
1196#PBS -j o
1197#PBS -v MPIPROGINV=YES
1198
1199%%END%%
1200
1201    else
1202       cat > $job_to_send << %%END%%
1203#!/bin/ksh
1204#PBS -o $remote_dayfile
1205#PBS -j o
1206
1207%%END%%
1208
1209    fi
1210
1211 elif [[ $remote_host = lctit ]]
1212 then
1213    cat > $job_to_send << %%END%%
1214#!/bin/ksh
1215$init_cmds
1216$module_calls
1217
1218%%END%%
1219
1220       # OPTIONEN FUER SUBMIT-KOMMANDO ZUSAMMENSTELLEN
1221    if [[ $tasks_per_node != $processes_per_node ]]
1222    then
1223       submcom="$submcom -W group_list=$group_number -N $job_name -l walltime=$timestring -l select=$nodes:ncpus=$processes_per_node:mpiprocs=$tasks_per_node:mem=${Memory}gb -o $remote_dayfile -j oe -q $queue "
1224    else
1225       submcom="$submcom -W group_list=$group_number -N $job_name -l walltime=$timestring -l select=$nodes:ncpus=$processes_per_node:mpiprocs=$tasks_per_node:mem=${Memory}gb -l place=scatter -o $remote_dayfile -j oe -q $queue "
1226    fi
1227
1228 else
1229
1230    cat > $job_to_send << %%END%%
1231# @\$-q ${queue}
1232# @\$-l${qsubtime} $timestring
1233# @\$-l${qsubmem} ${memory}mb
1234# @\$-o $remote_dayfile
1235# @\$-eo
1236
1237%%END%%
1238
1239 fi
1240
1241
1242    # BEI RECHNUNG AUF REMOTE-MASCHINEN RUECKTRANSFER DES DAYFILES PER TRAP
1243    # BEI EXIT VERANLASSEN
1244    # VEKTORRECHNER MUSS EIGENEN JOB STARTEN, DA DORT NOHUP NICHT FUNKTIONIERT
1245    # AUF IBM IN SEOUL IST RUECKTRANSFER ZUR ZEIT GENERELL NICHT MOEGLICH
1246 if [[ $delete_dayfile = false  &&  $remote_host != $local_host ]]
1247 then
1248    echo "set +vx"                              >>  $job_to_send
1249    echo "trap '"                               >>  $job_to_send
1250    echo "set +vx"                              >>  $job_to_send
1251    if [[ $(echo $remote_host | cut -c1-3) = ibm  ||  $(echo $remote_host | cut -c1-5) = lcsgi  ||  $(echo $remote_host | cut -c1-3) = nec  ||  $remote_host = lckiaps ]]
1252    then
1253       if [[ $remote_host = ibmh ]]
1254       then
1255          return_queue=c1
1256       elif [[ $remote_host = ibmkisti ]]
1257       then
1258          return_queue=class.1-2
1259       elif [[ $remote_host = ibmku ]]
1260       then
1261          return_queue=sdbg2
1262       elif [[ $remote_host = ibms ]]
1263       then
1264          return_queue=p_normal
1265       elif [[ $remote_host = ibmy ]]
1266       then
1267          return_queue=serial
1268       elif [[ $remote_host = lcsgih  ||  $remote_host = lcsgib ]]
1269       then
1270          return_queue=serialq
1271       elif [[ $remote_host = necriam ]]
1272       then
1273          return_queue=SP
1274       elif [[ $remote_host = lckiaps ]]
1275       then
1276          return_queue=express
1277       else
1278          return_queue=unknown
1279       fi
1280
1281       if [[ $(echo $remote_host | cut -c1-3) = ibm ]]
1282       then
1283
1284          if [[ $remote_host = ibmku ]]
1285          then
1286             echo "echo \"#!/usr/bin/ksh\" >> scpjob.$kennung"            >>  $job_to_send
1287             echo "echo \"# @ shell = /usr/bin/ksh\" >> scpjob.$kennung"  >>  $job_to_send
1288          else
1289             echo "echo \"#!/bin/ksh\" >> scpjob.$kennung"                >>  $job_to_send
1290          fi
1291          echo "echo \"# @ job_type = serial\" >> scpjob.$kennung"    >>  $job_to_send
1292          echo "echo \"# @ job_name = transfer\" >> scpjob.$kennung"  >>  $job_to_send
1293          echo "echo \"# @ resources = ConsumableCpus(1) ConsumableMemory(1 gb)\" >> scpjob.$kennung"  >>  $job_to_send
1294          echo "echo \"# @ wall_clock_limit = 00:10:00,00:10:00\" >> scpjob.$kennung "  >>  $job_to_send
1295          echo "echo \"# @ output = job_queue/last_job_transfer_protocol\" >> scpjob.$kennung"  >>  $job_to_send
1296          echo "echo \"# @ error = job_queue/last_job_transfer_protocol\" >> scpjob.$kennung"  >>  $job_to_send
1297          if [[ $host != "ibmh" ]]
1298          then
1299             echo "echo \"# @ class = $return_queue\" >> scpjob.$kennung"  >>  $job_to_send
1300          fi
1301          echo "echo \"# @ image_size = 10\" >> scpjob.$kennung"      >>  $job_to_send
1302          echo "echo \"# @ notification = never\" >> scpjob.$kennung" >>  $job_to_send
1303
1304          echo "echo \"# @ queue\" >> scpjob.$kennung"                >>  $job_to_send
1305          echo "echo \" \" >> scpjob.$kennung"                        >>  $job_to_send
1306
1307          echo "echo \"set -x\" >> scpjob.$kennung"                   >>  $job_to_send
1308          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
1309          if [[ $remote_host = ibmku ]]
1310          then
1311             echo "echo \"rm  scpjob.$kennung\" >> scpjob.$kennung"   >>  $job_to_send
1312          fi
1313          echo "echo \"exit\" >> scpjob.$kennung"                     >>  $job_to_send
1314
1315       elif [[ $remote_host = nech ]]
1316       then
1317          echo "cd /pf/b/${remote_user}/job_queue" >>  $job_to_send
1318          echo "cat > scpjob.$kennung << %%END%%"  >>  $job_to_send
1319          echo "#PBS -l ${qsubmem}=1GB,${qsubtime}=100"  >>  $job_to_send
1320          echo "#PBS -o last_job_transfer_protocol"      >>  $job_to_send
1321          echo "#PBS -j o"                         >>  $job_to_send
1322          echo " "                                 >>  $job_to_send
1323          echo "set -x"                            >>  $job_to_send
1324          echo "cd /pf/b/${remote_user}/job_queue" >>  $job_to_send
1325          echo "batch_scp  -d  -w 10  -u $local_user $local_addres  $remote_dayfile  \"$job_catalog\"  $local_dayfile"  >>  $job_to_send
1326          echo "[[ \"\$for_subjob_to_do\" != \"\" ]]  &&  eval \$for_subjob_to_do"  >>  $job_to_send
1327          echo "%%END%%"                           >>  $job_to_send
1328
1329       elif [[ $remote_host = necriam ]]
1330       then
1331          echo "cat > scpjob.$kennung << %%END%%"  >>  $job_to_send
1332          echo "#PBS -q $return_queue"             >>  $job_to_send
1333          echo "#PBS -o last_job_transfer_protocol"      >>  $job_to_send
1334          echo "#PBS -j o"                         >>  $job_to_send
1335          echo " "                                 >>  $job_to_send
1336          echo "set -x"                            >>  $job_to_send
1337          echo "batch_scp  -d  -w 10  -u $local_user $local_addres  $remote_dayfile  \"$job_catalog\"  $local_dayfile"  >>  $job_to_send
1338          echo "[[ \"\$for_subjob_to_do\" != \"\" ]]  &&  eval \$for_subjob_to_do"  >>  $job_to_send
1339          echo "%%END%%"                           >>  $job_to_send
1340
1341       elif [[ $(echo $remote_host | cut -c1-5) = lcsgi ]]
1342       then
1343          echo "cat > scpjob.$kennung << %%END%%"  >>  $job_to_send
1344          echo "#!/bin/bash"                             >>  $job_to_send
1345          echo "#PBS -N job_protocol_transfer"           >>  $job_to_send
1346          echo "#PBS -l walltime=00:30:00"               >>  $job_to_send
1347          echo "#PBS -l nodes=1:ppn=1"                   >>  $job_to_send
1348          echo "#PBS -l feature=data"                    >>  $job_to_send
1349          echo "#PBS -o \$HOME/job_queue/last_job_transfer_protocol"      >>  $job_to_send
1350          echo "#PBS -j oe"                        >>  $job_to_send
1351          echo " "                                 >>  $job_to_send
1352          echo ". /usr/share/modules/init/bash"    >>  $job_to_send
1353          echo "set -x"                            >>  $job_to_send
1354          echo "batch_scp  -d  -w 10  -u $local_user $local_addres  ${job_catalog}/$remote_dayfile  \"$job_catalog\"  $local_dayfile"  >>  $job_to_send
1355          echo "[[ \"\$for_subjob_to_do\" != \"\" ]]  &&  eval \$for_subjob_to_do"  >>  $job_to_send
1356          echo "%%END%%"                           >>  $job_to_send
1357
1358       else
1359
1360          echo "cat > scpjob.$kennung << %%END%%"  >>  $job_to_send
1361          echo "# @\\\$-q $return_queue"           >>  $job_to_send
1362          echo "# @\\\$-l${qsubtime} 10"           >>  $job_to_send
1363          echo "# @\\\$-l${qsubmem} 10mb"          >>  $job_to_send
1364          if [[ $remote_host = t3ej2  ||  $remote_host = t3ej5  ||  $remote_host = t3es ]]
1365          then
1366             echo "# @\$-l mpp_p=0"                >>  $job_to_send
1367          fi
1368          echo '# @\$-lF 10mb'                     >>  $job_to_send
1369#          echo '# @\$-o /dev/null'                 >>  $job_to_send
1370          echo '# @\$-o job_queue/last_job_transfer_protocol'    >>  $job_to_send
1371          echo '# @\\\$-eo'                          >>  $job_to_send
1372          echo " "                                 >>  $job_to_send
1373          if [[ $remote_host = t3ej2  ||  $remote_host = t3ej5 ]]
1374          then
1375             echo "set +vx"                        >>  $job_to_send
1376             echo ". .profile"                     >>  $job_to_send
1377          fi
1378          echo "set -x"                            >>  $job_to_send
1379          echo "batch_scp  -d  -w 10  -u $local_user $local_addres  ${job_catalog}/$remote_dayfile  \"$job_catalog\"  $local_dayfile  >  /dev/null"  >>  $job_to_send
1380          echo "[[ \"\$for_subjob_to_do\" != \"\" ]]  &&  eval \$for_subjob_to_do"  >>  $job_to_send
1381          echo "%%END%%"                           >>  $job_to_send
1382       fi
1383
1384       if [[ $(echo $remote_host | cut -c1-3) = ibm ]]
1385       then
1386          echo "llsubmit  scpjob.$kennung"      >>  $job_to_send
1387       elif [[ $(echo $remote_host | cut -c1-5) = lcsgi ]]
1388       then
1389          echo "rm -rf \$HOME/job_queue/last_job_transfer_protocol"  >>  $job_to_send
1390          echo "chmod  u+x  scpjob.$kennung"                         >>  $job_to_send
1391          echo "msub  scpjob.$kennung"                               >>  $job_to_send
1392       elif [[ $remote_host = t3eb  ||  $remote_host = t3eh  ||  $remote_host = t3ej2  ||  $remote_host = t3ej5 ]]
1393       then
1394          echo "qsub -J n  scpjob.$kennung"     >>  $job_to_send
1395       elif [[ $remote_host = t3es ]]
1396       then
1397          echo "qsub -J n  -s /bin/ksh  scpjob.$kennung"     >>  $job_to_send
1398       elif [[ $remote_host = lckiaps ]]
1399       then
1400          echo "mv  scpjob.$kennung  $job_catalog"           >>  $job_to_send
1401          echo "ssh ${remote_username}@${remote_addres}  \"$submcom ${job_catalog}/scpjob.$kennung\" "  >>  $job_to_send
1402          echo "rm  ${job_catalog}/scpjob.$kennung"          >>  $job_to_send
1403       else
1404          echo "$submcom  scpjob.$kennung"      >>  $job_to_send
1405       fi
1406       if [[ $remote_host != ibmku  &&  $remote_host != lckiaps ]]
1407       then
1408          echo "rm  scpjob.$kennung"            >>  $job_to_send
1409       fi
1410       if [[ $remote_host = nech ]]
1411       then
1412          echo "cd -"                           >>  $job_to_send
1413       fi
1414    else
1415#       echo "ftpcopy  -d  $local_addres  ${job_catalog}/$remote_dayfile  \"$job_catalog\"  $local_dayfile"  >>  $job_to_send
1416       echo "nohup  ftpcopy  -d  -w 15  $local_addres  ${job_catalog}/$remote_dayfile  \"$job_catalog\"  $local_dayfile  >  /dev/null  &"  >>  $job_to_send
1417    fi
1418    echo "set -x"                               >>  $job_to_send
1419    echo "     ' exit"                          >>  $job_to_send
1420    echo "set -x"                               >>  $job_to_send
1421 fi
1422
1423
1424
1425    # EIGENTLICHE JOB-DATEI AN QSUB-KOMMANDOS ANHAENGEN
1426 cat  $file_to_send  >>  $job_to_send
1427
1428 if [[ $remote_host = ibm ]]
1429 then
1430    echo " "         >>  $job_to_send
1431    echo "exit"      >>  $job_to_send
1432 fi
1433
1434    # remove job file
1435 if [[ $remote_host = lctit  ||  $remote_host = ibmku ]]
1436 then
1437    echo " "                               >>  $job_to_send
1438    echo "rm ~/job_queue/$job_on_remhost"  >>  $job_to_send
1439 fi
1440
1441
1442
1443    # USER-NAME AUF ZIELRECHNER AUS .NETRC-DATEI ERMITTELN
1444 if [[ -z $remote_user ]]
1445 then
1446    if [[ $remote_host = t3eb  ||  $remote_host = t3eh  ||  $remote_host = t3ej2  ||  $remote_host = t3ej5  ||  $remote_host = t3es  ||  $remote_host = vpp ]]
1447    then
1448       grep  $remote_addres  ~/.netrc | read dum dum dum remote_user dum dum
1449    fi
1450 fi
1451
1452
1453
1454    # JOB AUF ZIELRECHNER TRANSFERIEREN BZW. INS JOBVERZEICHNIS KOPIEREN
1455 if [[ $no_submit = false ]]
1456 then
1457    if [[ $remote_host != $local_host ]]
1458    then
1459       [[ $verify = true ]]  &&  printf "\n >>> transfering job to \"$remote_host\"..."
1460       if [[ $remote_host = ibms  ||  $remote_host = ibmy ]]    # ssh on ibms cannot handle "~/"
1461       then
1462          job_catalog_save=$job_catalog
1463          job_catalog=job_queue
1464       elif [[ $remote_host = nech ]]
1465       then
1466          job_catalog_save=$job_catalog
1467          job_catalog=/hpf/b/${remote_user}/job_queue
1468       fi
1469       if [[ $local_host = decalpha ]]
1470       then
1471             # VERWENDUNG VON SCP AUF DECALPHA FRAGT FEHLERHAFTERWEISE
1472             # PASSWORT AB
1473          /bin/scp  $job_to_send  ${remote_user}@${remote_addres}:${job_catalog}/$job_on_remhost
1474       elif [[ $remote_host = nech ]]
1475       then
1476             # DATEIEN KOENNEN NUR UEBER DEN ARCHIVE-SERVER DES DKRZ
1477             # TRANSFERIERT WERDEN
1478          scp  $job_to_send  ${remote_user}@136.172.44.205:${job_catalog}/$job_on_remhost
1479       else
1480          scp  $job_to_send  ${remote_user}@${remote_addres}:${job_catalog}/$job_on_remhost
1481       fi
1482       if [[ $? = 1 ]]
1483       then
1484          locat=scp; exit
1485       fi
1486       if [[ $remote_host = ibms ]]
1487       then
1488          job_catalog=$job_catalog_save
1489       fi
1490       [[ $verify = true ]]  &&  printf "\n >>> finished\n"
1491    else
1492       eval  job_catalog=$job_catalog
1493       cp  $job_to_send  ${job_catalog}/$job_on_remhost
1494    fi
1495
1496
1497
1498       # NQS- BZW. LOADLEVELER-JOB STARTEN
1499    if [[ $remote_host != $local_host ]]
1500    then
1501       [[ $verify = true ]]  &&  printf "\n >>> submitting job using \"qsub\"...\n"
1502
1503       if [[ $(echo $remote_host | cut -c1-5) = lcsgi  &&  $prio = true ]]
1504       then
1505          printf "\n >>> submit with HLRN qos-feature hiprio...\n"
1506          ssh  $remote_addres  -l $remote_user  "cd $job_catalog; $submcom -l qos=hiprio $job_on_remhost; rm $job_on_remhost"
1507       elif [[ $remote_host = ibmku ]]
1508       then
1509          ssh  $remote_addres  -l $remote_user  "cd $job_catalog; $submcom $job_on_remhost"
1510       else
1511          ssh  $remote_addres  -l $remote_user  "cd $job_catalog; $submcom $job_on_remhost; rm $job_on_remhost"
1512       fi
1513
1514       [[ $verify = true ]]  &&  printf " >>> o.k.\n"
1515    else
1516       cd  $job_catalog
1517       if [[ $(echo $local_host | cut -c1-5) = lcsgi  ||  $(echo $local_host | cut -c1-3) = ibm ]]
1518       then
1519          eval  $submcom  $job_on_remhost
1520       elif [[  $local_host = lcfimm  ||  $local_host = lctit  ||  $localhost = lcxe6  ||  $localhost = lck  || $localhost = lckordi ||  $localhost = lcyon || $localhost = lcsb ]]
1521       then
1522          chmod  u+x  $job_on_remhost
1523          echo "$submcom  $job_on_remhost"
1524          eval  $submcom  $job_on_remhost
1525       elif [[ $local_host = nech ]]
1526       then
1527          if [[ $queue = default ]]
1528          then
1529             eval  $submcom  $job_on_remhost
1530          else
1531             eval  $submcom  -q $queue  $job_on_remhost
1532          fi
1533       else
1534          qsub  $job_on_remhost
1535       fi
1536
1537          # Jobfile must not be deleted on lctit/ibmku!! This will be done
1538          # only at the end of the job.
1539       if [[ $local_host != lctit  &&  $local_host != ibmku ]]
1540       then
1541          rm  $job_on_remhost
1542       fi
1543       cd  -  > /dev/null
1544    fi
1545 fi
1546
1547
1548
1549    # ABSCHLUSSARBEITEN
1550
1551 if [[ $no_submit = false ]]
1552 then
1553    rm  $job_to_send
1554 fi
1555 [[ $verify = true ]]  &&  printf "\n\n *** SUBJOB finished \n\n"
Note: See TracBrowser for help on using the repository browser.