File: package.html

package info (click to toggle)
libpj-java 0.0~20150107%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 13,396 kB
  • sloc: java: 99,543; ansic: 987; sh: 153; xml: 26; makefile: 10; sed: 4
file content (816 lines) | stat: -rw-r--r-- 30,876 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
<HTML>
<HEAD>
<TITLE>Package edu.rit.pj.cluster</TITLE>
</HEAD>
<BODY>

Package edu.rit.pj.cluster contains client and server programs
for message passing parallel programming using Parallel Java (PJ).
PJ message passing programs use class
<A HREF="../Comm.html">edu.rit.pj.Comm</A>,
and class Comm in turn uses package edu.rit.pj.cluster.
PJ message passing programs
do not use package edu.rit.pj.cluster directly.
For further information about PJ,
see package <A HREF="../package-summary.html">edu.rit.pj</A>.

<P>
<A HREF="#operation">PJ Cluster Operation</A>
<BR><A HREF="#configuration">PJ Cluster Configuration</A>
<BR><A HREF="#design">PJ Cluster Design</A>
<BR><A HREF="#debug">PJ Job Scheduler Debugging</A>

<P>
<HR>
<A NAME="operation"><H2>PJ Cluster Operation</H2></A>

<P>
A cluster parallel computer typically consists of a frontend node
and one or more backend nodes
connected via a dedicated high-speed network.
To run a PJ message passing program on a cluster parallel computer,
several things must be set up first:
<UL>
<LI>
Set up a configuration file
on the frontend node
containing information about the cluster.
For further information,
see class <A HREF="Configuration.html">Configuration</A>.
<BR>&nbsp;
<LI>
Run the PJ Job Scheduler Daemon on the frontend node.
This allows the PJ message passing program
to determine which backend nodes are available
for running a process.
The Job Scheduler Daemon reads the configuration file
to get information about the cluster.
For further information,
see class <A HREF="JobScheduler.html">JobScheduler</A>.
<BR>&nbsp;
<LI>
The PJ message passing program uses the Secure Shell (SSH)
to start a backend process in the user's account
on each backend node.
Therefore, it must be possible to do an SSH remote login
from the frontend node to each backend node.
Each backend node must have SSH enabled.
<BR>&nbsp;
<LI>
Furthermore,
it must be possible to do an SSH remote login
from the frontend node to each backend node
<I>without the user having to type a password.</I>
This is done using public key authentication.
SSH must have public key authentication enabled.
Each user must set up SSH public and private keys
in his or her account.
For further information,
refer to the SSH documentation.
</UL>

<P>
Once the above setup has been done,
you can run a PJ message passing program
that uses class <A HREF="../Comm.html">edu.rit.pj.Comm</A>
on the frontend node.
Class Comm in turn uses a <A HREF="JobFrontend.html">JobFrontend</A>.
The job frontend contacts the Job Scheduler Daemon
running on the frontend node
to start a parallel processing job
using a given number of backend nodes.
If there are not enough idle backend nodes,
the job frontend waits until there are enough.
Once the backend nodes have been assigned to the job,
the job frontend prints the job number
and the names of the backend nodes.
Using SSH, the job frontend then starts
a <A HREF="JobBackend.html">JobBackend</A> process
on each backend node.
The job backend processes
run in the user's account,
and they run in the same current directory
as the job frontend process.
The job backend processes execute the parallel program,
passing messages among themselves.
The job backend processes' standard output and standard error streams
are redirected to the job frontend process,
which copies them to its own standard output and standard error.

<P>
The Job Scheduler Daemon uses the <I>nn,</I>
<I>np,</I> and <I>nt</I> settings to assign resources to a job.
These settings are specified by the <TT>-Dpj.nn</TT>,
<TT>-Dpj.np</TT>, and <TT>-Dpj.nt</TT> flags
on the <TT>java</TT> command line; for example:
<PRE>
    $ java -Dpj.np=4 . . .
