[1] | 1 | #!/bin/ksh |
---|
[82] | 2 | # subjob - Plot-Shellskript Version: @(#)SUBJOB 1.0 |
---|
[66] | 3 | # $Id: subjob 54 2007-03-08 00:00:02Z raasch $ |
---|
[1] | 4 | |
---|
| 5 | # Prozedur zum automatischen Generieren von Batch-Jobs, die unter NQS |
---|
| 6 | # laufen sollen und deren Ergebnis (Dayfile) zum Job-generierenden |
---|
| 7 | # Host zurueckgeschickt werden sollen |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | # letzte Aenderung: |
---|
| 11 | # 29/06/94 - Siggi - Beginn mit Erstellung der Originalversion |
---|
| 12 | # 08/07/94 - Siggi - Originalversion abgeschlossen (Version 1.0) |
---|
| 13 | # 06/02/98 - Siggi - berte validiert |
---|
| 14 | # 27/01/01 - Siggi - ground.yonsei.ac.kr validiert, Jobs zur T3E in Korea |
---|
| 15 | # moeglich |
---|
| 16 | # 08/02/01 - Siggi - alle subjob-Meldungen ins englische uebersetzt |
---|
| 17 | # 25/05/02 - Siggi - Unterstuetzung des LoadLeveler |
---|
| 18 | # 30/05/02 - Siggi - Validierung fuer ibm-Rechner in Seoul (nobel) sowie |
---|
| 19 | # allgemeine Anpassungen fuer ibm-Rechner |
---|
| 20 | # 15/10/02 - Siggi - Neue Default-Jobklasse (p_normal) fuer IBM in Seoul |
---|
| 21 | # Ruecktransfer des Jobprotokolls fuer diese |
---|
| 22 | # Maschine abgeschaltet |
---|
| 23 | # 31/10/02 - Siggi - berni validiert |
---|
| 24 | # 06/11/02 - Siggi - Neue Jobklassen auf ibmb und ibmh |
---|
| 25 | # 08/11/02 - Siggi - quanero validiert |
---|
| 26 | # 11/12/02 - Siggi - Notification fuer Transfer-Jobs abgeschaltet |
---|
| 27 | # 23/01/03 - Siggi - hostname nobel changed to nobela |
---|
| 28 | # 06/02/03 - Siggi - gregale validated |
---|
| 29 | # 12/02/03 - Siggi - orkan and maestro validated |
---|
| 30 | # 21/02/03 - Siggi - all nobel nodes in Seoul validated |
---|
| 31 | # 12/03/03 - Siggi - nec at DKRZ validated |
---|
| 32 | # 13/03/03 - Siggi - new nqs resource variable Memory |
---|
| 33 | # 07/04/03 - Siggi - processor request option -c on nech needs tasks per |
---|
| 34 | # node |
---|
| 35 | # 11/04/03 - Siggi - network on ibms has attribute "shared" |
---|
| 36 | # 31/07/03 - Siggi - nqs2 on nech implemented (provisional: -h nech2) |
---|
| 37 | # cxxl added to ibmh |
---|
| 38 | # 29/08/03 - Siggi - changes in job queues and communication system on |
---|
| 39 | # ibms |
---|
| 40 | # 24/10/03 - Siggi - using alternate hanni address 130.75.4.2 |
---|
| 41 | # 30/10/03 - Siggi - nech is not supported any more |
---|
| 42 | # 10/11/03 - Siggi - nech2 renamed to nech |
---|
| 43 | # 20/11/03 - Siggi - submit command on nech changed from qsub.test to qsub |
---|
| 44 | # 29/03/04 - Siggi - ground not supported any more, gfdl3 validated |
---|
| 45 | # 31/03/04 - Siggi - new option -N for node usage |
---|
| 46 | # 12/04/04 - Siggi - scp2 instead of scp used for transfer from decalpha |
---|
| 47 | # due to error in ssh installation (otherwise a prompt |
---|
| 48 | # for the password appears) |
---|
| 49 | # 23/07/04 - Siggi - changes due to the new berni configuration |
---|
| 50 | # (federation switch) |
---|
| 51 | # 01/09/04 - Gerald new job-classes on hanni |
---|
| 52 | # 08/09/04 - Siggi - hanni IP address changed to 130.75.4.10 |
---|
| 53 | # 23/11/04 - Siggi - new job class cdata on hanni and berni |
---|
| 54 | # 03/12/04 - Siggi - notification on ibm switched of in case of |
---|
| 55 | # delete_dayfile = true, node usage in cdev set to |
---|
| 56 | # shared |
---|
| 57 | # 16/02/05 - Gerald hababai validated |
---|
| 58 | # 29/03/05 - Micha - new job class channi on hanni |
---|
| 59 | # 11/05/05 - Siggi - ConsumableMemory is now required as resource keyword |
---|
| 60 | # on ibms |
---|
| 61 | # 24/05/05 - Siggi - Default queue on ibms changed from p_normal_1.3 to |
---|
| 62 | # p_normal |
---|
| 63 | # 30/06/05 - Siggi - network changed for queue cdev from "us" to "ip" |
---|
| 64 | # 12/07/05 - Siggi - in network.mpi on ibmh/ibmb "csss" changed to |
---|
| 65 | # "sn_all", new job class cexp |
---|
| 66 | # 08/09/05 - Siggi - IP-address of gfdl3 changed |
---|
| 67 | # 31/10/05 - Siggi - new job class pp on hurricane, serial jobs on |
---|
| 68 | # hurricane (with -X0) |
---|
| 69 | # 01/11/05 - Siggi - missing queue for jobs submitted on nech (for nech) |
---|
| 70 | # added |
---|
| 71 | # 30/12/05 - Siggi - change of IP adresses in subnet 130.75.105 |
---|
| 72 | # 09/02/06 - Siggi - ibmy admitted |
---|
| 73 | # 10/02/06 - Siggi - scp2 changed to /bin/scp on decalpha |
---|
| 74 | # 13/04/06 - Siggi - ostria admitted |
---|
| 75 | # 18/04/06 - Siggi - new option -O for OpenMP usage |
---|
| 76 | # 24/05/06 - Siggi - lctit admitted, ftpjob renamed scpjob |
---|
| 77 | # 25/07/06 - Siggi - gfdl5 (ibmy) admitted for submitting jobs |
---|
| 78 | # 27/09/06 - Siggi - breg/hreg extended with berni/hanni |
---|
| 79 | # 25/10/06 - Siggi - data_limit set to 1.76 GByte on hanni and berni |
---|
| 80 | # 28/11/06 - Siggi - levanto admitted |
---|
[5] | 81 | # 13/02/07 - Siggi - hpmuk releated code removed |
---|
[35] | 82 | # 01/03/07 - Siggi - adjustments for RIAM machines gate and NEC-SX8 (n-sx) |
---|
[82] | 83 | # 12/04/07 - Siggi - option -f (filetransfer protocol) removed, scp only |
---|
[102] | 84 | # 27/07/07 - Siggi - autan admitted |
---|
[108] | 85 | # 03/08/07 - Marcus- lcfimm admitted |
---|
[1] | 86 | |
---|
| 87 | |
---|
| 88 | # VARIABLENVEREINBARUNGEN + DEFAULTWERTE |
---|
| 89 | delete_dayfile=false |
---|
| 90 | locat=normal |
---|
| 91 | no_default_queue=none |
---|
| 92 | no_submit=false |
---|
| 93 | job_catalog="~/job_queue" |
---|
| 94 | job_name=none |
---|
| 95 | local_user=$LOGNAME |
---|
| 96 | node_usage=shared |
---|
| 97 | numprocs=1 |
---|
| 98 | punkte="..........................................................." |
---|
| 99 | submcom=qsub |
---|
| 100 | queue=default |
---|
| 101 | remote_host=none |
---|
| 102 | remote_user="" |
---|
| 103 | verify=true |
---|
| 104 | |
---|
| 105 | typeset -i cputime=0 memory=0 Memory=0 minuten resttime sekunden stunden |
---|
| 106 | typeset -i inumprocs nodes=0 tasks_per_node=0 threads_per_task=1 |
---|
| 107 | typeset -L20 spalte1 |
---|
| 108 | typeset -R40 spalte2 |
---|
| 109 | typeset -L60 spalte3 |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | # FEHLERBEHANDLUNG |
---|
| 114 | # BEI EXIT: |
---|
| 115 | trap 'if [[ $locat != normal ]] |
---|
| 116 | then |
---|
| 117 | case $locat in |
---|
| 118 | (option) printf "\n --> available optios can be displayed" |
---|
| 119 | printf " by typing:" |
---|
| 120 | printf "\n \"subjob ?\" \n";; |
---|
| 121 | (ftpcopy|parameter|scp|verify) printf "\n";; |
---|
| 122 | (*) printf "\n +++ unknown error" |
---|
| 123 | printf "\n please inform S. Raasch!\n" |
---|
| 124 | esac |
---|
| 125 | [[ -f $job_to_send ]] && rm $job_to_send |
---|
| 126 | printf "\n\n+++ SUBJOB killed \n\n" |
---|
| 127 | fi' exit |
---|
| 128 | |
---|
| 129 | |
---|
| 130 | # BEI TERMINAL-BREAK: |
---|
| 131 | trap '[[ -f $job_to_send ]] && rm $job_to_send |
---|
| 132 | printf "\n\n+++ SUBJOB killed \n\n" |
---|
| 133 | exit |
---|
| 134 | ' 2 |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | |
---|
| 138 | |
---|
| 139 | # LOKALEN HOSTNAMEN FESTSTELLEN |
---|
| 140 | local_host=$(hostname) |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | |
---|
| 144 | # HOSTSPEZIFISCHE VARIABLEN VEREINBAREN BZW. PRUEFEN, OB LOKALER HOST |
---|
| 145 | # UEBERHAUPT ZULAESSIG IST |
---|
| 146 | case $local_host in |
---|
| 147 | (atmos) local_addres=172.20.25.35; local_host=lcide;; |
---|
[102] | 148 | (autan) local_addres=130.75.105.57; local_host=lcmuk;; |
---|
[5] | 149 | (bora) local_addres=130.75.105.103; local_host=lcmuk;; |
---|
[1] | 150 | (breg*-en0|berni*-en0) local_addres=130.73.230.10; local_host=ibmb;; |
---|
[12] | 151 | (breva) local_addres=130.75.105.98; local_host=lcmuk;; |
---|
[108] | 152 | (compute-*.local) local_addres=172.20.4.2; local_host=lcfimm;; |
---|
[1] | 153 | (cs*) local_addres=136.172.44.131; local_host=nech;; |
---|
[5] | 154 | (elephanta) local_addres=130.75.105.6; local_host=lcmuk;; |
---|
[108] | 155 | (fimm.bccs.uib.no) local_addres=172.20.4.2; local_host=lcfimm;; |
---|
[101] | 156 | (gallego) local_addres=130.75.105.10; local_host=lcmuk;; |
---|
[35] | 157 | (gate|n-sx) local_addres=133.5.178.11; local_host=neck;; |
---|
[1] | 158 | (gfdl5) local_addres=165.132.26.58; local_host=ibmy;; |
---|
| 159 | (gfdl3.yonsei.ac.kr) local_addres=165.132.26.56; local_host=decalpha;; |
---|
[5] | 160 | (gregale) local_addres=130.75.105.109; local_host=lcmuk;; |
---|
| 161 | (hababai) local_addres=130.75.105.108; local_host=lcmuk;; |
---|
[1] | 162 | (hreg*-en0|hanni*-en0) local_addres=130.75.4.10; local_host=ibmh;; |
---|
[5] | 163 | (irifi) local_addres=130.75.105.104; local_host=lcmuk;; |
---|
| 164 | (levanto) local_addres=130.75.105.45; local_host=lcmuk;; |
---|
| 165 | (maestro) local_addres=130.75.105.2; local_host=lcmuk;; |
---|
[1] | 166 | (nobel*) local_addres=150.183.5.101; local_host=ibms;; |
---|
[5] | 167 | (orkan) local_addres=130.75.105.3; local_host=lcmuk;; |
---|
| 168 | (ostria) local_addres=130.75.105.106; local_host=lcmuk;; |
---|
| 169 | (quanero) local_addres=130.75.105.107; local_host=lcmuk;; |
---|
[1] | 170 | (scirocco) local_addres=172.20.25.41; local_host=lcmuk;; |
---|
| 171 | (sun1|sun2) local_addres=130.75.6.1; local_host=unics;; |
---|
| 172 | (tgg*) local_addres=172.17.75.161; local_host=lctit;; |
---|
| 173 | (vorias) local_addres=172.20.25.43; local_host=lcmuk;; |
---|
| 174 | (*) printf "\n +++ \"$local_host\" unknown"; |
---|
| 175 | printf "\n please inform S. Raasch!"; |
---|
| 176 | locat=parameter; exit;; |
---|
| 177 | esac |
---|
| 178 | |
---|
| 179 | |
---|
| 180 | |
---|
| 181 | # REMOTE HOST DEFAULTMAESSIG = LOCAL HOST SETZEN |
---|
| 182 | remote_host=$local_host |
---|
| 183 | |
---|
| 184 | |
---|
| 185 | |
---|
| 186 | |
---|
| 187 | # PROZEDUROPTIONEN EINLESEN |
---|
[82] | 188 | while getopts :c:dDh:m:n:N:O:q:t:T:u:vX: option |
---|
[1] | 189 | do |
---|
| 190 | case $option in |
---|
| 191 | (c) job_catalog=$OPTARG;; |
---|
| 192 | (d) delete_dayfile=true;; |
---|
| 193 | (D) no_submit=true;; |
---|
| 194 | (h) remote_host=$OPTARG;; |
---|
| 195 | (m) memory=$OPTARG;; |
---|
| 196 | (n) job_name=$OPTARG;; |
---|
| 197 | (N) node_usage=$OPTARG;; |
---|
| 198 | (O) threads_per_task=$OPTARG;; |
---|
| 199 | (q) no_default_queue=$OPTARG;; |
---|
| 200 | (t) cputime=$OPTARG;; |
---|
| 201 | (T) tasks_per_node=$OPTARG;; |
---|
| 202 | (u) remote_user=$OPTARG;; |
---|
| 203 | (v) verify=false;; |
---|
| 204 | (X) numprocs=$OPTARG;; |
---|
| 205 | (\?) printf "\n +++ Option $OPTARG unknown \n"; |
---|
| 206 | locat=option; exit;; |
---|
| 207 | esac |
---|
| 208 | done |
---|
| 209 | |
---|
| 210 | |
---|
| 211 | # JOBDATEINAMEN ALS NAECHSTES ARGUMENT HOLEN |
---|
| 212 | shift OPTIND-1; file_to_send=$1 |
---|
| 213 | |
---|
| 214 | |
---|
| 215 | # KURZE AUFRUFBESCHREIBUNG WIRD HIER AUSGEGEBEN |
---|
| 216 | if [ "$1" = "?" ] |
---|
| 217 | then |
---|
| 218 | (printf "\n *** subjob can be called as follows:\n" |
---|
| 219 | printf "\n subjob -c.. -d -D -h.. -m.. -q.. -t.. -u.. -v <jobfile>\n" |
---|
| 220 | printf "\n Description of available options:\n" |
---|
| 221 | printf "\n Option Description Default-Value" |
---|
| 222 | printf "\n -c job-input- and output-catalog ~/job_queue" |
---|
| 223 | printf "\n -d no job-protocol will be created ---" |
---|
| 224 | printf "\n -D only the job-file will be created ---" |
---|
| 225 | printf "\n -h execution host, available hosts: $remote_host" |
---|
[5] | 226 | printf "\n ibm, ibmb, ibmh, ibms, ibmy, lcmuk," |
---|
[35] | 227 | printf "\n lctit, nech, neck, unics" |
---|
[1] | 228 | printf "\n -m memory demand per process in MByte ---" |
---|
| 229 | printf "\n -n jobname <jobdatei>" |
---|
| 230 | printf "\n -O threads per task (for OpenMP usage) 1" |
---|
| 231 | printf "\n -q job-queue to be used default" |
---|
| 232 | printf "\n -t allowed cpu-time in seconds ---" |
---|
| 233 | printf "\n -T tasks per node (on parallel hosts) ---" |
---|
| 234 | printf "\n -u username on execution host from .netrc" |
---|
| 235 | printf "\n -v no prompt for confirmation ---" |
---|
| 236 | printf "\n -X # of processors (on parallel hosts) 1" |
---|
| 237 | printf "\n " |
---|
| 238 | printf "\n The only possible positional parameter is <jobfile>:" |
---|
| 239 | printf "\n The complete NQS-job must be provided here." |
---|
| 240 | printf "\n <jobfile>=? creates this outline\n\n") | more |
---|
| 241 | exit |
---|
| 242 | fi |
---|
| 243 | |
---|
| 244 | |
---|
| 245 | |
---|
| 246 | # PRUEFEN, OB JOBDATEI ANGEGEBEN WURDE UND OB SIE AUCH EXISTIERT |
---|
| 247 | if [[ "$file_to_send" = "" ]] |
---|
| 248 | then |
---|
| 249 | printf "\n +++ job-file missing" |
---|
| 250 | locat=parameter; exit |
---|
| 251 | else |
---|
| 252 | if [[ -f $file_to_send ]] |
---|
| 253 | then |
---|
| 254 | true |
---|
| 255 | else |
---|
| 256 | printf "\n +++ job-file: " |
---|
| 257 | printf "\n $file_to_send" |
---|
| 258 | printf "\n does not exist" |
---|
| 259 | locat=parameter; exit |
---|
| 260 | fi |
---|
| 261 | fi |
---|
| 262 | |
---|
| 263 | |
---|
| 264 | |
---|
| 265 | # FALLS KEIN JOBNAME ANGEGEBEN WURDE, WIRD JOBNAME = JOBDATEINAME |
---|
| 266 | # GESETZT. VORAUSSETZUNG: JOBDATEINAME BEINHALTET KEINE PFADE |
---|
| 267 | if [[ $job_name = none ]] |
---|
| 268 | then |
---|
| 269 | job_name=$file_to_send |
---|
| 270 | fi |
---|
| 271 | if [[ $(echo $job_name | grep -c "/") != 0 ]] |
---|
| 272 | then |
---|
| 273 | printf "\n +++ job-file name: " |
---|
| 274 | printf "\n $job_name" |
---|
| 275 | printf "\n must not contain \"/\"-characters" |
---|
| 276 | locat=parameter; exit |
---|
| 277 | fi |
---|
| 278 | |
---|
| 279 | |
---|
| 280 | |
---|
| 281 | |
---|
| 282 | # HOSTSPEZIFISCHE GROESSEN VEREINBAREN BZW. ABBRUCH BEI UNZULAESSIGEM HOST |
---|
| 283 | # ODER WENN HOST NICHT ANGEGEBEN WURDE |
---|
| 284 | if [[ $remote_host = none ]] |
---|
| 285 | then |
---|
| 286 | printf "\n +++ host missing" |
---|
| 287 | locat=option; exit |
---|
| 288 | else |
---|
| 289 | case $remote_host in |
---|
| 290 | (ibm) queue=p690_standard; remote_addres=134.76.99.81; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
| 291 | (ibmb) queue=cpar; remote_addres=130.73.230.10; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
| 292 | (ibmh) queue=cpar; remote_addres=130.75.4.10; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
| 293 | (ibms) queue=p_normal; remote_addres=150.183.5.101; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
| 294 | (ibmy) queue=parallel; remote_addres=165.132.26.58; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
[108] | 295 | (lcfimm) remote_addres=172.20.4.2; submcom=/opt/torque/bin/qsub;; |
---|
[69] | 296 | (lctit) queue=default; remote_addres=172.17.75.161; submcom=/n1ge/TITECH_GRID/tools/bin/n1ge;; |
---|
[1] | 297 | (nech) qsubmem=memsz_job; qsubtime=cputim_job; remote_addres=136.172.44.147; submcom="/usr/local/bin/qsub";; |
---|
[35] | 298 | (neck) qsubmem=memsz_job; qsubtime=cputim_job; remote_addres=133.5.178.11; submcom="/usr/bin/nqsII/qsub";; |
---|
[1] | 299 | (vpp) qsubmem=m; qsubtime=t; queue=vpp; remote_addres=130.75.4.130;; |
---|
| 300 | (unics) qsubmem=d; qsubtime=t; queue=unics; remote_addres=130.75.6.1;; |
---|
| 301 | (*) printf "\n +++ hostname \"$remote_host\" not allowed"; |
---|
| 302 | locat=parameter; exit;; |
---|
| 303 | esac |
---|
| 304 | fi |
---|
| 305 | |
---|
| 306 | |
---|
| 307 | # EVTL. PRUEFEN, OB ANGEGEBENE QUEUE ZULAESSIG IST |
---|
| 308 | if [[ $no_default_queue != none ]] |
---|
| 309 | then |
---|
| 310 | error=false |
---|
| 311 | ndq=$no_default_queue |
---|
| 312 | case $remote_host in |
---|
| 313 | (ibm) case $ndq in |
---|
| 314 | (p690_express|p690_standard|p690_long) error=false;; |
---|
| 315 | (*) error=true;; |
---|
| 316 | esac;; |
---|
| 317 | (ibmb) case $ndq in |
---|
| 318 | (cdata|cdev|cexp|c1|cshare|csolo|cspec) error=false;; |
---|
| 319 | (*) error=true;; |
---|
| 320 | esac;; |
---|
| 321 | (ibmh) case $ndq in |
---|
| 322 | (cdata|cdev|cexp|channi|cxxl|c1|cshare|csolo|cspec) error=false;; |
---|
| 323 | (*) error=true;; |
---|
| 324 | esac;; |
---|
| 325 | (ibms) case $ndq in |
---|
| 326 | (express|normal|p_express|p_normal|p_normal_1.3|p_normal_1.7|grand) error=false;; |
---|
| 327 | (*) error=true;; |
---|
| 328 | esac;; |
---|
| 329 | (ibmy) case $ndq in |
---|
| 330 | (parallel) error=false;; |
---|
| 331 | (*) error=true;; |
---|
| 332 | esac;; |
---|
| 333 | (lctit) case $ndq in |
---|
[69] | 334 | (default|high|bes1|bes2|sla1|sla2) error=false;; |
---|
[1] | 335 | (*) error=true;; |
---|
| 336 | esac;; |
---|
| 337 | (t3eb) case $ndq in |
---|
| 338 | (berte|p50|p100|p392|forfree|p25himem) error=false;; |
---|
| 339 | (*) error=true;; |
---|
| 340 | esac;; |
---|
| 341 | (t3eh) case $ndq in |
---|
| 342 | (para_t3e|em|k|l|lm|comp_t3e|c|p|ht) error=false;; |
---|
| 343 | (*) error=true;; |
---|
| 344 | esac;; |
---|
| 345 | (t3ej2|t3ej5) case $ndq in |
---|
| 346 | (low|normal|high) error=false;; |
---|
| 347 | (*) error=true;; |
---|
| 348 | esac;; |
---|
| 349 | (t3es) case $ndq in |
---|
| 350 | (batch|serial-4|pe4|p48|pe16|pe32|pe64|pe128) error=false;; |
---|
| 351 | (*) error=true;; |
---|
| 352 | esac;; |
---|
| 353 | (unics) case $ndq in |
---|
| 354 | (unics|ht) error=false;; |
---|
| 355 | (*) error=true;; |
---|
| 356 | esac;; |
---|
| 357 | esac |
---|
| 358 | if [[ $error = true ]] |
---|
| 359 | then |
---|
| 360 | printf "\n +++ queue \"$no_default_queue\" on host \"$remote_host\" not allowed" |
---|
| 361 | locat=parameter; exit |
---|
| 362 | else |
---|
| 363 | queue=$no_default_queue |
---|
| 364 | fi |
---|
| 365 | fi |
---|
| 366 | |
---|
| 367 | |
---|
| 368 | |
---|
| 369 | # KNOTENNUTZUNG IN ENTWICKLERQUEUE MUSS SHARED SEIN |
---|
| 370 | if [[ $node_usage != shared && $queue = cdev ]] |
---|
| 371 | then |
---|
| 372 | node_usage=shared |
---|
| 373 | fi |
---|
| 374 | |
---|
| 375 | |
---|
| 376 | |
---|
| 377 | # PRUEFEN DER CPU-ZEIT, ZEIT NACH STUNDEN, MINUTEN UND SEKUNDEN |
---|
| 378 | # AUFTEILEN |
---|
| 379 | done=false |
---|
| 380 | while [[ $done = false ]] |
---|
| 381 | do |
---|
| 382 | if (( $cputime <= 0 )) |
---|
| 383 | then |
---|
| 384 | printf "\n +++ wrong cpu-time or cpu-time missing" |
---|
| 385 | printf "\n >>> Please type cpu-time in seconds as INTEGER:" |
---|
| 386 | printf "\n >>> " |
---|
| 387 | read cputime 1>/dev/null 2>&1 |
---|
| 388 | else |
---|
| 389 | done=true |
---|
| 390 | fi |
---|
| 391 | done |
---|
| 392 | if [[ $remote_host = nech ]] |
---|
| 393 | then |
---|
| 394 | if (( tasks_per_node != 0 )) |
---|
| 395 | then |
---|
| 396 | (( cputime = cputime * tasks_per_node )) |
---|
| 397 | elif [[ $numprocs != 0 ]] |
---|
| 398 | then |
---|
| 399 | (( cputime = cputime * numprocs )) |
---|
| 400 | fi |
---|
| 401 | fi |
---|
| 402 | (( stunden = cputime / 3600 )) |
---|
| 403 | (( resttime = cputime - stunden * 3600 )) |
---|
| 404 | (( minuten = resttime / 60 )) |
---|
| 405 | (( sekunden = resttime - minuten * 60 )) |
---|
| 406 | timestring=${stunden}:${minuten}:${sekunden} |
---|
| 407 | |
---|
| 408 | |
---|
| 409 | |
---|
| 410 | # PRUEFEN DER KERNSPEICHERANFORDERUNG |
---|
| 411 | done=false |
---|
| 412 | while [[ $done = false ]] |
---|
| 413 | do |
---|
| 414 | if (( memory <= 0 )) |
---|
| 415 | then |
---|
| 416 | printf "\n +++ wrong memory demand or memory demand missing" |
---|
| 417 | printf "\n >>> Please type memory in MByte per process as INTEGER:" |
---|
| 418 | printf "\n >>> " |
---|
| 419 | read memory 1>/dev/null 2>&1 |
---|
| 420 | else |
---|
| 421 | done=true |
---|
| 422 | fi |
---|
| 423 | done |
---|
| 424 | |
---|
[35] | 425 | if [[ $remote_host = nech || $remote_host = neck ]] |
---|
[1] | 426 | then |
---|
| 427 | if (( tasks_per_node != 0 )) |
---|
| 428 | then |
---|
| 429 | (( Memory = memory * tasks_per_node / 1000 )) |
---|
| 430 | elif [[ $numprocs != 0 ]] |
---|
| 431 | then |
---|
| 432 | (( Memory = memory * numprocs / 1000 )) |
---|
| 433 | else |
---|
| 434 | (( Memory = memory / 1000 )) |
---|
| 435 | fi |
---|
| 436 | fi |
---|
| 437 | |
---|
| 438 | |
---|
| 439 | # SPEICHERBERECHNUNG BEI OPENMP-NUTZUNG |
---|
| 440 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
| 441 | then |
---|
| 442 | (( memory = memory * threads_per_task )) |
---|
| 443 | fi |
---|
| 444 | |
---|
| 445 | |
---|
| 446 | # BERECHNUNG DER ANZAHL DER ZU VERWENDENDEN KNOTEN |
---|
| 447 | if (( tasks_per_node != 0 )) |
---|
| 448 | then |
---|
| 449 | (( nodes = numprocs / ( tasks_per_node * threads_per_task ) )) |
---|
| 450 | fi |
---|
| 451 | |
---|
| 452 | |
---|
| 453 | |
---|
| 454 | # HEADER-AUSGABE |
---|
| 455 | if [[ $verify = true ]] |
---|
| 456 | then |
---|
| 457 | printf "\n\n" |
---|
| 458 | printf "#--------------------------------------------------------------# \n" |
---|
| 459 | spalte1=SUBJOB;spalte2=$(date) |
---|
| 460 | printf "| $spalte1$spalte2 | \n" |
---|
| 461 | printf "| | \n" |
---|
| 462 | printf "| values of parameters/options: | \n" |
---|
| 463 | spalte1=local_host$punkte; spalte2=$punkte$local_host |
---|
| 464 | printf "| $spalte1$spalte2 | \n" |
---|
| 465 | spalte1=remote_host$punkte; spalte2=$punkte$remote_host |
---|
| 466 | printf "| $spalte1$spalte2 | \n" |
---|
| 467 | spalte1=queue$punkte; spalte2=$punkte$queue |
---|
| 468 | printf "| $spalte1$spalte2 | \n" |
---|
| 469 | spalte1=memory$punkte; spalte2="$punkte$memory mb" |
---|
| 470 | printf "| $spalte1$spalte2 | \n" |
---|
| 471 | spalte1=cputime$punkte; spalte2="$punkte$cputime sec" |
---|
| 472 | printf "| $spalte1$spalte2 | \n" |
---|
| 473 | spalte1=job_name$punkte; spalte2="$punkte$job_name" |
---|
| 474 | printf "| $spalte1$spalte2 | \n" |
---|
| 475 | printf "#--------------------------------------------------------------# \n\n" |
---|
| 476 | |
---|
| 477 | |
---|
| 478 | # KONTROLLABFRAGE, OB ALLES O.K. |
---|
| 479 | antwort="dummy" |
---|
| 480 | while [[ $antwort != y && $antwort != Y && $antwort != n && $antwort != N ]] |
---|
| 481 | do |
---|
| 482 | read antwort?" >>> continue (y/n) ? " |
---|
| 483 | done |
---|
| 484 | if [[ $antwort = n || $antwort = N ]] |
---|
| 485 | then |
---|
| 486 | locat=verify; exit |
---|
| 487 | fi |
---|
| 488 | printf "\n" |
---|
| 489 | fi |
---|
| 490 | |
---|
| 491 | |
---|
| 492 | |
---|
| 493 | # ZUFALLSKENNUNG GENERIEREN UND JOBNAMEN AUF ZIELRECHNER BESTIMMEN |
---|
| 494 | kennung=$RANDOM |
---|
| 495 | job_on_remhost=${job_name}_${kennung}_$local_host |
---|
| 496 | job_to_send=job_to_send_$kennung |
---|
| 497 | if [[ $delete_dayfile = false ]] |
---|
| 498 | then |
---|
| 499 | remote_dayfile=${local_host}_${job_name}_result_$kennung |
---|
| 500 | local_dayfile=${remote_host}_${job_name} |
---|
| 501 | else |
---|
| 502 | remote_dayfile=/dev/null |
---|
| 503 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
| 504 | then |
---|
| 505 | notification='# @ notification = never' |
---|
| 506 | fi |
---|
| 507 | fi |
---|
| 508 | |
---|
| 509 | |
---|
| 510 | |
---|
| 511 | # QSUB- ODER LL-KOMMANDOS BZW. SKRIPTE GENERIEREN |
---|
| 512 | if [[ $(echo $remote_host | cut -c1-3) = ibm && $numprocs != 0 ]] |
---|
| 513 | then |
---|
| 514 | |
---|
| 515 | if [[ $remote_host = ibmy ]] |
---|
| 516 | then |
---|
| 517 | consumable_memory="" |
---|
| 518 | else |
---|
| 519 | consumable_memory="ConsumableMemory($memory mb)" |
---|
| 520 | fi |
---|
| 521 | if [[ $queue = cdev ]] |
---|
| 522 | then |
---|
| 523 | data_limit="# @ data_limit = 1.76gb" |
---|
| 524 | network_to_use="# @ network.mpi = sn_all,shared,ip" |
---|
| 525 | else |
---|
| 526 | if [[ $remote_host = ibms ]] |
---|
| 527 | then |
---|
| 528 | network_to_use="# @ network.mpi = csss,shared,us" |
---|
| 529 | elif [[ $remote_host = ibmy ]] |
---|
| 530 | then |
---|
| 531 | network_to_use="" |
---|
| 532 | else |
---|
| 533 | network_to_use="# @ network.mpi = sn_all,shared,us" |
---|
| 534 | data_limit="# @ data_limit = 1.76gb" |
---|
| 535 | fi |
---|
| 536 | fi |
---|
| 537 | |
---|
| 538 | cat > $job_to_send << %%END%% |
---|
| 539 | #!/bin/ksh |
---|
| 540 | |
---|
| 541 | # @ job_type = parallel |
---|
| 542 | # @ job_name = palm |
---|
| 543 | # @ wall_clock_limit = ${timestring},$timestring |
---|
| 544 | # @ resources = ConsumableCpus($threads_per_task) $consumable_memory |
---|
| 545 | # @ output = $remote_dayfile |
---|
| 546 | # @ error = $remote_dayfile |
---|
| 547 | # @ image_size = 50 |
---|
| 548 | # @ class = $queue |
---|
| 549 | # @ environment = OMP_NUM_THREADS=$threads_per_task; MP_SHARED_MEMORY=yes |
---|
| 550 | $network_to_use |
---|
| 551 | $data_limit |
---|
| 552 | $notification |
---|
| 553 | |
---|
| 554 | %%END%% |
---|
| 555 | |
---|
| 556 | if (( nodes > 0 )) |
---|
| 557 | then |
---|
| 558 | |
---|
| 559 | cat >> $job_to_send << %%END%% |
---|
| 560 | # @ node = $nodes |
---|
| 561 | # @ tasks_per_node = $tasks_per_node |
---|
| 562 | # @ node_usage = $node_usage |
---|
| 563 | # @ queue |
---|
| 564 | |
---|
| 565 | %%END%% |
---|
| 566 | |
---|
| 567 | else |
---|
| 568 | |
---|
| 569 | if [[ $remote_host != ibmy ]] |
---|
| 570 | then |
---|
| 571 | |
---|
| 572 | cat >> $job_to_send << %%END%% |
---|
| 573 | # @ blocking = unlimited |
---|
| 574 | # @ total_tasks = $numprocs |
---|
| 575 | # @ node_usage = $node_usage |
---|
| 576 | # @ queue |
---|
| 577 | |
---|
| 578 | %%END%% |
---|
| 579 | |
---|
| 580 | else |
---|
| 581 | |
---|
| 582 | cat >> $job_to_send << %%END%% |
---|
| 583 | # @ node = 1 |
---|
| 584 | # @ total_tasks = $numprocs |
---|
| 585 | # @ queue |
---|
| 586 | |
---|
| 587 | %%END%% |
---|
| 588 | |
---|
| 589 | fi |
---|
| 590 | |
---|
| 591 | fi |
---|
| 592 | |
---|
| 593 | elif [[ $(echo $remote_host | cut -c1-3) = ibm && $numprocs = 0 ]] |
---|
| 594 | then |
---|
| 595 | |
---|
| 596 | cat > $job_to_send << %%END%% |
---|
| 597 | #!/bin/ksh |
---|
| 598 | |
---|
| 599 | # @ job_type = serial |
---|
| 600 | # @ node_usage = $node_usage |
---|
| 601 | # @ job_name = palm |
---|
| 602 | # @ wall_clock_limit = ${timestring},$timestring |
---|
| 603 | # @ resources = ConsumableCpus(1) ConsumableMemory(1 gb) |
---|
| 604 | # @ output = $remote_dayfile |
---|
| 605 | # @ error = $remote_dayfile |
---|
| 606 | # @ class = $queue |
---|
| 607 | $notification |
---|
| 608 | |
---|
| 609 | # @ queue |
---|
| 610 | |
---|
| 611 | %%END%% |
---|
| 612 | |
---|
[108] | 613 | elif [[ $remote_host = lcfimm ]] |
---|
| 614 | then |
---|
| 615 | |
---|
| 616 | if [[ $numprocs != 0 ]] |
---|
| 617 | then |
---|
| 618 | cat > $job_to_send << %%END%% |
---|
| 619 | #!/bin/ksh |
---|
| 620 | #PBS -N $job_name |
---|
| 621 | #PBS -A nersc |
---|
| 622 | #PBS -l walltime=$timestring |
---|
| 623 | #PBS -l nodes=${nodes}:ppn=$tasks_per_node |
---|
| 624 | #PBS -l pmem=${memory}mb |
---|
| 625 | #PBS -m abe |
---|
| 626 | #PBS -M igore@nersc.no |
---|
| 627 | #PBS -o $remote_dayfile |
---|
| 628 | #PBS -j oe |
---|
| 629 | mpd & |
---|
| 630 | |
---|
| 631 | %%END%% |
---|
| 632 | |
---|
| 633 | else |
---|
| 634 | cat > $job_to_send << %%END%% |
---|
| 635 | #!/bin/ksh |
---|
| 636 | #PBS -N $job_name |
---|
| 637 | #PBS -A nersc |
---|
| 638 | #PBS -l walltime=$timestring |
---|
| 639 | #PBS -l ncpus=1 |
---|
| 640 | #PBS -l pmem=${memory}mb |
---|
| 641 | #PBS -m abe |
---|
| 642 | #PBS -M igore@nersc.no |
---|
| 643 | #PBS -o $remote_dayfile |
---|
| 644 | #PBS -j oe |
---|
| 645 | |
---|
| 646 | %%END%% |
---|
| 647 | |
---|
| 648 | fi |
---|
| 649 | |
---|
[1] | 650 | elif [[ $remote_host = nech ]] |
---|
| 651 | then |
---|
| 652 | |
---|
| 653 | if (( nodes > 1 )) |
---|
| 654 | then |
---|
| 655 | cat > $job_to_send << %%END%% |
---|
| 656 | #!/bin/ksh |
---|
| 657 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
| 658 | #PBS -l ${qsubmem}=${Memory}gb |
---|
| 659 | #PBS -b $nodes |
---|
| 660 | #PBS -o $remote_dayfile |
---|
| 661 | #PBS -N palm |
---|
| 662 | #PBS -j o |
---|
| 663 | #PBS -T mpisx |
---|
| 664 | |
---|
| 665 | %%END%% |
---|
| 666 | |
---|
| 667 | elif [[ $numprocs != 0 ]] |
---|
| 668 | then |
---|
| 669 | cat > $job_to_send << %%END%% |
---|
| 670 | #!/bin/ksh |
---|
| 671 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
| 672 | #PBS -l ${qsubmem}=${Memory}gb |
---|
| 673 | #PBS -o $remote_dayfile |
---|
| 674 | #PBS -N palm |
---|
| 675 | #PBS -j o |
---|
| 676 | |
---|
| 677 | %%END%% |
---|
| 678 | |
---|
| 679 | else |
---|
| 680 | cat > $job_to_send << %%END%% |
---|
| 681 | #!/bin/ksh |
---|
| 682 | #PBS -l ${qsubmem}=${Memory}gb,${qsubtime}=$cputime |
---|
| 683 | #PBS -o $remote_dayfile |
---|
| 684 | #PBS -j o |
---|
| 685 | |
---|
| 686 | %%END%% |
---|
| 687 | |
---|
| 688 | fi |
---|
| 689 | |
---|
[35] | 690 | elif [[ $remote_host = neck ]] |
---|
| 691 | then |
---|
| 692 | |
---|
| 693 | if (( nodes > 1 )) |
---|
| 694 | then |
---|
| 695 | cat > $job_to_send << %%END%% |
---|
| 696 | #!/bin/ksh |
---|
| 697 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
| 698 | #PBS -l ${qsubmem}=${Memory}gb |
---|
| 699 | #PBS -b $nodes |
---|
| 700 | #PBS -o $remote_dayfile |
---|
| 701 | #PBS -N palm |
---|
| 702 | #PBS -j o |
---|
| 703 | #PBS -T mpisx |
---|
| 704 | |
---|
| 705 | %%END%% |
---|
| 706 | |
---|
| 707 | elif [[ $numprocs != 0 ]] |
---|
| 708 | then |
---|
| 709 | cat > $job_to_send << %%END%% |
---|
| 710 | #!/bin/ksh |
---|
| 711 | #PBS -q ${queue} |
---|
| 712 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
| 713 | #PBS -l ${qsubmem}=${Memory}gb |
---|
| 714 | #PBS -o $remote_dayfile |
---|
| 715 | #PBS -N palm |
---|
| 716 | #PBS -j o |
---|
| 717 | #PBS -T mpisx |
---|
| 718 | |
---|
| 719 | %%END%% |
---|
| 720 | |
---|
| 721 | else |
---|
| 722 | cat > $job_to_send << %%END%% |
---|
| 723 | #!/bin/ksh |
---|
| 724 | #PBS -l ${qsubmem}=${Memory}gb,${qsubtime}=$cputime |
---|
| 725 | #PBS -o $remote_dayfile |
---|
| 726 | #PBS -j o |
---|
| 727 | |
---|
| 728 | %%END%% |
---|
| 729 | |
---|
| 730 | fi |
---|
| 731 | |
---|
[1] | 732 | elif [[ $remote_host = lctit ]] |
---|
| 733 | then |
---|
| 734 | cat > $job_to_send << %%END%% |
---|
| 735 | #!/bin/bash |
---|
| 736 | #$ -S /bin/bash |
---|
| 737 | cd $job_catalog |
---|
[69] | 738 | export PATH=$PALM_BIN:\$PATH |
---|
| 739 | echo \$PATH |
---|
[1] | 740 | |
---|
| 741 | %%END%% |
---|
| 742 | |
---|
| 743 | # OPTIONEN FUER SUBMIT-KOMMANDO ZUSAMMENSTELLEN |
---|
| 744 | submcom="$submcom -N $job_name -sgeout $remote_dayfile -q default" |
---|
| 745 | |
---|
| 746 | else |
---|
| 747 | |
---|
| 748 | cat > $job_to_send << %%END%% |
---|
| 749 | # @\$-q ${queue} |
---|
| 750 | # @\$-l${qsubtime} $timestring |
---|
| 751 | # @\$-l${qsubmem} ${memory}mb |
---|
| 752 | # @\$-o $remote_dayfile |
---|
| 753 | # @\$-eo |
---|
| 754 | |
---|
| 755 | %%END%% |
---|
| 756 | |
---|
| 757 | fi |
---|
| 758 | |
---|
| 759 | |
---|
| 760 | # BEI RECHNUNG AUF REMOTE-MASCHINEN RUECKTRANSFER DES DAYFILES PER TRAP |
---|
| 761 | # BEI EXIT VERANLASSEN |
---|
| 762 | # VEKTORRECHNER MUSS EIGENEN JOB STARTEN, DA DORT NOHUP NICHT FUNKTIONIERT |
---|
| 763 | # AUF IBM IN SEOUL IST RUECKTRANSFER ZUR ZEIT GENERELL NICHT MOEGLICH |
---|
| 764 | if [[ $delete_dayfile = false && $remote_host != $local_host ]] |
---|
| 765 | then |
---|
| 766 | echo "set +vx" >> $job_to_send |
---|
| 767 | echo "trap '" >> $job_to_send |
---|
| 768 | echo "set +vx" >> $job_to_send |
---|
[35] | 769 | if [[ $(echo $remote_host | cut -c1-3) = ibm || $(echo $remote_host | cut -c1-3) = nec || $remote_host = lctit ]] |
---|
[1] | 770 | then |
---|
| 771 | if [[ $remote_host = ibmb || $remote_host = ibmh ]] |
---|
| 772 | then |
---|
| 773 | return_queue=c1 |
---|
| 774 | elif [[ $remote_host = ibms ]] |
---|
| 775 | then |
---|
| 776 | return_queue=p_normal |
---|
| 777 | elif [[ $remote_host = ibmy ]] |
---|
| 778 | then |
---|
| 779 | return_queue=serial |
---|
| 780 | elif [[ $remote_host = lctit ]] |
---|
| 781 | then |
---|
| 782 | return_queue=default |
---|
[35] | 783 | elif [[ $remote_host = neck ]] |
---|
[1] | 784 | then |
---|
[35] | 785 | return_queue=S |
---|
[1] | 786 | else |
---|
| 787 | return_queue=unknown |
---|
| 788 | fi |
---|
| 789 | |
---|
| 790 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
| 791 | then |
---|
| 792 | |
---|
| 793 | echo "echo \"#!/bin/ksh\" >> scpjob.$kennung" >> $job_to_send |
---|
| 794 | echo "echo \"# @ job_type = serial\" >> scpjob.$kennung" >> $job_to_send |
---|
| 795 | echo "echo \"# @ job_name = transfer\" >> scpjob.$kennung" >> $job_to_send |
---|
| 796 | echo "echo \"# @ resources = ConsumableCpus(1) ConsumableMemory(1 gb)\" >> scpjob.$kennung" >> $job_to_send |
---|
| 797 | echo "echo \"# @ wall_clock_limit = 00:10:00,00:10:00\" >> scpjob.$kennung " >> $job_to_send |
---|
| 798 | echo "echo \"# @ output = job_queue/last_job_transfer_protocol\" >> scpjob.$kennung" >> $job_to_send |
---|
| 799 | echo "echo \"# @ error = job_queue/last_job_transfer_protocol\" >> scpjob.$kennung" >> $job_to_send |
---|
| 800 | echo "echo \"# @ class = $return_queue\" >> scpjob.$kennung" >> $job_to_send |
---|
| 801 | echo "echo \"# @ image_size = 10\" >> scpjob.$kennung" >> $job_to_send |
---|
| 802 | echo "echo \"# @ notification = never\" >> scpjob.$kennung" >> $job_to_send |
---|
| 803 | |
---|
| 804 | echo "echo \"# @ queue\" >> scpjob.$kennung" >> $job_to_send |
---|
| 805 | echo "echo \" \" >> scpjob.$kennung" >> $job_to_send |
---|
| 806 | |
---|
| 807 | echo "echo \"set -x\" >> scpjob.$kennung" >> $job_to_send |
---|
| 808 | echo "echo \"batch_scp -d -w 10 -u $local_user $local_addres ${job_catalog}/$remote_dayfile \\\"$job_catalog\\\" $local_dayfile\" >> scpjob.$kennung" >> $job_to_send |
---|
| 809 | echo "echo \"exit\" >> scpjob.$kennung" >> $job_to_send |
---|
| 810 | |
---|
| 811 | elif [[ $remote_host = nech ]] |
---|
| 812 | then |
---|
| 813 | echo "cd /pf/b/${remote_user}/job_queue" >> $job_to_send |
---|
| 814 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
| 815 | echo "#PBS -l ${qsubmem}=1GB,${qsubtime}=100" >> $job_to_send |
---|
| 816 | echo "#PBS -o last_job_transfer_protocol" >> $job_to_send |
---|
| 817 | echo "#PBS -j o" >> $job_to_send |
---|
| 818 | echo " " >> $job_to_send |
---|
| 819 | echo "set -x" >> $job_to_send |
---|
| 820 | echo "cd /pf/b/${remote_user}/job_queue" >> $job_to_send |
---|
| 821 | echo "batch_scp -d -w 10 -u $local_user $local_addres $remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
| 822 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
| 823 | echo "%%END%%" >> $job_to_send |
---|
| 824 | |
---|
[35] | 825 | elif [[ $remote_host = neck ]] |
---|
| 826 | then |
---|
| 827 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
| 828 | echo "#PBS -q $return_queue" >> $job_to_send |
---|
| 829 | echo "#PBS -l ${qsubmem}=1GB,${qsubtime}=100" >> $job_to_send |
---|
| 830 | echo "#PBS -o last_job_transfer_protocol" >> $job_to_send |
---|
| 831 | echo "#PBS -j o" >> $job_to_send |
---|
| 832 | echo " " >> $job_to_send |
---|
| 833 | echo "set -x" >> $job_to_send |
---|
| 834 | echo "batch_scp -d -w 10 -u $local_user $local_addres $remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
| 835 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
| 836 | echo "%%END%%" >> $job_to_send |
---|
| 837 | |
---|
[1] | 838 | elif [[ $remote_host = lctit ]] |
---|
| 839 | then |
---|
| 840 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
| 841 | echo "set -x" >> $job_to_send |
---|
| 842 | echo "PATH=\$PATH:$job_catalog/../pub" >> $job_to_send |
---|
| 843 | echo "cd $job_catalog" >> $job_to_send |
---|
| 844 | echo "batch_scp -d -w 10 -u $local_user $local_addres $remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
| 845 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
| 846 | echo "%%END%%" >> $job_to_send |
---|
| 847 | |
---|
| 848 | else |
---|
| 849 | |
---|
| 850 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
| 851 | echo "# @\\\$-q $return_queue" >> $job_to_send |
---|
| 852 | echo "# @\\\$-l${qsubtime} 10" >> $job_to_send |
---|
| 853 | echo "# @\\\$-l${qsubmem} 10mb" >> $job_to_send |
---|
| 854 | if [[ $remote_host = t3ej2 || $remote_host = t3ej5 || $remote_host = t3es ]] |
---|
| 855 | then |
---|
| 856 | echo "# @\$-l mpp_p=0" >> $job_to_send |
---|
| 857 | fi |
---|
| 858 | echo '# @\$-lF 10mb' >> $job_to_send |
---|
| 859 | # echo '# @\$-o /dev/null' >> $job_to_send |
---|
| 860 | echo '# @\$-o job_queue/last_job_transfer_protocol' >> $job_to_send |
---|
| 861 | echo '# @\\\$-eo' >> $job_to_send |
---|
| 862 | echo " " >> $job_to_send |
---|
| 863 | if [[ $remote_host = t3ej2 || $remote_host = t3ej5 ]] |
---|
| 864 | then |
---|
| 865 | echo "set +vx" >> $job_to_send |
---|
| 866 | echo ". .profile" >> $job_to_send |
---|
| 867 | fi |
---|
| 868 | echo "set -x" >> $job_to_send |
---|
| 869 | echo "batch_scp -d -w 10 -u $local_user $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile > /dev/null" >> $job_to_send |
---|
| 870 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
| 871 | echo "%%END%%" >> $job_to_send |
---|
| 872 | fi |
---|
| 873 | |
---|
| 874 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
| 875 | then |
---|
| 876 | echo "llsubmit scpjob.$kennung" >> $job_to_send |
---|
| 877 | elif [[ $remote_host = lctit ]] |
---|
| 878 | then |
---|
| 879 | echo "chmod u+x scpjob.$kennung" >> $job_to_send |
---|
| 880 | echo "rm -rf ${job_catalog}/last_job_transfer_protocol" >> $job_to_send |
---|
| 881 | echo "n1ge -N jobtransfer -q $return_queue -sgeout ${job_catalog}/last_job_transfer_protocol scpjob.$kennung" >> $job_to_send |
---|
| 882 | echo "sleep 10" >> $job_to_send |
---|
| 883 | elif [[ $remote_host = t3eb || $remote_host = t3eh || $remote_host = t3ej2 || $remote_host = t3ej5 ]] |
---|
| 884 | then |
---|
| 885 | echo "qsub -J n scpjob.$kennung" >> $job_to_send |
---|
| 886 | elif [[ $remote_host = t3es ]] |
---|
| 887 | then |
---|
| 888 | echo "qsub -J n -s /bin/ksh scpjob.$kennung" >> $job_to_send |
---|
| 889 | else |
---|
| 890 | echo "qsub scpjob.$kennung" >> $job_to_send |
---|
| 891 | fi |
---|
| 892 | echo "rm scpjob.$kennung" >> $job_to_send |
---|
| 893 | if [[ $remote_host = nech ]] |
---|
| 894 | then |
---|
| 895 | echo "cd -" >> $job_to_send |
---|
| 896 | fi |
---|
| 897 | else |
---|
| 898 | # echo "ftpcopy -d $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
| 899 | echo "nohup ftpcopy -d -w 15 $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile > /dev/null &" >> $job_to_send |
---|
| 900 | fi |
---|
| 901 | echo "set -x" >> $job_to_send |
---|
| 902 | echo " ' exit" >> $job_to_send |
---|
| 903 | echo "set -x" >> $job_to_send |
---|
| 904 | fi |
---|
| 905 | |
---|
| 906 | |
---|
| 907 | |
---|
| 908 | # EIGENTLICHE JOB-DATEI AN QSUB-KOMMANDOS ANHAENGEN |
---|
| 909 | cat $file_to_send >> $job_to_send |
---|
[69] | 910 | |
---|
[1] | 911 | if [[ $remote_host = ibm ]] |
---|
| 912 | then |
---|
| 913 | echo " " >> $job_to_send |
---|
| 914 | echo "exit" >> $job_to_send |
---|
| 915 | fi |
---|
[69] | 916 | if [[ $remote_host = lctit ]] |
---|
| 917 | then |
---|
| 918 | echo " " >> $job_to_send |
---|
| 919 | echo "rm ~/job_queue/$job_on_remhost" >> $job_to_send |
---|
| 920 | fi |
---|
[1] | 921 | |
---|
| 922 | |
---|
| 923 | |
---|
| 924 | # USER-NAME AUF ZIELRECHNER AUS .NETRC-DATEI ERMITTELN |
---|
| 925 | if [[ -z $remote_user ]] |
---|
| 926 | then |
---|
| 927 | if [[ $remote_host = t3eb || $remote_host = t3eh || $remote_host = t3ej2 || $remote_host = t3ej5 || $remote_host = t3es || $remote_host = vpp ]] |
---|
| 928 | then |
---|
| 929 | grep $remote_addres ~/.netrc | read dum dum dum remote_user dum dum |
---|
| 930 | fi |
---|
| 931 | fi |
---|
| 932 | |
---|
| 933 | |
---|
| 934 | |
---|
| 935 | # JOB AUF ZIELRECHNER TRANSFERIEREN BZW. INS JOBVERZEICHNIS KOPIEREN |
---|
| 936 | if [[ $no_submit = false ]] |
---|
| 937 | then |
---|
| 938 | if [[ $remote_host != $local_host ]] |
---|
| 939 | then |
---|
| 940 | [[ $verify = true ]] && printf "\n >>> transfering job to \"$remote_host\"..." |
---|
[82] | 941 | if [[ $remote_host = ibms || $remote_host = ibmy ]] # ssh on ibms cannot handle "~/" |
---|
[1] | 942 | then |
---|
[82] | 943 | job_catalog_save=$job_catalog |
---|
| 944 | job_catalog=job_queue |
---|
| 945 | elif [[ $remote_host = nech ]] |
---|
| 946 | then |
---|
| 947 | job_catalog_save=$job_catalog |
---|
| 948 | job_catalog=/hpf/b/${remote_user}/job_queue |
---|
| 949 | fi |
---|
| 950 | if [[ $local_host = decalpha ]] |
---|
| 951 | then |
---|
| 952 | # VERWENDUNG VON SCP AUF DECALPHA FRAGT FEHLERHAFTERWEISE |
---|
| 953 | # PASSWORT AB |
---|
| 954 | /bin/scp $job_to_send ${remote_user}@${remote_addres}:${job_catalog}/$job_on_remhost |
---|
| 955 | elif [[ $remote_host = nech ]] |
---|
| 956 | then |
---|
| 957 | # DATEIEN KOENNEN NUR UEBER DEN ARCHIVE-SERVER DES DKRZ |
---|
| 958 | # TRANSFERIERT WERDEN |
---|
| 959 | scp $job_to_send ${remote_user}@136.172.44.205:${job_catalog}/$job_on_remhost |
---|
[1] | 960 | else |
---|
[82] | 961 | scp $job_to_send ${remote_user}@${remote_addres}:${job_catalog}/$job_on_remhost |
---|
[1] | 962 | fi |
---|
[82] | 963 | if [[ $? = 1 ]] |
---|
| 964 | then |
---|
| 965 | locat=scp; exit |
---|
| 966 | fi |
---|
| 967 | if [[ $remote_host = ibms ]] |
---|
| 968 | then |
---|
| 969 | job_catalog=$job_catalog_save |
---|
| 970 | fi |
---|
[1] | 971 | [[ $verify = true ]] && printf "\n >>> finished\n" |
---|
| 972 | else |
---|
| 973 | eval job_catalog=$job_catalog |
---|
| 974 | cp $job_to_send ${job_catalog}/$job_on_remhost |
---|
| 975 | fi |
---|
| 976 | |
---|
| 977 | |
---|
| 978 | |
---|
| 979 | # NQS- BZW. LOADLEVELER-JOB STARTEN |
---|
| 980 | if [[ $remote_host != $local_host ]] |
---|
| 981 | then |
---|
| 982 | [[ $verify = true ]] && printf "\n >>> submitting job using \"qsub\"...\n" |
---|
[82] | 983 | if [[ $remote_host != lctit ]] |
---|
[1] | 984 | then |
---|
[82] | 985 | ssh $remote_addres -l $remote_user "cd $job_catalog; $submcom $job_on_remhost; rm $job_on_remhost" |
---|
[1] | 986 | else |
---|
[82] | 987 | # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
| 988 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
| 989 | # UEBERGANGSWEISE CHECK, OB N1GE ENVIRONMENT WIRKLICH VERFUEGBAR |
---|
| 990 | print "cd $job_catalog; chmod u+x $job_on_remhost" | ssh $remote_addres -l $remote_user > /dev/null 2>&1 |
---|
| 991 | echo "first try" > send_protocol |
---|
| 992 | while [[ $(cat send_protocol | grep -c "Forwarding to N1GE") = 0 ]] |
---|
| 993 | do |
---|
| 994 | if [[ $(cat send_protocol | grep -c "first try") = 1 ]] |
---|
| 995 | then |
---|
| 996 | printf "\n trying to submit job to TIT cluster..." |
---|
| 997 | else |
---|
| 998 | printf "\n +++ failed ... trying to submit again ..." |
---|
| 999 | fi |
---|
| 1000 | print "cd $job_catalog; $submcom $job_on_remhost" | ssh $remote_addres -l $remote_user > send_protocol 2>&1 |
---|
| 1001 | cat send_protocol |
---|
| 1002 | done |
---|
| 1003 | sleep 10 |
---|
| 1004 | print "cd $job_catalog; rm $job_on_remhost" | ssh $remote_addres -l $remote_user > /dev/null 2>&1 |
---|
| 1005 | echo "$submcom $job_on_remhost" |
---|
| 1006 | rm send_protocol |
---|
| 1007 | fi |
---|
[1] | 1008 | |
---|
| 1009 | [[ $verify = true ]] && printf " >>> o.k.\n" |
---|
| 1010 | else |
---|
| 1011 | cd $job_catalog |
---|
| 1012 | if [[ $(echo $local_host | cut -c1-3) = ibm ]] |
---|
| 1013 | then |
---|
| 1014 | eval $submcom $job_on_remhost |
---|
[108] | 1015 | elif [[ $local_host = lcfimm ]] |
---|
| 1016 | then |
---|
| 1017 | eval $submcom $job_on_remhost |
---|
| 1018 | echo "$submcom $job_on_remhost" |
---|
| 1019 | chmod u+x $job_on_remhost |
---|
[1] | 1020 | elif [[ $local_host = lctit ]] |
---|
| 1021 | then |
---|
| 1022 | eval $submcom $job_on_remhost |
---|
| 1023 | echo "$submcom $job_on_remhost" |
---|
| 1024 | chmod u+x $job_on_remhost |
---|
| 1025 | elif [[ $local_host = nech ]] |
---|
| 1026 | then |
---|
| 1027 | if [[ $queue = default ]] |
---|
| 1028 | then |
---|
| 1029 | eval $submcom $job_on_remhost |
---|
| 1030 | else |
---|
| 1031 | eval $submcom -q $queue $job_on_remhost |
---|
| 1032 | fi |
---|
| 1033 | else |
---|
| 1034 | qsub $job_on_remhost |
---|
| 1035 | fi |
---|
[69] | 1036 | # JOBFILE DARF AUF LCTIT NICHT GELOESCHT WERDEN!! GESCHIEHT ERST AM JOBENDE |
---|
| 1037 | [[ $local_host != lctit ]] && rm $job_on_remhost |
---|
[1] | 1038 | cd - > /dev/null |
---|
| 1039 | fi |
---|
| 1040 | fi |
---|
| 1041 | |
---|
| 1042 | |
---|
| 1043 | |
---|
| 1044 | # ABSCHLUSSARBEITEN |
---|
| 1045 | |
---|
| 1046 | if [[ $no_submit = false ]] |
---|
| 1047 | then |
---|
| 1048 | rm $job_to_send |
---|
| 1049 | fi |
---|
| 1050 | [[ $verify = true ]] && printf "\n\n *** SUBJOB finished \n\n" |
---|