source: palm/trunk/SCRIPTS/subjob @ 1443

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

last commit documented

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