</PRE>
For further information, see class
<A HREF="../PJProperties.html">edu.rit.pj.PJProperties</A>.
<P>
If neither <I>nn</I> nor <I>np</I> is specified, the Job Scheduler will run
the job with one process on one node.
<P>
If <I>nn</I> or <I>np</I> is specified but not both, the Job Scheduler will
run the job on <I>nn</I> (or <I>np</I>) nodes with one process on each node.
<P>
If <I>nn</I> and <I>np</I> are both specified and <I>nn</I> &gt;= <I>np</I>,
the Job Scheduler will run the job on <I>np</I> nodes with one process on
each node.
<P>
If <I>nn</I> and <I>np</I> are both specified and <I>nn</I> &lt; <I>np</I>,
the Job Scheduler will run the job on <I>nn</I> nodes with with more than one
process on some or all of the nodes, apportioning the <I>np</I> processes as
equally as possible among the <I>nn</I> nodes. Note that in this case,
different nodes may be assigned different numbers of processes.
<P>
On each node, the Job Scheduler will assign <I>nt</I> CPUs to each process.
If <I>nt</I> is not specified, the default is to use all the CPUs in the
node, apportioning the CPUs as equally as possible among the processes on the
node. Note that in this case, different processes may be assigned different
numbers of CPUs.

<P>
The Job Scheduler Daemon has a web interface
that lets you examine the cluster status
as well as the detailed status of each job in the queue.
Just point your web browser at this URL:
<PRE>
    http://&lt;hostname&gt;:8080/
</PRE>
where <TT>&lt;hostname&gt;</TT> is replaced by
the host name of the frontend node.
The default port for the cluster status web interface is port 8080.
The Job Scheduler Daemon can be configured to use a different port.
For further information,
see class <A HREF="Configuration.html">Configuration</A>.

<P>
<HR>
<A NAME="configuration"><H2>PJ Cluster Configuration</H2></A>

<P>
Here are three examples showing how the PJ cluster middleware is configured
to run on the RIT Computer Science Department's parallel computers.
For further information about configuring the Job Scheduler Daemon,
see class <A HREF="Configuration.html">Configuration</A>.

<P>
<B>Paranoia Cluster</B>

<P>
The Paranoia cluster consists of a frontend node,
hostname <TT>paranoia.cs.rit.edu</TT>,
and 32 backend nodes,
hostnames <TT>thug01</TT> through <TT>thug32</TT>.
The frontend node is a Sun Microsystems
UltraSPARC-II CPU with a 296 MHz clock and 192 MB of main memory.
Each backend  node is a Sun Microsystems
UltraSPARC-IIi CPU with a 440 MHz clock and 256 MB of main memory.
The cluster machines are interconnected
via a dedicated 100 Mbps switched Ethernet.
The frontend node also has a connection to the campus network.

<P>
Here is the configuration file for the Job Scheduler Daemon.
It is stored in the file <TT>"/var/tmp/parajava/scheduler.conf"</TT>
on the <TT>paranoia.cs.rit.edu</TT> machine.

<P>
<TABLE BORDER=1 CELLPADDING=10 CELLSPACING=0>
<TR>
<TD ALIGN="left" VALIGN="top">
<FONT SIZE="-1">
<PRE># Parallel Java Job Scheduler configuration file
# Frontend node: paranoia
# Backend nodes: thug01-thug32

cluster RIT CS Paranoia 32-Node Cluster
logfile /var/tmp/parajava/scheduler.log
webhost paranoia.cs.rit.edu
webport 8080
schedulerhost localhost
schedulerport 20617
frontendhost paranoia.cs.rit.edu
backend thug01 1 thug01 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug02 1 thug02 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug03 1 thug03 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug04 1 thug04 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug05 1 thug05 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug06 1 thug06 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug07 1 thug07 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug08 1 thug08 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug09 1 thug09 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug10 1 thug10 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug11 1 thug11 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug12 1 thug12 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug13 1 thug13 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug14 1 thug14 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug15 1 thug15 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug16 1 thug16 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug17 1 thug17 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug18 1 thug18 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug19 1 thug19 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug20 1 thug20 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug21 1 thug21 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug22 1 thug22 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug23 1 thug23 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug24 1 thug24 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug25 1 thug25 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug26 1 thug26 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug27 1 thug27 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug28 1 thug28 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug29 1 thug29 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug30 1 thug30 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug31 1 thug31 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server
backend thug32 1 thug32 /usr/jdk/jdk1.5.0_17/bin/java /var/tmp/parajava/pj.jar -server</PRE>
</FONT>
</TD>
</TR>
</TABLE>

