130 likes | 249 Vues
This text provides a comprehensive overview of cluster computing with a focus on shared memory processor architecture and Java middleware for parallel programming. It covers the essentials of communicators, message passing, and the types of communication involved in cluster environments. The discussion includes point-to-point and collective communication strategies, highlighting non-blocking send and receive operations using the PJ World framework. A sample Java program illustrates the implementation of clustering techniques and prime number computation, emphasizing the efficiency of parallel processing.
E N D
Computer Science 320 Introduction to Cluster Computing
SMP (shared memory processor) architecture Cluster architecture
A Cluster Program in Parallel Java static Comm world; static int size; static int rank; static long x; static long t1, t2, t3; public static void main(String[] args) throws Exception{ t1 = System.currentTimeMillis(); Comm.init(args); world = Comm.world(); size = world.size(); rank = world.rank(); x = Long.parseLon(args[rank]); isPrime(x); // Output running time of rank here. } $ java –Dpj.np=4 Program1Clu 1000000000000037 1000000000000091 / 1000000000000159 1000000000000187
Communicators and Messages • Cluster processes communicate by sending messages over the backend network • A communicator is an abstraction of a medium for sending and receiving messages
A PJ World Comm.init(); Comm world = Comm.world(); int size = world.size(); int rank = world.rank(); $ java –Dpj.np=4 Program1Clu 1000000000000037 1000000000000091 / 1000000000000159 1000000000000187
Types of Communication • Point-to-point: transfer data from one process to another process • Collective: transfer data to all processes
Sending and Receiving world.send(toRank, buffer) CommStatusstatus = world.receive(fromRank, buffer) A buffer is an abstraction of a data source It can be a number, an array, a portion of an array, a matrix, a portion of a matrix, or other items
Sending and Receiving Master-worker pattern uses send and receive
Wildcard Receive CommStatus status = world.receive(null, buffer) Don’t need to know the rank of the processor; just receive from anybody
Nonblocking Send CommRequest request = new CommRequest(); world.send(toRank, buffer, request); // Other processing goes here request.waitForFinish(); Starts another thread to send the data, returns to do other work, then can block until send completes
Nonblocking Receive CommRequest request = new CommRequest(); world.receive(fromRank, buffer, request); // Other processing goes here CommStatus status = request.waitForFinish(); Starts another thread to receive the data, returns to do other work, then can block until receive completes
Send-Receive CommStatus status = world.receive(toRank, srcBuffer, fromRank, dstBuffer); Performs a send and a receive; nonblocking version is similar to the others