source: palm/trunk/SCRIPTS/subjob @ 1567

Last change on this file since 1567 was 1548, checked in by witha, 10 years ago

last commit documented

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