<P>
By saying <TT>webhost paranoia.cs.rit.edu</TT>,
a user can view
the Job Scheduler Daemon's job status web interface
from any machine in the Internet.
However, by saying <TT>schedulerhost localhost</TT>,
a user must log into the <TT>paranoia.cs.rit.edu</TT> machine
to run PJ jobs.
(Since the Job Scheduler process is listening to <TT>localhost</TT>,
the job frontend process must be running on the same host
as the Job Scheduler process
in order for the job frontend process
to communicate with the Job Scheduler process.)

<P>
Although the backend nodes are not "server-class" machines,
we want to run the Hotspot Server JVM on the backend nodes anyway.
Thus, each <TT>backend</TT> entry
includes the <TT>-server</TT> JVM flag
to force the Hotspot Server JVM to run.

<P>
Here are the commands to run the Job Scheduler Daemon
on the <TT>paranoia.cs.rit.edu</TT> machine.
<PRE>
    cd /var/tmp/parajava/
    java -classpath pj.jar edu.rit.pj.cluster.JobScheduler scheduler.conf
</PRE>

<P>
<B>Parasite Machine</B>

<P>
The Parasite machine is not actually a cluster parallel computer,
rather it is a single SMP parallel computer.
The PJ cluster middleware is used
to run a job queue for the Parasite machine,
ensuring that only one job runs at a time on the Parasite machine.

<P>
The Parasite "cluster" consists of a frontend node,
hostname <TT>paragon.cs.rit.edu</TT>,
and one backend node,
hostname <TT>parasite.cs.rit.edu</TT>.
The backend node is a Sun Microsystems machine
with four Sun UltraSPARC-IV dual-core CPUs (eight CPUs total),
a 1.35 GHz clock speed, and 16 GB of main memory.

<P>
Here is the configuration file for the Job Scheduler Daemon.
It is stored in the file <TT>"/var/tmp/parajava/scheduler.conf"</TT>
on the <TT>paragon.cs.rit.edu</TT> machine.

<P>
<TABLE BORDER=1 CELLPADDING=10 CELLSPACING=0>
<TR>
<TD ALIGN="left" VALIGN="top">
<FONT SIZE="-1">
<PRE># Parallel Java Job Scheduler configuration file
# Frontend node: paragon
# Backend node: parasite

cluster RIT CS Parasite 8-Core SMP
logfile /var/tmp/parajava/scheduler.log
webhost paragon.cs.rit.edu
webport 8080
schedulerhost localhost
schedulerport 20617
frontendhost paragon.cs.rit.edu
backend parasite 8 parasite.cs.rit.edu /usr/local/versions/jdk-1.5.0_15/bin/java /var/tmp/parajava/pj.jar</PRE>
</FONT>
</TD>
</TR>
</TABLE>

<P>
Here are the commands to run the Job Scheduler Daemon
on the <TT>paragon.cs.rit.edu</TT> machine.
<PRE>
    cd /var/tmp/parajava/
    java -classpath pj.jar edu.rit.pj.cluster.JobScheduler scheduler.conf
</PRE>

<P>
<B>Tardis Hybrid SMP Cluster</B>

<P>
The Tardis cluster consists of a frontend node,
hostname <TT>tardis.cs.rit.edu</TT>,
and 10 backend nodes,
hostnames <TT>dr00</TT> through <TT>dr09</TT>.
The frontend node has a Sun Microsystems
UltraSPARC-IIe CPU chip with a 650 MHz clock and 512 MB of main memory.
Each backend node has two AMD
Opteron 2218 dual-core CPU chips
with a 2.6 GHz clock and 8 GB of main memory.
The cluster machines are interconnected
via a dedicated 1 Gbps switched Ethernet.
The frontend node also has a connection to the campus network.

<P>
Here is the configuration file for the Job Scheduler Daemon.
It is stored in the file <TT>"/var/tmp/parajava/scheduler.conf"</TT>
on the <TT>tardis.cs.rit.edu</TT> machine.

