source: palm/trunk/SCRIPTS/subjob @ 1385

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

last commit documented

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