mpi
Class Comm

java.lang.Object
  |
  +--mpi.Comm

public class Comm
extends java.lang.Object

Communicator presenting a subset of the MPI API. The MPI class contains the static COMM_WORLD communicator.

Author:
Max Goldman
, Da Guo

Constructor Summary
Comm()
           
 
Method Summary
 double[] bcast(double[] buffer, int count, int root)
          Broadcasts a message from the process with rank root to all other processes.
protected  void finalize()
          Destroys the Java socket network.
 double[] gather(double[] sendbuf, int sendcnt, int recvcnt, int root)
          Gathers values from all processes.
 void initialize(int rank, int size, java.lang.String[] hosts)
          Builds the Java socket network used by MPI.
 int rank()
          Rank of the calling process in the communicator.
 double[] recv(int count, int source, int tag)
          Performs a basic receive.
 double[] reduce(double[] sendbuf, int count, Operation op, int root)
          Reduces values on all processes to a single value at rank root.
 double[] scan(double[] sendbuf, int count, Operation op)
          Computes the scan (partial reduction) of data on all processes.
 double[] scatter(double[] sendbuf, int sendcnt, int recvcnt, int root)
          Sends data from process with rank root to all other processes.
 void send(double[] buffer, int count, int dest, int tag)
          Performs a basic send.
 int size()
          Size of the communicator group.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Comm

public Comm()
Method Detail

initialize

public void initialize(int rank,
                       int size,
                       java.lang.String[] hosts)
Builds the Java socket network used by MPI. MATALB*P integration method.


finalize

protected void finalize()
                 throws java.lang.Throwable
Destroys the Java socket network. Called by the garbage collector.

Overrides:
finalize in class java.lang.Object
java.lang.Throwable

rank

public int rank()
Rank of the calling process in the communicator. MPI API method.


size

public int size()
Size of the communicator group. MPI API method.


send

public void send(double[] buffer,
                 int count,
                 int dest,
                 int tag)
Performs a basic send. MPI API method.

Parameters:
buffer - send buffer
count - number of elements in send buffer
dest - rank of destination
tag - message tag

recv

public double[] recv(int count,
                     int source,
                     int tag)
Performs a basic receive. MPI API method.

Parameters:
count - number of elements in receive buffer
tag - message tag
Returns:
receive buffer

bcast

public double[] bcast(double[] buffer,
                      int count,
                      int root)
Broadcasts a message from the process with rank root to all other processes. Uses a binary tree algorithm. MPI API method.

Parameters:
buffer - send buffer
count - number of elements in buffer
root - rank of broadcast root
Returns:
receive buffer

reduce

public double[] reduce(double[] sendbuf,
                       int count,
                       Operation op,
                       int root)
Reduces values on all processes to a single value at rank root. Uses a binary tree algorithm. MPI API method.

Parameters:
sendbuf - send buffer
count - number of elements in send buffer
op - reduction operation
root - rank of reduction root
Returns:
receive buffer

scatter

public double[] scatter(double[] sendbuf,
                        int sendcnt,
                        int recvcnt,
                        int root)
Sends data from process with rank root to all other processes. Uses a naive algorithm. MPI API method.

Parameters:
sendbuf - send buffer
sendcnt - number of elements to send to each process
recvcnt - number elements in receive buffer
root - rank of scatter root
Returns:
receive buffer

gather

public double[] gather(double[] sendbuf,
                       int sendcnt,
                       int recvcnt,
                       int root)
Gathers values from all processes. Uses a naive algorithm. MPI API method.

Parameters:
sendbuf - send buffer
sendcnt - number of elements in send buffer
recvcnt - number of elements for any single receive
root - rank of gather root
Returns:
receive buffer

scan

public double[] scan(double[] sendbuf,
                     int count,
                     Operation op)
Computes the scan (partial reduction) of data on all processes. Uses a parallel prefix algorithm. MPI API method.

Parameters:
sendbuf - send buffer
count - number of elements in send buffer
op - scan operation
Returns:
receive buffer


18.337/6.338/SMA.5505