<P>
<TABLE BORDER=1 CELLPADDING=10 CELLSPACING=0>
<TR>
<TD ALIGN="left" VALIGN="top">
<FONT SIZE="-1">
<PRE># Parallel Java Job Scheduler configuration file
# Frontend node: tardis.cs.rit.edu
# Backend nodes: dr00-dr09

cluster RIT CS Tardis Hybrid SMP Cluster
logfile /var/tmp/parajava/scheduler.log
webhost tardis.cs.rit.edu
webport 8080
schedulerhost localhost
schedulerport 20617
frontendhost 10.10.221.1
backend dr00 4 10.10.221.10 /usr/local/versions/jdk-1.5.0_15/bin/java /var/tmp/parajava/pj.jar
backend dr01 4 10.10.221.11 /usr/local/versions/jdk-1.5.0_15/bin/java /var/tmp/parajava/pj.jar
backend dr02 4 10.10.221.12 /usr/local/versions/jdk-1.5.0_15/bin/java /var/tmp/parajava/pj.jar
backend dr03 4 10.10.221.13 /usr/local/versions/jdk-1.5.0_15/bin/java /var/tmp/parajava/pj.jar
backend dr04 4 10.10.221.14 /usr/local/versions/jdk-1.5.0_15/bin/java /var/tmp/parajava/pj.jar
backend dr05 4 10.10.221.15 /usr/local/versions/jdk-1.5.0_15/bin/java /var/tmp/parajava/pj.jar
backend dr06 4 10.10.221.16 /usr/local/versions/jdk-1.5.0_15/bin/java /var/tmp/parajava/pj.jar
backend dr07 4 10.10.221.17 /usr/local/versions/jdk-1.5.0_15/bin/java /var/tmp/parajava/pj.jar
backend dr08 4 10.10.221.18 /usr/local/versions/jdk-1.5.0_15/bin/java /var/tmp/parajava/pj.jar
backend dr09 4 10.10.221.19 /usr/local/versions/jdk-1.5.0_15/bin/java /var/tmp/parajava/pj.jar</PRE>
</FONT>
</TD>
</TR>
</TABLE>

<P>
By saying <TT>webhost tardis.cs.rit.edu</TT>,
a user can view
the Job Scheduler Daemon's job status web interface
from any machine in the Internet.
However, by saying <TT>schedulerhost localhost</TT>,
a user must log into the <TT>tardis.cs.rit.edu</TT> machine
to run PJ jobs.
(Since the Job Scheduler process is listening to <TT>localhost</TT>,
the job frontend process must be running on the same host
as the Job Scheduler process
in order for the job frontend process
to communicate with the Job Scheduler process.)

<P>
Here are the commands to run the Job Scheduler Daemon
on the <TT>tardis.cs.rit.edu</TT> machine.
<PRE>
    cd /var/tmp/parajava/
    java -classpath pj.jar edu.rit.pj.cluster.JobScheduler scheduler.conf
</PRE>

<P>
<B>Paradise and Paradox Machines</B>

<P>
The PJ Library is installed on two additional
RIT Computer Science Department SMP parallel computers,
hostnames <TT>paradise.cs.rit.edu</TT>
<TT>paradox.cs.rit.edu</TT>.
However, the Job Scheduler Daemon is not running on these machines.
Thus, a PJ program will run directly on these machines
without going through the job queue.

<P>
The <TT>paradise.cs.rit.edu</TT> machine is a Sun Microsystems machine
with four Sun UltraSPARC-IV dual-core CPUs (eight CPUs total),
a 1.35 GHz clock speed, and 16 GB of main memory.
The <TT>paradox.cs.rit.edu</TT> machine is a Sun Microsystems machine
with four Sun UltraSPARC-II CPUs,
a 450 MHz clock, and 4 GB of main memory.

<P>
<HR>
<A NAME="design"><H2>PJ Cluster Design</H2></A>

<P>
<CENTER>
<IMG SRC="doc-files/fig_a.png">
</CENTER>

<P>
A PJ message passing program running on a PJ cluster
is a distributed system comprising four kinds of processes:
<UL>
<LI>
Job Scheduler Daemon,
class <A HREF="JobScheduler.html">JobScheduler</A>.
<LI>
SSH Daemons.
<LI>
Job frontend process, class <A HREF="JobFrontend.html">JobFrontend</A>.
<LI>
Job backend processes, class <A HREF="JobBackend.html">JobBackend</A>.
</UL>

