source: palm/trunk/SCRIPTS/subjob @ 2068

Last change on this file since 2068 was 1945, checked in by raasch, 8 years ago

last commit documented

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