source: palm/trunk/SCRIPTS/subjob @ 2316

Last change on this file since 2316 was 2295, checked in by raasch, 7 years ago

script adjustments for using lcgeohu, cpp_opts removed

  • Property svn:keywords set to Id Rev
File size: 55.7 KB
Line 
1#!/bin/bash
2
3# subjob - script for automatic generation and submission of batch-job files
4#          for various batch queuing systems
5
6#--------------------------------------------------------------------------------#
7# This file is part of PALM.
8#
9# PALM is free software: you can redistribute it and/or modify it under the terms
10# of the GNU General Public License as published by the Free Software Foundation,
11# either version 3 of the License, or (at your option) any later version.
12#
13# PALM is distributed in the hope that it will be useful, but WITHOUT ANY
14# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License along with
18# PALM. If not, see <http://www.gnu.org/licenses/>.
19#
20# Copyright 1997-2014  Leibniz Universitaet Hannover
21#--------------------------------------------------------------------------------#
22#
23# Current revisions:
24# ------------------
25#
26#
27# Former revisions:
28# -----------------
29# $Id: subjob 2295 2017-06-27 14:25:52Z maronga $
30# adjustments for using lcgeohu (cirrus @ HUB)
31#
32# 2266 2017-06-09 09:27:21Z raasch
33# nech related parts removed
34#
35# 2257 2017-06-07 14:07:05Z witha
36# adjustments for lceddy, removed lcflow-specific code
37#
38# 2188 2017-03-21 06:42:42Z raasch
39#
40# 2187 2017-03-21 06:41:25Z raasch
41# adjustment of compute node names for lckyuh
42#
43# 2184 2017-03-21 04:31:22Z raasch
44# bugfix: localhost renamed local_host
45#
46# 2148 2017-02-09 16:56:42Z scharf
47# added kuma and gharbi to the list of known hosts
48#
49# 2134 2017-02-02 07:33:46Z raasch
50# option -E added to msub commands on HLRN-III machines to allow output of more
51# job informations in the job protocol files
52#
53# 1944 2016-06-15 06:29:00Z raasch
54# adjustments for using HLRN ssh-keys
55#
56# 1940 2016-06-14 05:15:20Z raasch
57# adjustments for lckiaps
58#
59# 1866 2016-04-15 06:50:59Z raasch
60# adjusted for lcocean
61#
62# 1841 2016-04-07 19:14:06Z raasch
63# script now running under bash
64#
65# 1701 2015-11-02 07:43:04Z maronga
66# Bugfix: added missing init_cmds for lccrayh/lccrayb
67#
68# 1621 2015-07-17 11:39:33Z heinze
69# adjustments for Mistral at DKRZ Hamburg (lcbullhh)
70#
71# 1575 2015-03-27 09:56:27Z raasch
72# mpp2-queues added to lccrayh
73#
74# 1547 2015-01-29 15:09:12Z witha
75# adjustments for ForWind computing cluster (lcflow)
76#
77# 1545 2015-01-29 06:52:23Z heinze
78# local host name for blizzard further specified
79#
80# 1480 2014-10-17 14:41:49Z raasch
81# adjustments for 2nd stage of HLRNIII
82#
83# 1468 2014-09-24 14:06:57Z maronga
84# Typo removed (addres->address)
85# Adjustments for lcxe6
86#
87# 1452 2014-08-22 09:41:06Z heinze
88# local hosts for blizzard added
89#
90# 1450 2014-08-21 07:31:51Z heinze
91# HLRN-III (lccrayb): testq queue adjusted to mpp1testq
92#
93# 1442 2014-07-28 07:09:10Z raasch
94# HLRN-III (lccrayb/lccrayh) queues adjusted
95#
96# 1378 2014-04-28 06:04:58Z raasch
97# -et option added for lctit
98#
99# 1350 2014-04-04 13:01:30Z maronga
100# location of qsub updated for lcxe6
101#
102# 1289 2014-03-04 07:12:34Z raasch
103# German comments translated to English
104# fimm-, necriam-, scirocco-, ibmy-, and sgi-specific code removed
105#
106# 1279 2014-01-28 12:10:14Z raasch
107# node calculation modified due to changes in mrun (tasks_per_node must not be
108# an integral divisor of numprocs any more)
109#
110# 1274 2014-01-09 13:14:54Z heinze
111# adjustments for lccrayh
112#
113# 1266 2013-12-11 12:07:34Z heinze
114# further adjustments for lccrayb (use msub instead of qsub)
115#
116# 1264 2013-12-09 12:46:09Z fricke
117# Bugfix: Using number of nodes instead of number of processors (lccrayb)
118#
119# 1262 2013-12-09 10:57:20Z fricke
120# further adjustments for lccrayb
121#
122# 1260 2013-12-04 12:48:04Z raasch
123# jaboticaba admitted
124#
125# 1255 2013-11-07 14:43:35Z raasch
126# further adjustments for lccrayb
127#
128# 1224 2013-09-16 07:27:23Z raasch
129# first adjustments for lccrayb
130#
131# 1202 2013-07-10 16:22:07Z witha
132# adjustments for Forwind cluster (lcflow)
133#
134# 1199 2013-07-05 14:52:22Z raasch
135# adjustments for CSC Helsinki (lccrayf)
136#
137# use of cluster/express queue enabled (ibmh)
138# vinessa added (imuk)
139#
140# 1103 2013-02-20 02:15:53Z raasch
141# bash compatibility adjustments (usage of OPTIND, output formatting with printf
142# instead typeset -L/R),
143# further adjustments for lckyuh
144#
145# 2013-02-10 01:47:43Z raasch
146# adjustments for Kyushu-Univeristy computing center (lckyuh - hayaka)
147# and for Forwind cluster (lcflow)
148#
149# 1094 2013-02-03 01:52:12Z raasch
150# new option -P for explicit setting of ssh/scp port,
151# decalpha parts (yonsei) removed
152#
153# 2013-02-02 07:06:13Z raasch
154# adjustments for Kyushu-University computing center (lckyut - tatara)
155# old changelog messages removed
156#
157# 1046 2012-11-09 14:38:45Z maronga
158# code put under GPL (PALM 3.9)
159#
160# 08/07/94 - Siggi - first version finished
161# 29/06/94 - Siggi - script development started
162#--------------------------------------------------------------------------------#
163# subjob - script for automatic generation and submission of batch-job files
164#          for various batch queuing systems
165#--------------------------------------------------------------------------------#
166
167
168    # VARIABLE-DECLARATIONS AND DEFAULT VALUES
169 delete_dayfile=false
170 email_notification=none
171 group_number=none
172 locat=normal
173 no_default_queue=none
174 no_submit=false
175 job_catalog="~/job_queue"
176 job_name=none
177 local_user=$LOGNAME
178 node_usage=shared
179 numprocs=0
180 punkte="..........................................................."
181 submcom=qsub
182 queue=default
183 remote_host=none
184 remote_user=""
185 verify=true
186
187 typeset  -i   cputime=memory=Memory=0  minuten  resttime  sekunden  stunden
188 typeset  -i   numprocs  mpi_tasks=nodes=processes_per_node=0 tasks_per_node=threads_per_task=1
189
190
191
192    # ERROR HANDLING
193    # IN CASE OF EXIT:
194 trap 'if [[ $locat != normal ]]
195       then
196          case  $locat  in
197             (option)  printf "\n  --> available optios can be displayed"
198                       printf " by typing:"
199                       printf "\n      \"subjob ?\" \n";;
200             (ftpcopy|parameter|scp|verify)  printf "\n";;
201             (*)       printf "\n  +++ unknown error"
202                       printf "\n      please inform S. Raasch!\n"
203          esac
204          [[ -f $job_to_send ]]  &&  rm  $job_to_send
205          printf "\n\n+++ SUBJOB killed \n\n"
206       fi' exit
207
208
209    # IN CASE OF TERMINAL-BREAK:
210 trap '[[ -f $job_to_send ]]  &&  rm  $job_to_send
211       printf "\n\n+++ SUBJOB killed \n\n"
212       exit
213      ' 2
214
215
216    # DETERMINE NAME OF LOCAL HOST
217 local_host=$(hostname)
218
219    # SET HOST-SPECIFIC VARIABLES VEREINBAREN (CHECK, IF LOCAL HOST
220    # IS ADMITTED AT ALL)
221    # NOTE: ONE OF THE ENTRIES FOR "lck" OR "lckordi" ALWAYS HAS TO BE
222    # COMMENT OUT, BECAUSE THE HOSTNAME (node*) IS SAME FOR BOTH MACHINES
223 case  $local_host  in
224     (ambiel-lx)             local_address=134.106.74.48;  local_host=lcfor;;
225     (atmos)                 local_address=172.20.25.35;   local_host=lcide;;
226     (austru)                local_address=130.75.105.128; local_host=lcmuk;;
227     (autan)                 local_address=130.75.105.57;  local_host=lcmuk;;
228     (bora)                  local_address=130.75.105.103; local_host=lcmuk;;
229     (a0*|b0*)               local_address=133.5.4.33;     local_host=lckyuh;;
230     (blizzard1|p0*|p1*|p2*|p3*|p4*|p5*|p6*|p7*|p8*|p9*)   local_address=136.172.40.15;  local_host=ibmh;;
231     (blizzard2|p0*|p1*|p2*|p3*|p4*|p5*|p6*|p7*|p8*|p9*)   local_address=136.172.40.16;  local_host=ibmh;;
232     (blogin*|bxc*)          local_address=130.73.233.1;   local_host=lccrayb;;
233     (hlogin*|hxc*)          local_address=130.75.4.1;     local_host=lccrayh;;
234     (breva)                 local_address=130.75.105.98;  local_host=lcmuk;;
235     (buran)                 local_address=130.75.105.58;  local_host=lcmuk;;
236     (caurus)                local_address=130.75.105.19;  local_host=lcmuk;;
237     (climate*)              local_address=165.132.26.68;  local_host=lcyon;;
238     (clogin*)               local_address=86.50.166.21;   local_host=lccrayf;;
239     (elephanta)             local_address=130.75.105.6;   local_host=lcmuk;;
240     (hpcl*)                 local_address=eddy.hpc.uni-oldenburg.de; local_host=lceddy;;
241     (cfd*)                  local_address=eddy.hpc.uni-oldenburg.de; local_host=lceddy;;
242     (node*)                 local_address=165.132.26.61   local_host=lck;;
243   #  (node*)                 local_address=210.219.61.8    local_host=lckordi;;
244     (gaia*)                 local_address=150.183.146.24; local_host=ibmkisti;;
245     (gharbi)                local_address=130.75.105.47;  local_host=lcmuk;;
246     (gallego)               local_address=130.75.105.10;  local_host=lcmuk;;
247     (gregale)               local_address=130.75.105.109; local_host=lcmuk;;
248     (hababai)               local_address=130.75.105.108; local_host=lcmuk;;
249     (hayaka*)               local_address=133.5.4.33;     local_host=lckyuh;;
250     (hexagon.bccs.uib.no)   local_address=129.177.20.113; local_host=lcxe6;;
251     (hx*)                   local_address=133.3.51.11;    local_host=lckyoto;;
252     (inferno)               local_address=130.75.105.5;   local_host=lcmuk;;
253     (irifi)                 local_address=130.75.105.104; local_host=lcmuk;;
254     (jaboticaba)            local_address=150.163.25.181; local_host=lcbr;;
255     (sno)                   local_address=130.75.105.113; local_host=lcmuk;;
256     (kuma)                  local_address=130.75.105.115; local_host=lcmuk;;
257     (levanto)               local_address=130.75.105.45;  local_host=lcmuk;;
258     (login*)                local_address=118.128.66.201; local_host=lckiaps;;
259     (maestro)               local_address=130.75.105.2;   local_host=lcmuk;;
260     (meller)                local_address=134.106.74.155; local_host=lcfor;;
261     (meteo-login*)          local_address=193.166.211.144;local_host=lcxt5m;;
262     (mlogin1*|m1*)          local_address=136.172.50.13;  local_host=lcbullhh;;
263     (hexagon*)              local_address=129.177.20.113; local_host=lcxe6;;
264     (nobel*)                local_address=150.183.5.101;  local_host=ibms;;
265     (ocean)                 local_address="ocean";        local_host=lcocean;;
266     (orkan)                 local_address=130.75.105.3;   local_host=lcmuk;;
267     (ostria)                local_address=130.75.105.106; local_host=lcmuk;;
268     (paesano)               local_address=130.75.105.46;  local_host=lcmuk;;
269     (pcj*)                  local_address=172.31.120.1;   local_host=lckyut;;
270     (pingui)                local_address=134.106.74.118; local_host=lcfor;;
271     (quanero)               local_address=130.75.105.107; local_host=lcmuk;;
272     (rte*)                  local_address=133.5.185.60;   local_host=lcrte;;
273     (schultzl-Latitude-E6540)  local_address="schultzl-Latitude-E6540"; local_host=lcsch;;
274     (shiokaze-lx)           local_address=134.106.74.123; local_host=lcfor;;
275     (sisu-login*)           local_address=86.50.166.21;   local_host=lccrayf;;
276     (solano)                local_address=130.75.105.110; local_host=lcmuk;;
277     (sugoka*)               local_address=172.31.120.1;   local_host=lckyut;;
278     (tc*)                   local_address="ocean";        local_host=lcocean;;
279     (t2a*)                  local_address=10.1.6.165;     local_host=lctit;;
280     (urban*)                local_address=147.46.30.151   local_host=lcsb;;
281     (vinessa)               local_address=130.75.105.112; local_host=lcmuk;;
282     (vorias)                local_address=172.20.25.43;   local_host=lcmuk;;
283     (*.cc.kyushu-u.ac.jp)   local_address=133.5.4.129;    local_host=ibmku;;
284     (*.cluster)             local_address=192.168.1.254;  local_host=lcgeohu;;
285     (*)                     printf "\n  +++ \"$local_host\" unknown";
286                             printf "\n      please contact the PALM group at IMUK";
287                             locat=parameter; exit;;
288 esac
289
290
291
292    # BY DEFAULT, THE REMOTE HOST IS THE LOCAL HOST
293 remote_host=$local_host
294
295
296
297
298    # READ THE SHELLSCRIPT-OPTIONS
299 while  getopts  :c:dDe:g:h:m:n:N:O:P:q:t:T:u:vX:  option
300 do
301   case  $option  in
302       (c)   job_catalog=$OPTARG;;
303       (d)   delete_dayfile=true;;
304       (D)   no_submit=true;;
305       (e)   email_notification=$OPTARG;;
306       (g)   group_number=$OPTARG;;
307       (h)   remote_host=$OPTARG;;
308       (m)   memory=$OPTARG;;
309       (n)   job_name=$OPTARG;;
310       (N)   node_usage=$OPTARG;;
311       (O)   threads_per_task=$OPTARG;;
312       (P)   scp_port=$OPTARG;;
313       (q)   no_default_queue=$OPTARG;;
314       (t)   cputime=$OPTARG;;
315       (T)   tasks_per_node=$OPTARG;;
316       (u)   remote_user=$OPTARG;;
317       (v)   verify=false;;
318       (X)   numprocs=$OPTARG;;
319       (\?)  printf "\n  +++ Option $OPTARG unknown \n";
320             locat=option; exit;;
321   esac
322 done
323
324
325    # GET THE NAME OF THE JOBFILE AS NEXT ARGUMENT
326 (( to_shift = $OPTIND - 1 ))
327 shift $to_shift; file_to_send=$1
328
329
330    # OUTPUT OF SHORT DESCRIPTION OF SCRIPT-OPTIONS
331 if [ "$1" = "?" ]
332 then
333   (printf "\n  *** subjob can be called as follows:\n"
334    printf "\n      subjob -c.. -d -D -h.. -m.. -q.. -t.. -u.. -v  <jobfile>\n"
335    printf "\n      Description of available options:\n"
336    printf "\n      Option  Description                         Default-Value"
337    printf "\n        -c    job-input- and output-catalog       ~/job_queue"
338    printf "\n        -d    no job-protocol will be created     ---"
339    printf "\n        -D    only the job-file will be created   ---"
340    printf "\n        -h    execution host, available hosts:    $remote_host"
341    printf "\n              ibm, ibmh, ibmkisti, ibmku, ibms, lc...,"
342    printf "\n              lckiaps, lctit"
343    printf "\n        -m    memory demand per process in MByte  ---"
344    printf "\n        -n    jobname                             <jobdatei>"
345    printf "\n        -O    threads per task (for OpenMP usage) 1"
346    printf "\n        -P    ssh/scp port                        default port"
347    printf "\n        -q    job-queue to be used                default"
348    printf "\n        -t    allowed cpu-time in seconds         ---"
349    printf "\n        -T    tasks per node (on parallel hosts)  ---"
350    printf "\n        -u    username on execution host          from .netrc"
351    printf "\n        -v    no prompt for confirmation          ---"
352    printf "\n        -X    # of processors (on parallel hosts) 1"
353    printf "\n "
354    printf "\n      The only possible positional parameter is <jobfile>:"
355    printf "\n      The complete NQS-job must be provided here."
356    printf "\n      <jobfile>=? creates this outline\n\n") | more
357    exit
358 fi
359
360
361
362    # CHECK, IF JOB-FILE HAS BEEN GIVEN AS ARGUMENT AND IF THE FILE ITSELF EXISTS
363 if [[ "$file_to_send" = "" ]]
364 then
365    printf "\n  +++ job-file missing"
366    locat=parameter; exit
367 else
368    if [[ -f $file_to_send ]]
369    then
370       true
371    else
372       printf "\n  +++ job-file: "
373       printf "\n           $file_to_send"
374       printf "\n      does not exist"
375       locat=parameter; exit
376    fi
377 fi
378
379
380
381    # IF NO JOBNAME HAS BEEN GIVEN, JOBNAME IS SET TO THE NAME OF THE JOB-FILE,
382    # PROVIDED THAT THE JOB-FILE NAME DOES NOT CONTAIN ANY PATH
383 if [[ $job_name = none ]]
384 then
385    job_name=$file_to_send
386 fi
387 if [[ $(echo $job_name | grep -c "/") != 0 ]]
388 then
389    printf "\n  +++ job-file name: "
390    printf "\n           $job_name"
391    printf "\n      must not contain \"/\"-characters"
392    locat=parameter; exit
393 fi
394
395
396
397
398    # SET HOST-SPECIFIC QUANTITIES, OR TERMINATE IN CASE OF UNKNOWN HOST,
399    # OR IF NO HOST HAS BEEN GIVEN
400 if [[ $remote_host = none ]]
401 then
402    printf "\n  +++ host missing"
403    locat=option; exit
404 else
405    case  $remote_host  in
406        (ibm)     queue=p690_standard; remote_address=134.76.99.81; submcom=/usr/lpp/LoadL/full/bin/llsubmit;;
407        (ibmh)    queue=cluster; remote_address=136.172.40.15; submcom=/usr/lpp/LoadL/full/bin/llsubmit;;
408        (ibmkisti) queue=class.32plus; remote_address=150.183.146.24; submcom=/usr/lpp/LoadL/full/bin/llsubmit;;
409        (ibmku)   queue=s4; remote_address=133.5.4.129; submcom=/usr/local/bin/llsubmit;;
410        (ibms)    queue=p_normal; remote_address=150.183.5.101; submcom=/usr/lpp/LoadL/full/bin/llsubmit;;
411        (lcbullhh)    queue=compute; remote_address=136.172.50.13; submcom=/usr/bin/sbatch;;
412        (lccrayb) queue=mpp1testq; remote_address=130.73.233.1; submcom="/opt/moab/default/bin/msub -E";;
413        (lccrayh) queue=mpp1testq; remote_address=130.75.4.1; submcom="/opt/moab/default/bin/msub -E";;
414        (lccrayf) queue=small; remote_address=86.50.166.21; submcom=/opt/slurm/default/bin/sbatch;;
415        (lceddy)  remote_address=eddy.hpc.uni-oldenburg.de; submcom=sbatch;;
416        (lcgeohu) remote_address=cirrus.geo.hu-berlin.de; submcom=sbatch;;
417        (lckyoto) remote_address=133.3.51.11; submcom=/thin/local/bin/qsub;;
418        (lck)     remote_address=165.132.26.61; submcom=/usr/torque/bin/qsub;;
419        (lckiaps) remote_address=118.128.66.201; submcom=/opt/pbs/default/bin/qsub;;
420        (lckordi) remote_address=210.219.61.8; submcom=/usr/torque/bin/qsub;;
421        (lckyuh)  remote_address=133.5.4.33; submcom=/usr/bin/pjsub;;
422        (lckyut)  remote_address=133.5.4.37; submcom=/usr/bin/pjsub;;
423        (lcocean) remote_address="ocean"; submcom=qsub;;
424        (lcsb)    remote_address=147.46.30.151; submcom=/usr/torque/bin/qsub;;
425        (lctit)   queue=S; remote_address=10.1.6.165; submcom=/opt/pbs/tools/bin/t2sub;;
426        (lcxe6)   remote_address=129.177.20.113; submcom=/opt/torque/default/bin/qsub;;
427        (lcxt5m)  remote_address=193.166.211.144; submcom=/opt/pbs/10.1.0.91350/bin/qsub;;
428        (lcyon)   remote_address=165.132.26.68; submcom=/usr/torque/bin/qsub;;
429        (*)       printf "\n  +++ hostname \"$remote_host\" not allowed";
430                  locat=parameter; exit;;
431    esac
432 fi
433
434
435    # CHECK, IF A VALID QUEUE HAS BEEN GIVEN
436 if [[ $no_default_queue != none ]]
437 then
438    error=false
439    ndq=$no_default_queue
440    case  $remote_host  in
441        (ibm)    case  $ndq  in
442                     (p690_express|p690_standard|p690_long)  error=false;;
443                     (*)                                     error=true;;
444                 esac;;
445        (ibmh)   case  $ndq  in
446                     (cluster|express)  error=false;;
447                     (*)                                     error=true;;
448                 esac;;
449        (ibmkisti)   case  $ndq  in
450                     (class.32plus|class.1-2|class.2-32)  error=false;;
451                     (*)                                     error=true;;
452                 esac;;
453        (ibmku)  case  $ndq  in
454                     (sdbg1|sdbg2|sdbg4|s4|s16|s32|s32-s)    error=false;;
455                     (*)                                     error=true;;
456                 esac;;
457        (ibms)   case  $ndq  in
458                     (express|normal|p_express|p_normal|p_normal_1.3|p_normal_1.7|grand)     error=false;;
459                     (*)                                     error=true;;
460                 esac;;
461        (lcbullhh) case  $ndq  in
462                     (compute|compute2|shared)  error=false;;
463                     (*)                                     error=true;;
464                 esac;;
465        (lccrayb) case  $ndq  in
466                     (dataq|mpp1q|mpp1testq|mpp2q|mpp2testq|smp1q|smp1testq|specialm1q)   error=false;;
467                     (*)                                     error=true;;
468                 esac;;
469        (lccrayh) case  $ndq  in
470                     (dataq|mpp1q|mpp1testq|mpp2q|mpp2testq|smp1q|smp1testq|specialm1q)   error=false;;
471                     (*)                                     error=true;;
472                 esac;;
473        (lccrayf) case  $ndq  in
474                     (usup|test*|small|large)                error=false;;
475                     (*)                                     error=true;;
476                 esac;;
477        (lceddy) case  $ndq  in
478                     (eddy.p|cfdh.p|cfdl.p|carl.p|mpcs.p|mpcl.p|mpcb.p|all_nodes.p)  error=false;;
479                     (*)                                     error=true;;
480                 esac;;
481        (lckiaps) case  $ndq  in
482                     (express|normal|normal20|quickq)        error=false;;
483                     (*)                                     error=true;;
484                 esac;;
485        (lckyoto) case  $ndq  in
486                     (eh|ph)                                 error=false;;
487                     (*)                                     error=true;;
488                 esac;;
489        (lckyuh) case  $ndq  in
490                     (fx-dbg|fx-single|fx-small|fx-middle|fx-large)  error=false;;
491                     (*)                                     error=true;;
492                 esac;;
493        (lckyut) case  $ndq  in
494                     (cx-dbg|cx-single|cx-small|cx-middle|cx-large)  error=false;;
495                     (*)                                     error=true;;
496                 esac;;
497        (lctit)  case  $ndq  in
498                     (G|L128|L256|L512H|S|S96|V)             error=false;;
499                     (*)                                     error=true;;
500                 esac;;
501        (t3eb)   case  $ndq  in
502                     (berte|p50|p100|p392|forfree|p25himem)  error=false;;
503                     (*)    error=true;;
504                 esac;;
505        (t3eh)   case  $ndq  in
506                     (para_t3e|em|k|l|lm|comp_t3e|c|p|ht)  error=false;;
507                     (*)    error=true;;
508                 esac;;
509        (t3ej2|t3ej5)  case  $ndq  in
510                     (low|normal|high)  error=false;;
511                     (*)    error=true;;
512                 esac;;
513        (t3es)  case  $ndq  in
514                     (batch|serial-4|pe4|p48|pe16|pe32|pe64|pe128)  error=false;;
515                     (*)    error=true;;
516                 esac;;
517    esac
518    if [[ $error = true ]]
519    then
520       printf "\n  +++ queue \"$no_default_queue\" on host \"$remote_host\" not allowed"
521       locat=parameter; exit
522    else
523       queue=$no_default_queue
524    fi
525 fi
526
527
528
529    # CHECK THE CPU-TIME
530    # SPLIT TIME INTO HOURS, MINUTES, AND SECONDS
531 done=false
532 while [[ $done = false ]]
533 do
534    if (( $cputime <= 0 ))
535    then
536       printf "\n  +++ wrong cpu-time or cpu-time missing"
537       printf "\n  >>> Please type cpu-time in seconds as INTEGER:"
538       printf "\n  >>> "
539       read  cputime  1>/dev/null  2>&1
540    else
541       done=true
542    fi
543 done
544 (( stunden  = cputime / 3600 ))
545 (( resttime = cputime - stunden * 3600 ))
546 (( minuten  = resttime / 60 ))
547 (( sekunden = resttime - minuten * 60 ))
548 timestring=${stunden}:${minuten}:${sekunden}
549
550
551
552    # CHECK THE MEMORY DEMAND
553 done=false
554 while [[ $done = false ]]
555 do
556    if (( memory <= 0 ))
557    then
558       printf "\n  +++ wrong memory demand or memory demand missing"
559       printf "\n  >>> Please type memory in  MByte per process  as INTEGER:"
560       printf "\n  >>> "
561       read  memory  1>/dev/null  2>&1
562    else
563       done=true
564    fi
565 done
566
567 if [[ $remote_host = lctit ]]
568 then
569    (( Memory = memory * tasks_per_node / 1000 ))
570 fi
571
572
573    # MEMORY DEMAND IN CASE OF OPENMP-USAGE ON IBM-SYSTEMS
574 if [[ $(echo $remote_host | cut -c1-3) = ibm ]]
575 then
576    (( memory = memory * threads_per_task ))
577 fi
578
579
580    # CALCULATE NUMBER OF REQUIRED NODES
581 if (( tasks_per_node != 0 ))
582 then
583    (( nodes = ( numprocs - 1 ) / ( tasks_per_node * threads_per_task ) + 1 ))
584 fi
585
586
587    # CALCULATE NUMBER OF PROCESSES PER NODE
588 (( processes_per_node = tasks_per_node * threads_per_task ))
589
590
591    # CALCULATE NUMBER OF MPI TASKS
592 (( mpi_tasks = numprocs / threads_per_task ))
593
594
595    # SET PORT NUMBER OPTION FOR CALLS OF ssh/scp, subjob AND batch_scp SCRIPTS
596 if [[ "$scp_port" != "" ]]
597 then
598    PORTOPT="-P $scp_port"
599    SSH_PORTOPT="-p $scp_port"
600 fi
601
602
603    # HEADER-OUTPUT
604 if [[ $verify = true ]]
605 then
606    printf "\n\n"
607    printf "#--------------------------------------------------------------# \n"
608    spalte1=SUBJOB;spalte2=$(date)
609    printf "| %-20s%40s | \n" "$spalte1" "$spalte2"
610    printf "|                                                              | \n"
611    printf "| values of parameters/options:                                | \n"
612    spalte1=$(echo local_host$punkte | cut -c-20)
613    spalte2=$punkte$local_host
614    printf "| %-20s%40s | \n" "$spalte1" "${spalte2: -40}"
615    spalte1=$(echo remote_host$punkte | cut -c-20)
616    spalte2=$punkte$remote_host
617    printf "| %-20s%40s | \n" "$spalte1" "${spalte2: -40}"
618    spalte1=$(echo queue$punkte | cut -c-20)
619    spalte2=$punkte$queue
620    printf "| %-20s%40s | \n" "$spalte1" "${spalte2: -40}"
621    spalte1=$(echo memory$punkte | cut -c-20)
622    spalte2="$punkte$memory mb"
623    printf "| %-20s%40s | \n" "$spalte1" "${spalte2: -40}"
624    spalte1=$(echo cputime$punkte | cut -c-20)
625    spalte2="$punkte$cputime sec"
626    printf "| %-20s%40s | \n" "$spalte1" "${spalte2: -40}"
627    spalte1=$(echo job_name$punkte | cut -c-20)
628    spalte2="$punkte$job_name"
629    printf "| %-20s%40s | \n" "$spalte1" "${spalte2: -40}"
630    printf "#--------------------------------------------------------------# \n\n"
631
632
633       # QUERY CHECK
634    antwort="dummy"
635    while [[ $antwort != y  &&  $antwort != Y  &&  $antwort != n  &&  $antwort != N ]]
636    do
637       read antwort?" >>> continue (y/n) ? "
638    done
639    if [[ $antwort = n  ||  $antwort = N ]]
640    then
641       locat=verify; exit
642    fi
643    printf "\n"
644 fi
645
646    # GENERATE RANDOM IDENTIFIER, AND DETERMINE THE JOBNAME ON THE TARGET HOST
647 identifier=$RANDOM
648 job_on_remhost=${job_name}_${identifier}_$local_host
649 job_to_send=job_to_send_$identifier
650 if [[ $delete_dayfile = false ]]
651 then
652    remote_dayfile=${local_host}_${job_name}_result_$identifier
653    local_dayfile=${remote_host}_${job_name}
654 else
655    remote_dayfile=/dev/null
656 fi
657
658
659    # GENERATE THE BATCH-JOB SCRIPTS (FOR QUEUEING-SYSTEMS qsub/msub/LoadLeveler)
660 if [[ $(echo $remote_host | cut -c1-3) = ibm  &&  $numprocs != 0 ]]
661 then
662
663       # GENERAL LOADLEVELER SETTINGS
664    execute_in_shell="#!/bin/ksh"
665    use_shell="# @ shell = /bin/ksh"
666    consumable_memory="ConsumableMemory($memory mb)"
667    class="# @ class = $queue"
668    environment="# @ environment = OMP_NUM_THREADS=$threads_per_task; MP_SHARED_MEMORY=yes"
669    network_to_use="# @ network.mpi = sn_all,shared,us"
670    data_limit="# @ data_limit = 1.76gb"
671    image_size="# @ image_size = 50"
672    wall_clock_limit="# @ wall_clock_limit = ${timestring},$timestring"
673
674    if [[ $email_notification = none ]]
675    then
676       notify_user=""
677    else
678       notify_user="# @ notify_user = $email_notification"
679       if [[ $delete_dayfile = true ]]
680       then
681          notification='# @ notification = never'
682       fi
683    fi
684
685    if [[ $remote_host = ibmh ]]
686    then
687       data_limit=""
688       network_to_use=""
689       class="# @ class = $queue"
690       environment=""
691       rset="# @ rset = RSET_MCM_AFFINITY"
692       task_affinity="# @ task_affinity = core(1)"
693    elif [[ $remote_host = ibmkisti ]]
694    then
695       network_to_use="# @ network.MPI = sn_all,shared,US"
696       wall_clock_limit="# @ wall_clock_limit = $timestring"
697       if [[ $threads_per_task = 1 ]]
698       then
699          rset="# @ rset = RSET_MCM_AFFINITY"
700          mcm_affinity_options="# @ mcm_affinity_options = mcm_mem_pref mcm_sni_none mcm_distribute"
701       fi
702       environment=""
703       use_shell=""
704       data_limit=""
705       image_size=""
706    elif [[ $remote_host = ibmku ]]
707    then
708       execute_in_shell="#!/usr/bin/ksh"
709       use_shell="# @ shell = /usr/bin/ksh"
710       consumable_memory=""
711       environment=""
712       network_to_use="# @ network.mpi = sn_all,shared,us"
713       data_limit=""
714       image_size=""
715    elif [[ $remote_host = ibms ]]
716    then
717       network_to_use="# @ network.mpi = csss,shared,us"
718    fi
719
720    cat > $job_to_send << %%END%%
721$execute_in_shell
722$use_shell
723
724# @ job_type = parallel
725# @ job_name = $job_name
726# @ resources = ConsumableCpus($threads_per_task) $consumable_memory
727# @ output = $remote_dayfile
728# @ error = $remote_dayfile
729$wall_clock_limit
730$image_size
731$class
732$environment
733$network_to_use
734$data_limit
735$rset
736$mcm_affinity_options
737$task_affinity
738$notification
739$notify_user
740
741%%END%%
742
743    if (( nodes > 0 ))
744    then
745
746       if [[ $remote_host != ibmkisti ]]
747       then
748
749          cat >> $job_to_send << %%END%%
750# @ node = $nodes
751# @ tasks_per_node = $processes_per_node
752# @ node_usage = $node_usage
753# @ queue
754
755%%END%%
756
757       else
758
759          cat >> $job_to_send << %%END%%
760# @ total_tasks = $mpi_tasks
761# @ blocking = unlimited
762# @ queue
763
764%%END%%
765
766       fi
767
768    else
769
770       cat >> $job_to_send << %%END%%
771# @ blocking = unlimited
772# @ total_tasks = $numprocs
773# @ node_usage = $node_usage
774# @ queue
775
776%%END%%
777
778    fi
779
780       # WORKAROUND BECAUSE OF SILLY JOB FILTER ON ibmkisti
781    if [[ $remote_host = ibmkisti  &&  $threads_per_task != 1 ]]
782    then
783       echo  "export OMP_NUM_THREADS=$threads_per_task"  >>  $job_to_send
784    fi
785
786 elif [[ $(echo $remote_host | cut -c1-3) = ibm  &&  $numprocs = 0 ]]
787 then
788
789    cat > $job_to_send << %%END%%
790#!/bin/ksh
791
792# @ job_type = serial
793# @ node_usage = $node_usage
794# @ job_name = palm
795# @ wall_clock_limit = ${timestring},$timestring
796# @ resources = ConsumableCpus(1) ConsumableMemory(1 gb)
797# @ output = $remote_dayfile
798# @ error = $remote_dayfile
799$class
800$notification
801
802# @ queue
803
804%%END%%
805
806 elif [[ $remote_host = lcbullhh ]]
807 then
808    if [[ $numprocs != 0 ]]
809    then
810       cat > $job_to_send << %%END%%
811#!/bin/bash -l
812#SBATCH -J $job_name
813#SBATCH -t $timestring
814#SBATCH -N $nodes
815#SBATCH --ntasks-per-node=$processes_per_node
816#SBATCH -p $queue
817#SBATCH -o $remote_dayfile
818#SBATCH -e $remote_dayfile
819#SBATCH -A $project_account
820
821$init_cmds
822$module_calls
823
824%%END%%
825
826    else
827       cat > $job_to_send << %%END%%
828#!/bin/bash -l
829#SBATCH -J $job_name
830#SBATCH -t $timestring
831#SBATCH -l ncpus=1
832#SBATCH -l pmem=${memory}mb
833#SBATCH -m abe
834#SBATCH -o $remote_dayfile
835#SBATCH -e $remote_dayfile
836#SBATCH -A $project_account
837
838$init_cmds
839$module_calls
840
841%%END%%
842
843    fi
844
845 elif [[ $remote_host = lccrayb || $remote_host = lccrayh ]]
846 then
847
848    if [[ "$feature" != "" ]]
849    then
850       featuredir="#PBS -l feature=$feature"
851    fi
852
853    if [[ $numprocs != 0 ]]
854    then
855       cat > $job_to_send << %%END%%
856#!/bin/bash
857#PBS -N $job_name
858#PBS -l walltime=$timestring
859#PBS -l nodes=$nodes:ppn=$processes_per_node
860#PBS -o $remote_dayfile
861#PBS -j oe
862#PBS -q $queue
863$featuredir
864
865$init_cmds
866$module_calls
867
868%%END%%
869
870    else
871
872       continue
873
874    fi
875
876 elif [[ $remote_host = lccrayf ]]
877 then
878
879    if [[ $numprocs != 0 ]]
880    then
881       cat > $job_to_send << %%END%%
882#!/bin/bash -l
883#SBATCH -J $job_name
884#SBATCH -t $timestring
885#SBATCH -N $nodes
886#SBATCH --ntasks-per-node=$processes_per_node
887#SBATCH -p $queue
888#SBATCH -o $remote_dayfile
889#SBATCH -e $remote_dayfile
890
891$init_cmds
892$module_calls
893
894%%END%%
895
896    else
897       cat > $job_to_send << %%END%%
898#!/bin/bash -l
899#SBATCH -J $job_name
900#SBATCH -t $timestring
901#SBATCH -l ncpus=1
902#SBATCH -l pmem=${memory}mb
903#SBATCH -m abe
904#SBATCH -o $remote_dayfile
905#SBATCH -e $remote_dayfile
906
907$init_cmds
908$module_calls
909
910%%END%%
911
912    fi
913
914
915
916 elif [[ $remote_host = lceddy ]]
917 then
918    cat > $job_to_send << %%END%%
919#!/bin/bash
920#SBATCH -J $job_name
921#SBATCH -t $timestring
922#SBATCH -n $numprocs
923#SBATCH -N $nodes
924#SBATCH --cpus-per-task 1
925#SBATCH -p $queue
926#SBATCH -o $remote_dayfile
927#SBATCH -e $remote_dayfile
928#SBATCH --mem-per-cpu $memory
929#SBATCH --exclusive
930
931module load PALMDependencies/.gcc
932
933$init_cmds
934$module_calls
935
936%%END%%
937
938 elif [[ $remote_host = lck || $remote_host = lckordi || $remote_host = lcsb ]]
939 then
940
941    if [[ $numprocs != 0 ]]
942    then
943       cat > $job_to_send << %%END%%
944#!/bin/ksh
945#PBS -N $job_name
946#PBS -l walltime=$timestring
947#PBS -l ncpus=$numprocs
948#PBS -l pmem=${memory}mb
949#PBS -o $remote_dayfile
950#PBS -l nodes=$nodes:ppn=${processes_per_node}
951#PBS -j oe
952
953mpd &
954
955%%END%%
956
957    else
958       cat > $job_to_send << %%END%%
959#!/bin/ksh
960#PBS -N $job_name
961#PBS -l walltime=$timestring
962#PBS -l ncpus=1
963#PBS -l pmem=${memory}mb
964#PBS -o $remote_dayfile
965#PBS -j oe
966
967%%END%%
968
969    fi
970
971 elif [[ $remote_host = lcgeohu ]]
972 then
973
974    if [[ $email_notification = none ]]
975    then
976       notify_user=""
977    else
978       notify_user="#SBATCH --mail-type=ALL"
979    fi
980
981    if [[ $numprocs != 0 ]]
982    then
983       cat > $job_to_send << %%END%%
984#!/bin/bash
985#SBATCH --job-name=$job_name
986#SBATCH --ntasks=$processes_per_node
987#SBATCH --time=$timestring
988#SBATCH --output=$remote_dayfile
989#SBATCH --error=$remote_dayfile
990#SBATCH --qos=short
991$notify_user
992
993$init_cmds
994$module_calls
995
996%%END%%
997
998    else
999       cat > $job_to_send << %%END%%
1000#!/bin/bash
1001#SBATCH --job-name=$job_name
1002#SBATCH --ntasks=$processes_per_node
1003#SBATCH --output=$remote_dayfile
1004#SBATCH --error=$remote_dayfile
1005#SBATCH -l ncpus=1
1006
1007$init_cmds
1008$module_calls
1009
1010%%END%%
1011
1012    fi
1013
1014 elif [[ $remote_host = lckiaps ]]
1015 then
1016
1017    if [[ $numprocs != 0 ]]
1018    then
1019       cat > $job_to_send << %%END%%
1020#!/bin/bash
1021#PBS -N $job_name
1022#PBS -l walltime=$timestring
1023#PBS -l select=1:ncpus=$numprocs
1024#PBS -l pmem=${memory}mb
1025#PBS -q $queue
1026#PBS -o $remote_dayfile
1027#PBS -j oe
1028#PBS -V
1029
1030%%END%%
1031
1032    else
1033       cat > $job_to_send << %%END%%
1034#!/bin/bash
1035#PBS -N $job_name
1036#PBS -l walltime=$timestring
1037#PBS -l ncpus=1
1038#PBS -l pmem=${memory}mb
1039#PBS -o $remote_dayfile
1040#PBS -j oe
1041
1042%%END%%
1043
1044    fi
1045
1046 elif [[ $remote_host = lcyon ]]
1047 then
1048
1049    if [[ $numprocs != 0 ]]
1050    then
1051       cat > $job_to_send << %%END%%
1052#!/bin/ksh
1053#PBS -N $job_name
1054#PBS -l walltime=$timestring
1055#PBS -l ncpus=$numprocs
1056#PBS -l pmem=${memory}mb
1057#PBS -o $remote_dayfile
1058#PBS -j oe
1059
1060%%END%%
1061
1062    else
1063       cat > $job_to_send << %%END%%
1064#!/bin/ksh
1065#PBS -N $job_name
1066#PBS -l walltime=$timestring
1067#PBS -l ncpus=1
1068#PBS -l pmem=${memory}mb
1069#PBS -o $remote_dayfile
1070#PBS -j oe
1071
1072%%END%%
1073
1074    fi
1075
1076 elif [[ $remote_host = lcxe6 ]]
1077 then
1078
1079    if [[ $numprocs != 0 ]]
1080    then
1081       cat > $job_to_send << %%END%%
1082#!/bin/ksh
1083#PBS -S /bin/ksh
1084#PBS -N $job_name
1085#PBS -A $project_account
1086#PBS -j oe
1087#PBS -l walltime=$timestring
1088#PBS -l mppwidth=${numprocs}
1089#PBS -l mppnppn=${processes_per_node}
1090#PBS -m abe
1091#PBS -o $remote_dayfile
1092$email_directive
1093
1094$init_cmds
1095$module_calls
1096
1097%%END%%
1098
1099    else
1100       cat > $job_to_send << %%END%%
1101#!/bin/ksh
1102#PBS -S /bin/ksh
1103#PBS -N $job_name
1104#PBS -A $project_account
1105#PBS -j oe
1106#PBS -l walltime=$timestring
1107#PBS -l ncpus=1
1108#PBS -l pmem=${memory}mb
1109#PBS -m abe
1110$email_directive
1111#PBS -o $remote_dayfile
1112
1113$init_cmds
1114$module_calls
1115
1116%%END%%
1117
1118    fi
1119
1120 elif [[ $remote_host = lckyoto ]]
1121 then
1122
1123       cat > $job_to_send << %%END%%
1124#!/bin/ksh
1125# @\$-o $remote_dayfile
1126# @\$-eo -oi
1127# @\$-lP 16
1128# @\$-lp 1
1129# @\$-lm 28gb  -llm unlimited -ls unlimited
1130# @\$-q $queue
1131# @\$-Pvn abs_pack
1132##for intel? @\$-Pvn abs_unpack -Pvs unpack -Pvc unpack
1133#. /thin/local/etc/setprofile/intel-11.0.sh
1134#. /thin/local/etc/setprofile/mvapich2-1.4+intel-11.0.sh
1135. ~/.myprofile
1136#. /home2/t/t51254/palm/current_version/myprofile
1137#. /thin/apps/pgi/mpi.sh
1138#
1139env
1140#
1141set -x
1142
1143%%END%%
1144
1145 elif [[ $remote_host = lcxt5m ]]
1146 then
1147
1148    if [[ $numprocs != 0 ]]
1149    then
1150       cat > $job_to_send << %%END%%
1151#!/bin/ksh
1152#PBS -S /bin/ksh
1153#PBS -N $job_name
1154#PBS -j oe
1155#PBS -l walltime=$timestring
1156#PBS -l mppwidth=${numprocs}
1157#PBS -l mppnppn=${processes_per_node}
1158#PBS -m abe
1159#PBS -o $remote_dayfile
1160
1161$init_cmds
1162$module_calls
1163
1164%%END%%
1165
1166    else
1167       cat > $job_to_send << %%END%%
1168#!/bin/ksh
1169#PBS -S /bin/ksh
1170#PBS -N $job_name
1171#PBS -j oe
1172#PBS -l walltime=$timestring
1173#PBS -l ncpus=1
1174#PBS -l pmem=${memory}mb
1175#PBS -m abe
1176#PBS -o $remote_dayfile
1177
1178$init_cmds
1179$module_calls
1180
1181%%END%%
1182
1183    fi
1184
1185 elif [[ $remote_host = lckyuh ]]
1186 then
1187    cat > $job_to_send << %%END%%
1188#!/bin/bash
1189#PJM -L "rscgrp=$queue"
1190#PJM -L "node=$nodes"
1191#PJM --mpi "proc=$numprocs"
1192#PJM -L "elapse=$timestring"
1193#PJM -o $remote_dayfile
1194#PJM -j
1195#PJM -X
1196#PJM --no-stging
1197
1198export LANG=en_US.UTF-8
1199%%END%%
1200
1201 elif [[ $remote_host = lckyut ]]
1202 then
1203    cat > $job_to_send << %%END%%
1204#!/bin/bash
1205#PJM -L "rscgrp=$queue"
1206#PJM -L "vnode=$numprocs"
1207#PJM -L "vnode-core=1"
1208#PJM -L "elapse=$timestring"
1209#PJM --mpi proc=$numprocs
1210#PJM -o $remote_dayfile
1211#PJM -j
1212#PJM -X
1213#PJM --no-stging
1214
1215export LANG=en_US.UTF-8
1216%%END%%
1217
1218 elif [[ $remote_host = lcocean ]]
1219 then
1220   cat > $job_to_send << %%END%%
1221#!/bin/bash
1222#$ -cwd
1223#$ -V
1224#$ -N $job_name
1225#$ -pe orte $numprocs
1226#$ -o $remote_dayfile
1227#$ -j y
1228#$ -R y
1229$init_cmds
1230$module_calls
1231
1232%%END%%
1233
1234 elif [[ $remote_host = lctit ]]
1235 then
1236    cat > $job_to_send << %%END%%
1237#!/bin/ksh
1238$init_cmds
1239$module_calls
1240
1241%%END%%
1242
1243       # SET OPTIONS FOR SUBMIT-COMMAND
1244    if [[ $tasks_per_node != $processes_per_node ]]
1245    then
1246       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 -et 1 -q $queue "
1247    else
1248       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 -et 1 -q $queue "
1249    fi
1250
1251 else
1252
1253    cat > $job_to_send << %%END%%
1254# @\$-q ${queue}
1255# @\$-l${qsubtime} $timestring
1256# @\$-l${qsubmem} ${memory}mb
1257# @\$-o $remote_dayfile
1258# @\$-eo
1259
1260%%END%%
1261
1262 fi
1263
1264
1265    # IN CASE OF JOBS EXECUTING ON REMOTE-HOSTS, THE TRANSFER OF THE DAYFILES
1266    # TO THE LOCAL HOSTS WILL BE INITIATED BY TRAP ON EXIT
1267    # NO TRANSFER POSSIBLE ON IBM IN SEOUL
1268 if [[ $delete_dayfile = false  &&  $remote_host != $local_host ]]
1269 then
1270    echo "set +vx"                              >>  $job_to_send
1271    echo "trap '"                               >>  $job_to_send
1272    echo "set +vx"                              >>  $job_to_send
1273    if [[ $(echo $remote_host | cut -c1-3) = ibm  ||  $remote_host = lcbullhh  ||  $remote_host = lccrayb  ||  $remote_host = lccrayh  ||  $(echo $remote_host | cut -c1-3) = nec  ||  $remote_host = lckiaps  ||  $remote_host = lckyu* || $remote_host = lcxe6  ||  $remote_host = lcocean  || $remote_host = lcgeohu ]]
1274    then
1275       if [[ $remote_host = ibmh ]]
1276       then
1277          return_queue=c1
1278       elif [[ $remote_host = ibmkisti ]]
1279       then
1280          return_queue=class.1-2
1281       elif [[ $remote_host = ibmku ]]
1282       then
1283          return_queue=sdbg2
1284       elif [[ $remote_host = ibms ]]
1285       then
1286          return_queue=p_normal
1287       elif [[ $remote_host = lcbullhh ]]
1288       then
1289          return_queue=shared
1290       elif [[ $remote_host = lccrayb || $remote_host = lccrayh ]]
1291       then
1292          return_queue=dataq
1293       elif [[ $remote_host = lcxe6 ]]
1294       then
1295          return_queue=debug
1296       elif [[ $remote_host = lckiaps ]]
1297       then
1298          return_queue=express
1299       elif [[ $remote_host = lckyuh ]]
1300       then
1301          return_queue=cx-single
1302       elif [[ $remote_host = lckyut ]]
1303       then
1304          return_queue=cx-single
1305       else
1306          return_queue=unknown
1307       fi
1308
1309       if [[ $(echo $remote_host | cut -c1-3) = ibm ]]
1310       then
1311
1312          if [[ $remote_host = ibmku ]]
1313          then
1314             echo "echo \"#!/usr/bin/ksh\" >> scpjob.$identifier"            >>  $job_to_send
1315             echo "echo \"# @ shell = /usr/bin/ksh\" >> scpjob.$identifier"  >>  $job_to_send
1316          else
1317             echo "echo \"#!/bin/ksh\" >> scpjob.$identifier"                >>  $job_to_send
1318          fi
1319          echo "echo \"# @ job_type = serial\" >> scpjob.$identifier"    >>  $job_to_send
1320          echo "echo \"# @ job_name = transfer\" >> scpjob.$identifier"  >>  $job_to_send
1321          echo "echo \"# @ resources = ConsumableCpus(1) ConsumableMemory(1 gb)\" >> scpjob.$identifier"  >>  $job_to_send
1322          echo "echo \"# @ wall_clock_limit = 00:10:00,00:10:00\" >> scpjob.$identifier "  >>  $job_to_send
1323          echo "echo \"# @ output = job_queue/last_job_transfer_protocol\" >> scpjob.$identifier"  >>  $job_to_send
1324          echo "echo \"# @ error = job_queue/last_job_transfer_protocol\" >> scpjob.$identifier"  >>  $job_to_send
1325          if [[ $host != "ibmh" ]]
1326          then
1327             echo "echo \"# @ class = $return_queue\" >> scpjob.$identifier"  >>  $job_to_send
1328          fi
1329          echo "echo \"# @ image_size = 10\" >> scpjob.$identifier"      >>  $job_to_send
1330          echo "echo \"# @ notification = never\" >> scpjob.$identifier" >>  $job_to_send
1331
1332          echo "echo \"# @ queue\" >> scpjob.$identifier"                >>  $job_to_send
1333          echo "echo \" \" >> scpjob.$identifier"                        >>  $job_to_send
1334
1335          echo "echo \"set -x\" >> scpjob.$identifier"                   >>  $job_to_send
1336          echo "echo \"batch_scp  $PORTOPT  -d  -w 10  -u $local_user  $local_address  ${job_catalog}/$remote_dayfile  \\\"$job_catalog\\\"  $local_dayfile\" >> scpjob.$identifier"  >>  $job_to_send
1337          if [[ $remote_host = ibmku ]]
1338          then
1339             echo "echo \"rm  scpjob.$identifier\" >> scpjob.$identifier"   >>  $job_to_send
1340          fi
1341          echo "echo \"exit\" >> scpjob.$identifier"                     >>  $job_to_send
1342
1343       elif [[ $remote_host = lcbullhh ]]
1344       then
1345          echo "cat > scpjob.$identifier << %%END%%"        >>  $job_to_send
1346          echo "#!/bin/bash"                             >>  $job_to_send
1347          echo "#SBATCH --job-name=job_protocol_transfer" >>  $job_to_send
1348          echo "#SBATCH -t 00:20:00"                     >>  $job_to_send
1349          echo "#SBATCH -N 1"                            >>  $job_to_send
1350          echo "#SBATCH -n 1"                            >>  $job_to_send
1351          echo "#SBATCH -o \$HOME/job_queue/last_job_transfer_protocol"      >>  $job_to_send
1352          echo "#SBATCH -o $remote_dayfile"              >>  $job_to_send
1353          echo "#SBATCH -e $remote_dayfile"              >>  $job_to_send
1354          echo "#SBATCH -A $project_account"             >>  $job_to_send
1355          echo "#SBATCH -p $return_queue"                >>  $job_to_send
1356          echo " "                                       >>  $job_to_send
1357          echo "set -x"                                  >>  $job_to_send
1358          echo "batch_scp  $PORTOPT  -d  -w 10  -u $local_user $local_address  ${job_catalog}/$remote_dayfile  \"$job_catalog\"  $local_dayfile"  >>  $job_to_send
1359          echo "[[ \"\$for_subjob_to_do\" != \"\" ]]  &&  eval \$for_subjob_to_do"  >>  $job_to_send
1360          echo "%%END%%"                                 >>  $job_to_send
1361
1362       elif [[ $remote_host = lckyuh ]]
1363       then
1364          echo "cat > scpjob.$identifier << %%END%%"  >>  $job_to_send
1365          echo "#!/bin/bash"                       >>  $job_to_send
1366          echo "#PJM -L \"node=1\""                >>  $job_to_send
1367          echo "#PJM -L \"rscgrp=$return_queue\""  >>  $job_to_send
1368          echo "#PJM --no-stging"                  >>  $job_to_send
1369          echo "#PJM -L \"elapse=30:00\""          >>  $job_to_send
1370          echo "#PJM -o \$HOME/job_queue/last_job_transfer_protocol"  >>  $job_to_send
1371          echo "#PJM -j"                           >>  $job_to_send
1372          echo " "                                 >>  $job_to_send
1373          echo "export LANG=en_US.UTF-8"           >>  $job_to_send
1374          echo "set -x"                            >>  $job_to_send
1375          echo "batch_scp  $PORTOPT  -d  -w 10  -u $local_user $local_address  $remote_dayfile  \"$job_catalog\"  $local_dayfile"  >>  $job_to_send
1376          echo "[[ \"\$for_subjob_to_do\" != \"\" ]]  &&  eval \$for_subjob_to_do"  >>  $job_to_send
1377          echo "%%END%%"                           >>  $job_to_send
1378
1379       elif [[ $remote_host = lckyut ]]
1380       then
1381          echo "cat > scpjob.$identifier << %%END%%"  >>  $job_to_send
1382          echo "#!/bin/bash"                       >>  $job_to_send
1383          echo "#PJM -L \"vnode=1\""               >>  $job_to_send
1384          echo "#PJM -L \"rscgrp=$return_queue\""  >>  $job_to_send
1385          echo "#PJM --no-stging"                  >>  $job_to_send
1386          echo "#PJM -L \"elapse=30:00\""          >>  $job_to_send
1387          echo "#PJM -o \$HOME/job_queue/last_job_transfer_protocol"  >>  $job_to_send
1388          echo "#PJM -j"                           >>  $job_to_send
1389          echo " "                                 >>  $job_to_send
1390          echo "export LANG=en_US.UTF-8"           >>  $job_to_send
1391          echo "set -x"                            >>  $job_to_send
1392          echo "batch_scp  $PORTOPT  -d  -w 10  -u $local_user $local_address  $remote_dayfile  \"$job_catalog\"  $local_dayfile"  >>  $job_to_send
1393          echo "[[ \"\$for_subjob_to_do\" != \"\" ]]  &&  eval \$for_subjob_to_do"  >>  $job_to_send
1394          echo "%%END%%"                           >>  $job_to_send
1395
1396       elif [[ $remote_host = lccrayb || $remote_host = lccrayh ]]
1397       then
1398          echo "cat > scpjob.$identifier << %%END%%"        >>  $job_to_send
1399          echo "#!/bin/bash"                             >>  $job_to_send
1400          echo "#PBS -N job_protocol_transfer"           >>  $job_to_send
1401          echo "#PBS -l walltime=00:30:00"               >>  $job_to_send
1402          echo "#PBS -l nodes=1:ppn=1"                   >>  $job_to_send
1403          echo "#PBS -o \$HOME/job_queue/last_job_transfer_protocol"      >>  $job_to_send
1404          echo "#PBS -j oe"                              >>  $job_to_send
1405          echo " "                                       >>  $job_to_send
1406          echo "set -x"                                  >>  $job_to_send
1407          echo "batch_scp  $PORTOPT  -d  -w 10  -u $local_user $local_address  ${job_catalog}/$remote_dayfile  \"$job_catalog\"  $local_dayfile"  >>  $job_to_send
1408          echo "[[ \"\$for_subjob_to_do\" != \"\" ]]  &&  eval \$for_subjob_to_do"  >>  $job_to_send
1409          echo "%%END%%"                                 >>  $job_to_send
1410
1411       elif [[ $remote_host = lcocean ]]
1412       then
1413          echo "cat > scpjob.${identifier}.tmp << %%END%%"                  >>  $job_to_send
1414          echo "#!/bin/bash"                                             >>  $job_to_send
1415          echo "SGEPREFIX -S /bin/bash"                                  >>  $job_to_send
1416          echo "SGEPREFIX -N transfer_$job_name"                         >>  $job_to_send
1417          echo "SGEPREFIX -cwd"                                          >>  $job_to_send
1418          echo "SGEPREFIX -j y"                                          >>  $job_to_send
1419          echo "SGEPREFIX -o ${local_host}_${job_name}_scpjob_$identifier"  >>  $job_to_send 
1420          echo " "                                                       >>  $job_to_send 
1421          echo "set -x"                                                  >>  $job_to_send 
1422          echo "export PALM_BIN=$PALM_BIN" | sed -e 's:'$HOME':$HOME:'   >>  $job_to_send
1423          echo "export PATH=\$PATH:\$PALM_BIN"                           >>  $job_to_send
1424          echo ""                                 >>  $job_to_send         
1425          echo "batch_scp  $PORTOPT  -d  -w 10  -u $local_user $local_address  ${job_catalog}/$remote_dayfile  \"$job_catalog\"  $local_dayfile"  >>  $job_to_send
1426          echo "[[ \"\$for_subjob_to_do\" != \"\" ]]  &&  eval \$for_subjob_to_do"  >>  $job_to_send
1427          echo "rm -f scpjob.${identifier}"                                 >>  $job_to_send         
1428          echo "%%END%%"                                                 >>  $job_to_send
1429          echo "sed -e 's/SGEPREFIX/#$/g' scpjob.${identifier}.tmp > scpjob.${identifier}" >>  $job_to_send         
1430          echo "rm -f scpjob.${identifier}.tmp"                             >>  $job_to_send         
1431
1432       elif [[ $remote_host = lcxe6 ]]
1433       then
1434          echo "cat > scpjob.${identifier}  << %%END%%"  >>  $job_to_send
1435          echo "#!/bin/ksh"                              >>  $job_to_send
1436          echo "#PBS -N job_protocol_transfer"           >>  $job_to_send
1437          echo "#PBS -l walltime=00:30:00"               >>  $job_to_send
1438          echo "#PBS -A $project_account"                >>  $job_to_send
1439          echo "#PBS -l mppwidth=1"                      >>  $job_to_send
1440          echo "#PBS -l mppnppn=1"                       >>  $job_to_send
1441          echo "#PBS -o \$HOME/job_queue/last_job_transfer_protocol"  >>  $job_to_send
1442          echo "#PBS -j oe"                              >>  $job_to_send
1443          echo " "                                       >>  $job_to_send
1444          echo "set -x"                                  >>  $job_to_send
1445          echo "batch_scp  $PORTOPT  -d  -w 10  -u $local_user $local_address  ${job_catalog}/$remote_dayfile  \"$job_catalog\"  $local_dayfile"  >>  $job_to_send
1446          echo "[[ \"\$for_subjob_to_do\" != \"\" ]]  &&  eval \$for_subjob_to_do"  >>  $job_to_send
1447          echo "%%END%%"                                 >>  $job_to_send
1448
1449       elif [[ $remote_host = lcgeohu ]]
1450       then
1451          echo "cat > scpjob.$identifier << %%END%%"        >>  $job_to_send
1452          echo "#!/bin/bash"                             >>  $job_to_send
1453          echo "#SBATCH --job-name=job_protocol_transfer" >>  $job_to_send
1454          echo "#SBATCH -t 00:20:00"                     >>  $job_to_send
1455          echo "#SBATCH -N 1"                            >>  $job_to_send
1456          echo "#SBATCH -n 1"                            >>  $job_to_send
1457          echo "#SBATCH -o \$HOME/job_queue/last_job_transfer_protocol"      >>  $job_to_send
1458          echo "#SBATCH -o $remote_dayfile"              >>  $job_to_send
1459          echo "#SBATCH -e $remote_dayfile"              >>  $job_to_send
1460          echo " "                                       >>  $job_to_send
1461          echo "set -x"                                  >>  $job_to_send
1462          echo "sbatch  scpjob.$identifier"              >>  $job_to_send
1463          echo "%%END%%"                                 >>  $job_to_send
1464
1465       else
1466
1467          echo "cat > scpjob.$identifier << %%END%%"  >>  $job_to_send
1468          echo "# @\\\$-q $return_queue"           >>  $job_to_send
1469          echo "# @\\\$-l${qsubtime} 10"           >>  $job_to_send
1470          echo "# @\\\$-l${qsubmem} 10mb"          >>  $job_to_send
1471          if [[ $remote_host = t3ej2  ||  $remote_host = t3ej5  ||  $remote_host = t3es ]]
1472          then
1473             echo "# @\$-l mpp_p=0"                >>  $job_to_send
1474          fi
1475          echo '# @\$-lF 10mb'                     >>  $job_to_send
1476          echo '# @\$-o job_queue/last_job_transfer_protocol'    >>  $job_to_send
1477          echo '# @\\\$-eo'                          >>  $job_to_send
1478          echo " "                                 >>  $job_to_send
1479          if [[ $remote_host = t3ej2  ||  $remote_host = t3ej5 ]]
1480          then
1481             echo "set +vx"                        >>  $job_to_send
1482             echo ". .profile"                     >>  $job_to_send
1483          fi
1484          echo "set -x"                            >>  $job_to_send
1485          echo "batch_scp  $PORTOPT  -d  -w 10  -u $local_user $local_address  ${job_catalog}/$remote_dayfile  \"$job_catalog\"  $local_dayfile  >  /dev/null"  >>  $job_to_send
1486          echo "[[ \"\$for_subjob_to_do\" != \"\" ]]  &&  eval \$for_subjob_to_do"  >>  $job_to_send
1487          echo "%%END%%"                           >>  $job_to_send
1488
1489       fi
1490
1491       if [[ $(echo $remote_host | cut -c1-3) = ibm ]]
1492       then
1493          echo "llsubmit  scpjob.$identifier"      >>  $job_to_send
1494       elif [[ $remote_host = lcbullhh ]]
1495       then
1496          echo "sbatch  scpjob.$identifier"               >>  $job_to_send
1497       elif [[ $remote_host = lccrayb || $remote_host = lccrayh ]]
1498       then
1499          echo "msub -E -q $return_queue  scpjob.$identifier"               >>  $job_to_send
1500       elif [[ $remote_host = t3eb  ||  $remote_host = t3eh  ||  $remote_host = t3ej2  ||  $remote_host = t3ej5 ]]
1501       then
1502          echo "qsub -J n  scpjob.$identifier"     >>  $job_to_send
1503       elif [[ $remote_host = t3es ]]
1504       then
1505          echo "qsub -J n  -s /bin/ksh  scpjob.$identifier"     >>  $job_to_send
1506       elif [[ $remote_host = lckiaps ]]
1507       then
1508          echo "mv  scpjob.$identifier  $job_catalog"           >>  $job_to_send
1509          echo "ssh $SSH_PORTOPT ${remote_username}@${remote_address}  \"$submcom ${job_catalog}/scpjob.$identifier\" "  >>  $job_to_send
1510          echo "rm  ${job_catalog}/scpjob.$identifier"          >>  $job_to_send
1511       elif [[ $remote_host = lckyu* ]]
1512       then
1513          echo "scp $PORTOPT scpjob.$identifier  ${remote_username}@${remote_address}:job_queue"           >>  $job_to_send
1514          echo "ssh $SSH_PORTOPT ${remote_username}@${remote_address}  \"cd job_queue; $submcom scpjob.$identifier; rm scpjob.$identifier\" "  >>  $job_to_send
1515       elif [[ $remote_host = lcocean ]]
1516       then
1517          echo "mv  scpjob.$identifier  $job_catalog"           >>  $job_to_send
1518          echo "/usr/bin/ssh ${remote_username}@${remote_address}  \"$init_cmds $module_calls cd $job_catalog; $submcom scpjob.$identifier\" "  >>  $job_to_send
1519       else
1520          echo "$submcom  scpjob.$identifier"      >>  $job_to_send
1521       fi
1522       if [[ $remote_host != ibmku  &&  $remote_host != lckiaps ]]
1523       then
1524          echo "rm  scpjob.$identifier"            >>  $job_to_send
1525       fi
1526    else
1527#       echo "ftpcopy  -d  $local_address  ${job_catalog}/$remote_dayfile  \"$job_catalog\"  $local_dayfile"  >>  $job_to_send
1528       # ??? funktioniert das ÃŒberhaupt noch ???
1529       echo "nohup  ftpcopy  -d  -w 15  $local_address  ${job_catalog}/$remote_dayfile  \"$job_catalog\"  $local_dayfile  >  /dev/null  &"  >>  $job_to_send
1530    fi
1531    echo "set -x"                               >>  $job_to_send
1532    echo "     ' exit"                          >>  $job_to_send
1533    echo "set -x"                               >>  $job_to_send
1534 fi
1535
1536
1537    # APPEND THE JOB-FILE (CREATE BY mrun) TO THE JOB-DIRECTIVES GENERATED ABOVE
1538 cat  $file_to_send  >>  $job_to_send
1539
1540 if [[ $remote_host = ibm ]]
1541 then
1542    echo " "         >>  $job_to_send
1543    echo "exit"      >>  $job_to_send
1544 fi
1545
1546    # REMOVE JOB-FILE
1547 if [[ $remote_host = lctit  ||  $remote_host = ibmku ]]
1548 then
1549    echo " "                               >>  $job_to_send
1550    echo "rm ~/job_queue/$job_on_remhost"  >>  $job_to_send
1551 fi
1552
1553
1554    # TRANSFER JOB TO THE TARGET HOST (JOB-DIRECTORY)
1555 if [[ $no_submit = false ]]
1556 then
1557    if [[ $remote_host != $local_host ]]
1558    then
1559       [[ $verify = true ]]  &&  printf "\n >>> transfering job to \"$remote_host\"..."
1560       if [[ $remote_host = ibms ]]    # ssh on ibms cannot handle "~/"
1561       then
1562          job_catalog_save=$job_catalog
1563          job_catalog=job_queue
1564       elif [[ $remote_host = lcgeohu ]]
1565       then
1566          job_catalog_save=$job_catalog
1567          job_catalog=/home/${remote_user}/job_queue
1568       fi
1569       scp  $ssh_key  $PORTOPT  $job_to_send  ${remote_user}@${remote_address}:${job_catalog}/$job_on_remhost
1570       if [[ $? = 1 ]]
1571       then
1572          locat=scp; exit
1573       fi
1574       if [[ $remote_host = ibms  ||  $remote_host = lcgeohu ]]
1575       then
1576          job_catalog=$job_catalog_save
1577       fi
1578       [[ $verify = true ]]  &&  printf "\n >>> finished\n"
1579    else
1580       eval  job_catalog=$job_catalog
1581       cp  $job_to_send  ${job_catalog}/$job_on_remhost
1582    fi
1583
1584
1585
1586       # START NQS- / LOADLEVELER-JOB
1587    if [[ $remote_host != $local_host ]]
1588    then
1589       [[ $verify = true ]]  &&  printf "\n >>> submitting job using \"qsub\"...\n"
1590
1591       if [[ $remote_host = ibmku ]]
1592       then
1593          ssh  $SSH_PORTOPT $remote_address  -l $remote_user  "cd $job_catalog; $submcom $job_on_remhost"
1594       elif [[ $remote_host = lcgeohu ]]
1595       then
1596          ssh  $ssh_key  $SSH_PORTOPT $remote_address  -l $remote_user  "cd $job_catalog; $submcom $job_on_remhost"
1597       else
1598          ssh  $ssh_key  $SSH_PORTOPT $remote_address  -l $remote_user  "cd $job_catalog; $submcom $job_on_remhost; rm $job_on_remhost"
1599       fi
1600
1601       [[ $verify = true ]]  &&  printf " >>> o.k.\n"
1602    else
1603       cd  $job_catalog
1604       if [[ $(echo $local_host | cut -c1-3) = ibm  ||  $(echo $local_host | cut -c1-6) = lccray || $local_host = lceddy || $local_host = lcgeohu ]]
1605       then
1606          eval  $submcom  $job_on_remhost
1607       elif [[  $local_host = lctit  ||  $local_host = lcxe6  ||  $local_host = lck  || $local_host = lckordi ||  $local_host = lcyon || $local_host = lcsb  ||  $local_host = lckyu* ]]
1608       then
1609          chmod  u+x  $job_on_remhost
1610          eval  $submcom  $job_on_remhost
1611       elif [[ $local_host = lcbullhh ]]
1612       then
1613          if [[ $queue = default ]]
1614          then
1615             eval  $submcom  $job_on_remhost
1616          fi
1617       else
1618          qsub  $job_on_remhost
1619       fi
1620
1621          # JOBFILE MUST NOT BE DELETED ON lctit/ibmku. THIS WILL BE DONE
1622          # AT THE END OF THE JOB
1623       if [[ $local_host != lctit  &&  $local_host != ibmku  &&  $local_host != lcgeohu ]]
1624       then
1625          rm  $job_on_remhost
1626       fi
1627       cd  -  > /dev/null
1628    fi
1629 fi
1630
1631    # FINAL ACTIONS
1632 if [[ $no_submit = false ]]
1633 then
1634    rm  -f $job_to_send
1635 fi
1636 [[ $verify = true ]]  &&  printf "\n\n *** SUBJOB finished \n\n"
Note: See TracBrowser for help on using the repository browser.