Package edu.rit.pj2

Package edu.rit.pj2 contains Parallel Java 2 (PJ2), an API and middleware for parallel programming in 100% Java on multicore parallel computers, cluster parallel computers, supercomputing grids, and cloud computing services.

See: Description

Package edu.rit.pj2 Description

Package edu.rit.pj2 contains Parallel Java 2 (PJ2), an API and middleware for parallel programming in 100% Java on multicore parallel computers, cluster parallel computers, supercomputing grids, and cloud computing services.

PJ2 is designed for writing two kinds of parallel programs: tightly coupled single-node and loosely coupled multi-node.

Tightly Coupled Single-Node Parallel Programs

A tightly coupled single-node parallel program is intended to run on one multicore node. The program consists of multiple threads that run in parallel on separate cores. The threads communicate and coordinate by reading and writing variables in shared memory.

This kind of PJ2 program is expressed as a subclass of class Task. The program is executed by running the pj2 launcher program as follows:

$ java pj2 MainTask arg ...

The above command creates an instance of class MainTask, a subclass of class Task. Replace MainTask with the fully-qualified class name of the desired task subclass. The launcher creates an instance of the task subclass, then calls that task's main() method, passing in an array of the command line argument strings (zero or more). The task executes in the launcher's process. The main() method carries out the computation. When the main() method returns, the launcher terminates.

The computation can contain sequential statements executed by a single thread, interspersed with parallel statements executed by multiple threads. Running on a multicore computer, the Java Virtual Machine (JVM) schedules each thread on a separate core, thus executing the program in parallel.

Loosely Coupled Multi-Node Parallel Programs

A loosely coupled multi-node parallel program is intended to run on multiple nodes. The nodes may be located in a cluster parallel computer, in a grid, or in a cloud. The program consists of multiple Tasks that run in parallel on separate nodes. The tasks coordinate and communicate with each other by reading and writing Tuples in tuple space. The tasks are intended to be coarse-grained, meaning each task runs for minutes or hours, not milliseconds. The tasks are intended to communicate small to medium amounts of data via tuple space, not enormous quantities of data.

This kind of PJ2 program is expressed as a subclass of class Job. The program is executed by running the pj2 launcher program as follows:

$ java pj2 jar=file MainJob arg ...

The above command creates an instance of class MainJob, a subclass of class Job. Replace MainJob with the fully-qualified class name of the desired job subclass. The launcher creates an instance of the job subclass, then calls that job's main() method, passing in an array of the command line argument strings (zero or more). The main() method defines Rules that specify which Tasks are to be executed as part of the job. The launcher creates and executes those tasks, which carry out the job's computation. The tasks may execute in the launcher's process or on computational nodes that are part of a cluster, grid, or cloud. When all the tasks have finished executing, the launcher terminates.

Running on a cluster, grid, or cloud, the program executes each task on a separate node, thus executing the program in parallel. Each task receives input tuples that are taken out of tuple space, performs computations, and generates output tuples that are written into tuple space. Each task executes independently of other tasks. All inter-task coordination and communication goes through tuple space.

Copyright © 2013–2018 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.