source: palm/trunk/SCRIPTS/subjob @ 1453

Last change on this file since 1453 was 1453, checked in by heinze, 10 years ago

last commit documented

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