<P>
The Job Scheduler Daemon,
a process always running on the frontend node,
has a channel group
(class <A HREF="../../mp/ChannelGroup.html">ChannelGroup</A>)
that is listening for connections to a well-known port on localhost.
The default PJ port is 20617.

<P>
Each backend node has an always-running SSH Daemon process,
typically a system process.

<P>
The Job Scheduler Daemon is configured
with the following information,
provided in a configuration file
(see class <A HREF="Configuration.html">Configuration</A>):
<UL>
<LI>
File name for logging Job Scheduler actions.
<LI>
Host and port for Job Scheduler's web interface for displaying status.
<LI>
Host to which job frontend processes will listen for connections
from job backend processes.
<LI>
Port to which Job Scheduler is listening for connections
from job frontend processes (default 20617).
<LI>
For each backend node:
<UL>
<LI>
Backend node's name.
<LI>
Number of CPUs.
<LI>
Host name for SSH remote login to the backend node.
<LI>
Full pathname for executing the Java Virtual Machine on the backend node.
<LI>
Java class path for the PJ Library on the backend node.
<LI>
JVM command line flags (zero or more).
<LI>
Shell command string (default: <TT>"bash -l -c"</TT>).
</UL>
</UL>

<P>
The user starts things off
by running a PJ message passing program
that calls the <TT>Comm.init()</TT> method
(see class <A HREF="../Comm.html">Comm</A>).
The <TT>Comm.init()</TT> method
creates an instance of class <A HREF="JobFrontend.html">JobFrontend</A>,
the job frontend object takes over execution,
and the user's process becomes the job frontend process.

<P>
The job frontend process begins
by setting up three channel groups;
each channel group is listening for connections
to a separate host and port:
<OL TYPE=1>
<LI>
The "middleware channel group"
is for the PJ middleware itself.
The job frontend process uses the middleware channel group
to communicate with the Job Scheduler Daemon
and the job backend processes.
<BR>&nbsp;
<LI>
The "world channel group"
is used to implement the "world communicator,"
which the parallel program uses to do message passing.
All the job backend processes, 
but not the job frontend process,
are part of the world communicator.
<BR>&nbsp;
<LI>
The "frontend channel group"
is used to implement the "frontend communicator,"
which the parallel program can also use to do message passing.
All the job backend processes
<I>and</I> the job frontend process
are part of the frontend communicator.
(Actually, the frontend communicator is optional.
A flag on the <TT>Comm.init()</TT> method
says whether to create the frontend communicator.)
</OL>

<P>
Next, the job frontend process
opens a connection to the Job Scheduler Daemon.
(If the Job Scheduler Daemon is not listening to the default PJ port,
the user must specify the <TT>"-Dpj.port="</TT> flag
on the Java command line when running the PJ program.)
The job frontend process and the Job Scheduler Daemon
exchange the following messages during the course of the job:
<PRE>
Job                                   Job
frontend                              Scheduler
process                               Daemon
|                                     |
|                                     |  Nn = Number of nodes
|  Request job (username,Nn,Np,Nt)    |  Np = Number of processes
|------------------------------------>|  Nt = Threads per process
|                                     |
|  Cancel job (errmsg)                |  If insufficient resources
|<------------------------------------|
|                                     |
|  Assign job number (jobnum)         |  If sufficient resources
|<------------------------------------|
|                                     |
|  Assign backend (name, host, port)  |  Repeat as each backend
|<------------------------------------|  node is assigned; job
|                                     |  commences once all are
|                                     |  assigned
|                                     |
|  Renew lease ()                     |  Periodically while job
|------------------------------------>|  is in progress
|                                     |
|  Renew lease ()                     |  Periodically while job
|<------------------------------------|  is in progress
|                                     |
|  Job finished ()                    |  When job finishes
|------------------------------------>|
|                                     |
|  Cancel job (errmsg)                |  If user cancels job
|------------------------------------>|
|                                     |
|  Cancel job (errmsg)                |  If error in Job Scheduler,
|<------------------------------------|  or admin cancels job
|                                     |
|  Backend failed (name)              |  If frontend detects
|------------------------------------>|  backend has failed
|                                     |
</PRE>
The Job Scheduler Daemon renews a lease on the job frontend process,
and vice versa,
by sending a "renew lease" message
every 60 seconds.
If one side fails to receive a "renew lease" message
for 150 seconds,
the lease expires.
If the lease expires,
that process assumes the process at the other end has failed,
and the process takes the appropriate actions to abort the job.

