xdev
Class Device

java.lang.Object
  extended by xdev.Device
Direct Known Subclasses:
MXDevice, NIODevice

public abstract class Device
extends java.lang.Object

xdev is an abstract class representing an abstract device. The implementations of this abstract class would provide various different communication protocols that can be used by MPJ at the higher-levels. The aim is to allow, flexible swapping of communication protocols, and also to keep the API simple and small, thus minimizing the overall development time of the device.

Instead of using integer ranks as arguments to send/recv, xdev uses xdev.ProcessID as arguments to send/recv. This essentially means that xdev doesnot deal with the higher level abstractions of MPI, like groups, communicators, and contexts -- it only focuses on providing communication methods, on top of which these higher abstractions of MPI can be implemented.


Field Summary
static int ANY_SOURCE
          A wild-card that can be used with the recv methods.
static ProcessID ANY_SRC
          A wild-card for ANY_SOURCE at xdev level.
static int ANY_TAG
          A wild-card that can be used with the recv method to receive the message from any source within the communicator.
 java.lang.String deviceName
           
 
Constructor Summary
Device()
           
 
Method Summary
abstract  void finish()
          This method shutdowns the device.
abstract  int getRecvOverhead()
           
abstract  int getSendOverhead()
           
abstract  ProcessID id()
          This method returns the id of the current process
abstract  ProcessID[] init(java.lang.String[] args)
          Initialize the xdev device.
abstract  Status iprobe(ProcessID srcID, int tag, int context)
          This method is the non-blocking probe.
abstract  Request irecv(Buffer buf, ProcessID srcID, int tag, int context, Status status)
          This method is the non-blocking recv.
abstract  Request isend(Buffer buf, ProcessID destID, int tag, int context)
          This method is the non-blocking send using standard-mode.
abstract  Request issend(Buffer buf, ProcessID destID, int tag, int context)
          This method is the non-blocking send using synchronous-mode.
static Device newInstance(java.lang.String dev)
          This method returns an instance of xdev specified by the argument.
abstract  Request peek()
           
abstract  Status probe(ProcessID srcID, int tag, int context)
          This method is the blocking probe.
abstract  Status recv(Buffer buf, ProcessID srcID, int tag, int context)
          This method is the blocking recv.
abstract  void send(Buffer buf, ProcessID destID, int tag, int context)
          This method is the blocking send using standard-mode.
abstract  void ssend(Buffer buf, ProcessID destID, int tag, int context)
          This method is the blocking send using synchronous-mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY_SOURCE

public static final int ANY_SOURCE
A wild-card that can be used with the recv methods.

See Also:
Constant Field Values

deviceName

public java.lang.String deviceName

ANY_SRC

public static ProcessID ANY_SRC
A wild-card for ANY_SOURCE at xdev level. It is a xdev.ProcessID object with UUID set to random UUID , and rank set to ANY_SRC (-2)


ANY_TAG

public static final int ANY_TAG
A wild-card that can be used with the recv method to receive the message from any source within the communicator.

See Also:
Constant Field Values
Constructor Detail

Device

public Device()
Method Detail

newInstance

public static Device newInstance(java.lang.String dev)
                          throws XDevException
This method returns an instance of xdev specified by the argument. In future, this method may search the classpath to load the libraries for the appropriate device to use and returns an instance of that device.

Parameters:
dev - The name of the xdev Device. The one for Java New I/O is named 'niodev'. The name of the device is provided to xdev by MPJ runtime, which in turn gets it from 'mpjrun' script.
Returns:
Device An instance of an implementation of the device.
Throws:
XDevException - If there is no corresponding device to the string argument provided to this method

init

public abstract ProcessID[] init(java.lang.String[] args)
                          throws XDevException
Initialize the xdev device. Specific implementations perform initialization of the device in this method.

Parameters:
args - Argument array.
Returns:
xdev.ProcessID[] An array with length equal to total number of processes, and each ProcessID element representing a process.
Throws:
XDevException - If there is an error initializing the device

getSendOverhead

public abstract int getSendOverhead()

getRecvOverhead

public abstract int getRecvOverhead()

