source: palm/trunk/SCRIPTS/subjob @ 1290

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

last commit documented
fimm-, scirocco-, ibmy-, nech-, and sgi-specific code removed from scripts

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