source: palm/trunk/SCRIPTS/subjob @ 1616

Last change on this file since 1616 was 1576, checked in by raasch, 10 years ago

last commit documented

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