<P>
The Job Scheduler Daemon sends messages to the job frontend process
to assign a job number for the job
and to assign backend processes, <I>np</I> of them, to the job.
When a backend process is assigned to run on a backend node,
the job frontend process performs an SSH command
to log into the user's account on the backend node;
the requisite host name is given
in the "assign backend" message.
The job frontend process tells SSH
to execute the following command string on the backend node:
<PRE>
bash -l -c "cd '&lt;dir&gt;'; nohup &lt;jvm&gt; -classpath '&lt;classpath&gt;' &lt;jvmflags&gt; \
edu.rit.pj.cluster.JobBackend &lt;args&gt; &gt;/dev/null 2&gt;/dev/null &amp;"
</PRE>
After verifying the user using public key authentication,
SSH executes a shell (bash) using the command above.
The default shell command is <TT>"bash&nbsp;-l&nbsp;-c"</TT>,
but this can be changed in the configuration file.
The <TT>-l</TT> flag tells the shell to behave as a login shell
and execute the commands in the user's login profile, if any.
The <TT>-c</TT> flag tells the shell
to execute the command between the double quotation marks.
Executing that command,
the shell changes the working directory
to the job frontend process's working directory,
<TT>&lt;dir&gt;</TT>.
Then the shell executes a Java Virtual Machine
using the <TT>&lt;jvm&gt;</TT> command
from the configuration file.
This JVM becomes the job backend process.
The Java class path is <TT>&lt;classpath&gt;</TT>
from the configuration file.
Any JVM flags from the configuration file (<TT>&lt;jvmflags&gt;</TT>),
as well as any flags the user specified on the command line
with the <TT>-Dpj.jvmflags</TT> property,
are included.
The main program class is
<A HREF="JobBackend.html">JobBackend</A>,
followed by class JobBackend's command line arguments.
The job backend process's standard output and standard error streams
are redirected to <TT>/dev/null</TT>;
the job backend process will intercept these streams
and send them to the job frontend process.
The job backend process is set to ignore hangup signals (<TT>nohup</TT>).
The shell and the SSH session terminate
without waiting for the job backend process to terminate
(because of the trailing <TT>&amp;</TT>).
This leaves the job backend process running in the background
on the backend node.

<P>
Note that the SSH command string uses Unix shell syntax.
If this syntax is not appropriate for the job backend nodes,
the code in class <A HREF="JobFrontend.html">JobFrontend</A>
must be changed to emit the proper command string.

<P>
The job backend process
sets up its middleware channel group,
world communicator, and frontend communicator
using the information supplied in the command line arguments,
which were specified by the job frontend process
when it performed the SSH command.
The job frontend process and the job backend process
exchange the following messages during the course of the job
using the middleware channel group:
<PRE>
Job                                   Job
frontend                              backend
process                               process
|                                     |
|  Backend ready (rank, mcg, wcg,     |  mcg = middleware channel group
|     fcg)                            |  wcg = world channel group
|<------------------------------------|  fcg = frontend channel group
|                                     |
|  Commence job (mcg[], wcg[], fcg[], |  Sent to each backend when all
|     properties, mainclass, args)    |  backends are ready
|----------------------------------->>|
|                                     |
|  Request resource (name)            |  To load a class from the user's
|<------------------------------------|  program
|                                     |
|  Report resource (name, bytecodes)  |
|------------------------------------>|
|                                     |
|  Write file (fd, buf, off, len)     |  Buffer goes to job frontend which
|<------------------------------------|  writes it to file or stdout/stderr
|                                     |
|  Renew lease ()                     |  Periodically while job
|------------------------------------>|  is in progress
|                                     |
|  Renew lease ()                     |  Periodically while job
|<------------------------------------|  is in progress
|                                     |
|  Backend finished ()                |  When main program finishes
|<------------------------------------|
|                                     |
|  Job finished ()                    |  Sent to each backend when all
|----------------------------------->>|  backend main programs have
|                                     |  finished
|  Cancel job (errmsg)                |
|------------------------------------>|  If job aborts
|                                     |
|  Cancel job (errmsg)                |  If error in job backend
|<------------------------------------|
|                                     |
</PRE>

