source: palm/trunk/SCRIPTS/subjob @ 1866

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

scripts adjusted for lcocean

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