source: palm/trunk/SCRIPTS/subjob @ 1451

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

last commit documented

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