Jumpi v1.2.0

org.jumpi.impl.connector.mpi11
Class MpiConnector

java.lang.Object
  |
  +--org.jumpi.impl.AbstractConnector
        |
        +--org.jumpi.impl.connector.mpi11.MpiConnector
All Implemented Interfaces:
Component, Configurable, Connector, Manageable, java.lang.Runnable, Task

public class MpiConnector
extends AbstractConnector

The MpiConnector allows to send and receive messages via mpiJava over a native MPI1.1 implementation. Currently a single Group, COMM_WORLD is established and intra-group, point to point communications are allowed. A client application must ensure that receive's are matched by send's in order to avoid blocking. A configurable but fixed sized receive buffer is used to receive messages. Truncation occurs if the buffer length is exceeded on receive.


Field Summary
static java.lang.String PROPERTY_MPI_RECV_STATUS
          The receive status is returned to client applications to allow the client to determine the length of the data received.
 
Fields inherited from class org.jumpi.impl.AbstractConnector
cancelledRecvs_, cancelledSends_, controller_, joinFailInterval_, joinTestInterval_, jumpi_, maxRecvBacklog_, maxSendBacklog_, name_, protocol_, recvQueue_, recvTransformer_, sendQueue_, sendTransformer_, started_, stopping_, taskId_, url_format_, url_prefix_
 
Constructor Summary
MpiConnector()
           
 
Method Summary
 void cancelRecv(Envelope env)
          Does nothing.
 void cancelSend(Envelope env)
          Does nothing.
protected  boolean checkJoinCondition()
          The shutdown join condition is true if there are no pending send or receive operations.
 void configure(java.lang.String name, Properties props)
          Configure the MpiConnector.
protected  void establishGroups()
          Establish the communication Groups from the MPI implementation.
 Destination getDestination(java.lang.String url, java.util.Hashtable clientProps)
          Get the Destination corresponding to the Url provided.
 void manage(Component root, Component parent, java.lang.String operation, java.util.Hashtable parameters)
          Perform a recursive management operation through the Jumpi component tree, using the parameters provided.
protected  boolean onRecv(Envelope env)
           Receive a message from a MPI Processor Destination.
protected  boolean onSend(Envelope env)
           Send a message to a MPI Processor Destination.
 void recv(Envelope env)
          Perform the recv synchronously.
 void send(Envelope env)
          Perform the send synchronously.
protected  void shutdownState()
          Clear the pending send and receive operations.
 
Methods inherited from class org.jumpi.impl.AbstractConnector
getName, getTaskId, isLongRunning, isSchedulable, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_MPI_RECV_STATUS

public static final java.lang.String PROPERTY_MPI_RECV_STATUS
The receive status is returned to client applications to allow the client to determine the length of the data received. Value: MPI_RECV_STATUS.

See Also:
Constant Field Values
Constructor Detail

MpiConnector

public MpiConnector()
Method Detail

configure

public void configure(java.lang.String name,
                      Properties props)
               throws java.lang.Exception
Configure the MpiConnector.

The following configuration attributes are defined in addition to those of the superclass:

Specified by:
configure in interface Configurable
Overrides:
configure in class AbstractConnector
Parameters:
name - the fully qualified instance name.
props - the read-only properties to configure the instance with.
Throws:
java.lang.Exception - when configuration is unsuccessful.

manage

public void manage(Component root,
                   Component parent,
                   java.lang.String operation,
                   java.util.Hashtable parameters)
            throws java.lang.Exception
Perform a recursive management operation through the Jumpi component tree, using the parameters provided.

Specified by:
manage in interface Manageable
Overrides:
manage in class AbstractConnector
Parameters:
root - the Jumpi instance at the root of the component tree.
parent - the immediate parent of the component.
operation - the operation.
parameters - the operation parameters.
Throws:
java.lang.Exception - if any failure to perform management occurs.

checkJoinCondition

protected boolean checkJoinCondition()
The shutdown join condition is true if there are no pending send or receive operations.

Specified by:
checkJoinCondition in class AbstractConnector
Returns:
true if there are no pending send or receive operations.

shutdownState

protected void shutdownState()
Clear the pending send and receive operations.

Specified by:
shutdownState in class AbstractConnector

establishGroups

protected void establishGroups()
                        throws java.lang.Exception
Establish the communication Groups from the MPI implementation. Currently only one Group is established - COMM_WORLD.

