source: palm/trunk/SCRIPTS/subjob @ 1289

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

script comments translated to English
version update to 3.10

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