source: palm/trunk/SCRIPTS/subjob @ 1543

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

last commit documented

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