Throws:
java.lang.Exception - if any failure condition occurs.

getDestination

public Destination getDestination(java.lang.String url,
                                  java.util.Hashtable clientProps)
Get the Destination corresponding to the Url provided. The method is used to return the Destination corresponding to the MPI Connector to the client application. The client application can then use recv() to get established Groups from the MPI Connector.

Specified by:
getDestination in interface Connector
Overrides:
getDestination in class AbstractConnector
Parameters:
url - the Url of the MPI Connector.
clientProps - not used.
Returns:
a Destination if the Url corresponds to the MPI Connector Destination, otherwise null.
Throws:
java.lang.IllegalArgumentException - when url is null.
See Also:
recv(org.jumpi.spi.Envelope)

onSend

protected boolean onSend(Envelope env)
                  throws java.lang.Exception

Send a message to a MPI Processor Destination.

The message format required at the native MPI layer is a byte[]. If a send transformer is configured, then the transformer must transform the message Object into a byte[] and place this in the send buffer. The send buffer is pushed onto the envelope's context stack on top of the message itself. If no send transformer is configured, then the message must be a byte[].

Allows only a single send at a time, blocking if multiple sends are performed concurrently.

The default MPI send mode is used. This is typically blocking.

Specified by:
onSend in class AbstractConnector
Parameters:
env - the Envelope containing the Destination to send to and the message.
Returns:
true on success or false for a manged failure.
Throws:
java.lang.Exception - if a failure condition occurs.

send

public void send(Envelope env)
          throws java.lang.Exception
Perform the send synchronously.

Specified by:
send in interface Connector
Overrides:
send in class AbstractConnector
Parameters:
env - the Envelope which gives the Destination to send to and the message itself.
Throws:
java.lang.Exception - if any failure condition occurs during the send method.
java.lang.IllegalArgumentException - when env is null.
java.lang.IllegalStateException - when not started or stopping.
See Also:
Controller.callbackSend(org.jumpi.spi.Envelope, boolean, java.lang.String)

cancelSend

public void cancelSend(Envelope env)
Does nothing.

Specified by:
cancelSend in interface Connector
Overrides:
cancelSend in class AbstractConnector
Parameters:
env - the send operation's Envelope to cancel.

onRecv

protected boolean onRecv(Envelope env)
                  throws java.lang.Exception

Receive a message from a MPI Processor Destination. Receiving from the MPI Connector Destination ( <protocol>:// ) returns the MPI COMM_WORLD GroupMembershipInfo structure. From this, the client application can address send and receive operations to specific MPI Processors. A receive from any processor is achieved by calling recv on the Group's wildcard destination.

The receive operation at the MPI layer delivers a byte[]. Tbe byte[] is read by the MPIConnector into the receive buffer. If the sent data is more than the size of the receive buffer, then the data is truncated. The length may be less than the size of the receive buffer. If a receive transformer is configured, then this must transform the receive buffer's contents. The receive operation's status and then the receive buffer are placed on the context stack. If no receive transformer is defined, then the receive buffer's byte[] is passed up to the controller layer. A subsequent receive will overwrite the receive buffer's contents.

Allows only a single receive at a time, blocking if multiple receives are performed concurrently.

The default MPI receive mode is used. This is typically blocking.

Specified by:
onRecv in class AbstractConnector
Parameters:
env - the Envelope containing the Destination to receive from.
Returns:
true on success, else false for managed failure.
Throws:
java.lang.Exception - if a failure condition occurs.

recv

public void recv(Envelope env)
          throws java.lang.Exception
Perform the recv synchronously.

Specified by:
recv in interface Connector
Overrides:
recv in class AbstractConnector
Parameters:
env - the Envelope which gives the Destination to receive from and where the received message is eventually placed with the sender.
Throws:
java.lang.Exception - if any failure condition occurs during the recv method.
java.lang.IllegalArgumentException - when env is null.
java.lang.IllegalStateException - when not started or stopping.
See Also:
Controller.callbackRecv(org.jumpi.spi.Envelope, boolean, java.lang.String)

cancelRecv

public void cancelRecv(Envelope env)
Does nothing.

Specified by:
cancelRecv in interface Connector
Overrides:
cancelRecv in class AbstractConnector
Parameters:
env - the recv operation's Envelope to cancel.

Jumpi v1.2.0

Copyright © 2003, Peter Jonathan Klauser.