<P>
The job backend process begins by sending a "backend ready" message
to the job frontend process with the following information:
<UL>
<LI>
Job backend process's rank.
<LI>
Host and port for the job backend process's middleware channel group.
<LI>
Host and port for the job backend process's world communicator.
<LI>
Host and port for the job backend process's frontend communicator
(if the frontend communicator exists).
</UL>
Once all the job backend processes have reported ready,
the job frontend process sends a "commence job" message
to each job backend process with this information:
<UL>
<LI>
Array of hosts and ports for the middleware channel group.
<LI>
Array of hosts and ports for the world communicator.
<LI>
Array of hosts and ports for the frontend communicator
(if the frontend communicator exists).
<LI>
Names and values of all defined Java system properties.
<LI>
Fully qualified class name of the Java main program class to execute.
<LI>
Java command line arguments (array of 0 or more strings).
</UL>
Once the job commences running,
the job frontend process and job backend processes
exchange further messages as shown above.

<P>
In summary,
the messages sent from and to each process are:

<P>
<TABLE BORDER=1 CELLPADDING=4 CELLSPACING=0>
<TR BGCOLOR="#CCCCCC">
<TD ALIGN="left" VALIGN="bottom" ROWSPAN=2><I>Sent From</I></TD>
<TD ALIGN="left" VALIGN="top" COLSPAN=3><I>Sent To</I></TD>
</TR>
<TR BGCOLOR="#CCCCCC">
<TD ALIGN="left" VALIGN="top"><I>Job Scheduler</I></TD>
<TD ALIGN="left" VALIGN="top"><I>Job Frontend</I></TD>
<TD ALIGN="left" VALIGN="top"><I>Job Backend</I></TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="top" BGCOLOR="#CCCCCC"><I>Job Scheduler</I></TD>
<TD ALIGN="left" VALIGN="top"><!-- Job Scheduler to Job Scheduler -->
&nbsp;
</TD>
<TD ALIGN="left" VALIGN="top"><!-- Job Scheduler to Job Frontend -->
Assign backend
<BR>Assign job number
<BR>Cancel job
<BR>Renew lease
</TD>
<TD ALIGN="left" VALIGN="top"><!-- Job Scheduler to Job Backend -->
&nbsp;
</TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="top" BGCOLOR="#CCCCCC"><I>Job Frontend</I></TD>
<TD ALIGN="left" VALIGN="top"><!-- Job Frontend to Job Scheduler -->
Backend failed
<BR>Cancel job
<BR>Job finished
<BR>Renew lease
<BR>Request job
</TD>
<TD ALIGN="left" VALIGN="top"><!-- Job Frontend to Job Frontend -->
&nbsp;
</TD>
<TD ALIGN="left" VALIGN="top"><!-- Job Frontend to Job Backend -->
Cancel job
<BR>Commence job
<BR>Job finished
<BR>Renew lease
<BR>Report resource
</TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="top" BGCOLOR="#CCCCCC"><I>Job Backend</I></TD>
<TD ALIGN="left" VALIGN="top"><!-- Job Backend to Job Scheduler -->
&nbsp;
</TD>
<TD ALIGN="left" VALIGN="top"><!-- Job Backend to Job Frontend -->
Backend finished
<BR>Backend ready
<BR>Cancel job
<BR>Renew lease
<BR>Request resource
<BR>Write file
</TD>
<TD ALIGN="left" VALIGN="top"><!-- Job Backend to Job Backend -->
&nbsp;
</TD>
</TR>
</TABLE>

<P>
<HR>
<A NAME="debug"><H2>PJ Job Scheduler Debugging</H2></A>

<P>
As an aid to debugging,
the Job Scheduler Daemon's web interface
also lets you examine the Daemon's internal state.
Point your web browser at this URL:
<PRE>
    http://&lt;hostname&gt;:8080/debug
</PRE>
where <TT>&lt;hostname&gt;</TT> is replaced by
the host name of the frontend node.
In the current release,
this displays a stack dump for each thread.

</BODY>
</HTML>