id

public abstract ProcessID id()
This method returns the id of the current process

Returns:
xdev.ProcessID ProcessID of the current process.

finish

public abstract void finish()
                     throws XDevException
This method shutdowns the device.

Throws:
XDevException

isend

public abstract Request isend(Buffer buf,
                              ProcessID destID,
                              int tag,
                              int context)
                       throws XDevException
This method is the non-blocking send using standard-mode.

Parameters:
buf - mpjbuf.Buffer object containing the data
destID - ProcessID of the destination process
tag - An integer representing the tag (id) of the message
context - An integer specifying context.
Returns:
mpjdev.Request Request object that can be used to check the status and/or progress of the communication.
Throws:
XDevException - If there is an exception. The specific exception depends on the device.

send

public abstract void send(Buffer buf,
                          ProcessID destID,
                          int tag,
                          int context)
                   throws XDevException
This method is the blocking send using standard-mode.

Parameters:
buf - mpjbuf.Buffer object containing the data
destID - ProcessID of the destination process
tag - An integer representing the tag (id) of the message
context - An integer specifying context.
Throws:
XDevException - If there is an exception. The specific exception depends on the device.

issend

public abstract Request issend(Buffer buf,
                               ProcessID destID,
                               int tag,
                               int context)
                        throws XDevException
This method is the non-blocking send using synchronous-mode.

Parameters:
buf - mpjbuf.Buffer object containing the data
destID - ProcessID of the destination process
tag - An integer representing the tag (id) of the message
context - An integer specifying context.
Returns:
mpjdev.Request Request object that can be used to check the status and/or progress of the communication.
Throws:
XDevException - If there is an exception. The specific exception depends on the device.

ssend

public abstract void ssend(Buffer buf,
                           ProcessID destID,
                           int tag,
                           int context)
                    throws XDevException
This method is the blocking send using synchronous-mode.

Parameters:
buf - mpjbuf.Buffer object containing the data
destID - ProcessID of the destination process
tag - An integer representing the tag (id) of the message
context - An integer specifying context.
Throws:
XDevException - If there is an exception. The specific exception depends on the device.

recv

public abstract Status recv(Buffer buf,
                            ProcessID srcID,
                            int tag,
                            int context)
                     throws XDevException
This method is the blocking recv.

Parameters:
buf - mpjbuf.Buffer object containing the data
srcID - ProcessID of the source process
tag - An integer representing the tag (id) of the message
context - An integer specifying context.
Returns:
mpjdev.Status Status object that can be used to check the status of the communication.
Throws:
XDevException - If there is an exception. The specific exception depends on the device.

irecv

public abstract Request irecv(Buffer buf,
                              ProcessID srcID,
                              int tag,
                              int context,
                              Status status)
                       throws XDevException
This method is the non-blocking recv.

Parameters:
buf - mpjbuf.Buffer object containing the data
srcID - ProcessID of the source process
tag - An integer representing the tag (id) of the message
context - An integer specifying context.
status - A mpjdev.Status object initialized at mpjdev/MPJ level.
Returns:
mpjdev.Request Request object that can be used to check the status of the communication.
Throws:
XDevException - If there is an exception. The specific exception depends on the device.

probe

public abstract Status probe(ProcessID srcID,
                             int tag,
                             int context)
                      throws XDevException
This method is the blocking probe.

Parameters:
srcID - ProcessID of the source process
tag - An integer representing the tag (id) of the message
context - An integer specifying context.
Returns:
mpjdev.Status Status object that can be used to check the status of the communication.
Throws:
XDevException - If there is an exception. The specific exception depends on the device.

iprobe

public abstract Status iprobe(ProcessID srcID,
                              int tag,
                              int context)
                       throws XDevException
This method is the non-blocking probe.

Parameters:
srcID - ProcessID of the source process
tag - An integer representing the tag (id) of the message
context - An integer specifying context.
Returns:
mpjdev.Status Status object if the communication has completed or null otherwise.
Throws:
XDevException - If there is an exception. The specific exception depends on the device.

peek

public abstract Request peek()
                      throws XDevException
Throws:
XDevException