Package mpi

Class Request

  • All Implemented Interfaces:
    Freeable
    Direct Known Subclasses:
    Prequest

    public class Request
    extends java.lang.Object
    implements Freeable
    Request object.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected long handle  
      protected java.nio.Buffer recvBuf  
      protected java.nio.Buffer sendBuf  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Request​(long handle)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addRecvBufRef​(java.nio.Buffer buf)
      Adds a receive buffer to this Request object.
      protected void addSendBufRef​(java.nio.Buffer buf)
      Adds a send buffer to this Request object.
      void cancel()
      Mark a pending nonblocking communication for cancellation.
      void free()
      Set the request object to be void.
      protected static long[] getHandles​(Request[] r)  
      protected static long getNull()  
      Status getStatus()
      Returns a status object if the operation identified by the request is complete, or a null reference otherwise.
      boolean isNull()
      Test if request object is null.
      protected static void setHandles​(Request[] r, long[] h)  
      boolean test()
      Returns true if the operation identified by the request is complete, or false otherwise.
      static boolean testAll​(Request[] requests)
      Tests for completion of all of the operations associated with active requests.
      static Status[] testAllStatus​(Request[] requests)
      Tests for completion of all of the operations associated with active requests.
      static int testAny​(Request[] requests)
      Tests for completion of either one or none of the operations associated with active requests.
      static Status testAnyStatus​(Request[] requests)
      Tests for completion of either one or none of the operations associated with active requests.
      static int[] testSome​(Request[] requests)
      Behaves like waitSome, except that it returns immediately.
      static Status[] testSomeStatus​(Request[] requests)
      Behaves like waitSome, except that it returns immediately.
      Status testStatus()
      Returns a status object if the operation identified by the request is complete, or a null reference otherwise.
      static void waitAll​(Request[] requests)
      Blocks until all of the operations associated with the active requests in the array have completed.
      static Status[] waitAllStatus​(Request[] requests)
      Blocks until all of the operations associated with the active requests in the array have completed.
      static int waitAny​(Request[] requests)
      Blocks until one of the operations associated with the active requests in the array has completed.
      static Status waitAnyStatus​(Request[] requests)
      Blocks until one of the operations associated with the active requests in the array has completed.
      void waitFor()
      Blocks until the operation identified by the request is complete.
      static int[] waitSome​(Request[] requests)
      Blocks until at least one of the operations associated with the active active requests in the array has completed.
      static Status[] waitSomeStatus​(Request[] requests)
      Blocks until at least one of the operations associated with the active requests in the array has completed.
      Status waitStatus()
      Blocks until the operation identified by the request is complete.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • handle

        protected long handle
      • sendBuf

        protected java.nio.Buffer sendBuf
      • recvBuf

        protected java.nio.Buffer recvBuf
    • Constructor Detail

      • Request

        protected Request​(long handle)
    • Method Detail

      • getNull

        protected static long getNull()
      • free

        public void free()
                  throws MPIException
        Set the request object to be void. Java binding of the MPI operation MPI_REQUEST_FREE.
        Specified by:
        free in interface Freeable
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • cancel

        public final void cancel()
                          throws MPIException
        Mark a pending nonblocking communication for cancellation. Java binding of the MPI operation MPI_CANCEL.
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • addRecvBufRef

        protected final void addRecvBufRef​(java.nio.Buffer buf)
        Adds a receive buffer to this Request object. This method should be called by the internal api whenever a persistent request is created and any time a request object, that has an associated buffer, is returned from an operation to protect the buffer from getting prematurely garbage collected.
        Parameters:
        buf - buffer to add to the array list
      • addSendBufRef

        protected final void addSendBufRef​(java.nio.Buffer buf)
        Adds a send buffer to this Request object. This method should be called by the internal api whenever a persistent request is created and any time a request object, that has an associated buffer, is returned from an operation to protect the buffer from getting prematurely garbage collected.
        Parameters:
        buf - buffer to add to the array list
      • isNull

        public final boolean isNull()
        Test if request object is null.
        Returns:
        true if the request object is null, false otherwise
      • waitStatus

        public final Status waitStatus()
                                throws MPIException
        Blocks until the operation identified by the request is complete.

        Java binding of the MPI operation MPI_WAIT.

        After the call returns, the request object becomes inactive.

        Returns:
        status object
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • waitFor

        public final void waitFor()
                           throws MPIException
        Blocks until the operation identified by the request is complete.

        Java binding of the MPI operation MPI_WAIT.

        After the call returns, the request object becomes inactive.

        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • testStatus

        public final Status testStatus()
                                throws MPIException
        Returns a status object if the operation identified by the request is complete, or a null reference otherwise.

        Java binding of the MPI operation MPI_TEST.

        After the call, if the operation is complete (ie, if the return value is non-null), the request object becomes inactive.

        Returns:
        status object
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • getStatus

        public final Status getStatus()
                               throws MPIException
        Returns a status object if the operation identified by the request is complete, or a null reference otherwise.

        Java binding of the MPI operation MPI_REQUEST_GET_STATUS.

        After the call, if the operation is complete (ie, if the return value is non-null), the request object remains active.

        Returns:
        status object
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • test

        public final boolean test()
                           throws MPIException
        Returns true if the operation identified by the request is complete, or false otherwise.

        Java binding of the MPI operation MPI_TEST.

        After the call, if the operation is complete (ie, if the return value is true), the request object becomes inactive.

        Returns:
        true if the operation identified by the request, false otherwise
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • waitAnyStatus

        public static Status waitAnyStatus​(Request[] requests)
                                    throws MPIException
        Blocks until one of the operations associated with the active requests in the array has completed.

        Java binding of the MPI operation MPI_WAITANY.

        The index in array of requests for the request that completed can be obtained from the returned status object through the Status.getIndex() method. The corresponding element of array of requests becomes inactive.

        Parameters:
        requests - array of requests
        Returns:
        status object
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • waitAny

        public static int waitAny​(Request[] requests)
                           throws MPIException
        Blocks until one of the operations associated with the active requests in the array has completed.

        Java binding of the MPI operation MPI_WAITANY.

        The request that completed becomes inactive.

        Parameters:
        requests - array of requests
        Returns:
        The index in array of requests for the request that completed. If all of the requests are MPI_REQUEST_NULL, then index is returned as MPI.UNDEFINED.
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • testAnyStatus

        public static Status testAnyStatus​(Request[] requests)
                                    throws MPIException
        Tests for completion of either one or none of the operations associated with active requests.

        Java binding of the MPI operation MPI_TESTANY.

        If some request completed, the index in array of requests for that request can be obtained from the returned status object. The corresponding element in array of requests becomes inactive. If no request completed, testAnyStatus returns null.

        Parameters:
        requests - array of requests
        Returns:
        status object if one request completed, null otherwise.
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • testAny

        public static int testAny​(Request[] requests)
                           throws MPIException
        Tests for completion of either one or none of the operations associated with active requests.

        Java binding of the MPI operation MPI_TESTANY.

        If some request completed, it becomes inactive.

        Parameters:
        requests - array of requests
        Returns:
        index of operation that completed, or MPI.UNDEFINED if none completed.
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • waitAllStatus

        public static Status[] waitAllStatus​(Request[] requests)
                                      throws MPIException
        Blocks until all of the operations associated with the active requests in the array have completed.

        Java binding of the MPI operation MPI_WAITALL.

        On exit, requests become inactive. If the input value of array of requests contains inactive requests, corresponding elements of the status array will contain null status references.

        Parameters:
        requests - array of requests
        Returns:
        array of statuses
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • waitAll

        public static void waitAll​(Request[] requests)
                            throws MPIException
        Blocks until all of the operations associated with the active requests in the array have completed.

        Java binding of the MPI operation MPI_WAITALL.

        Parameters:
        requests - array of requests
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • testAllStatus

        public static Status[] testAllStatus​(Request[] requests)
                                      throws MPIException
        Tests for completion of all of the operations associated with active requests.

        Java binding of the MPI operation MPI_TESTALL.

        If all operations have completed, the exit value of the argument array is as for waitAllStatus.

        Parameters:
        requests - array of requests
        Returns:
        array of statuses if all operations have completed, null otherwise.
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • testAll

        public static boolean testAll​(Request[] requests)
                               throws MPIException
        Tests for completion of all of the operations associated with active requests.

        Java binding of the MPI operation MPI_TESTALL.

        Parameters:
        requests - array of requests
        Returns:
        true if all operations have completed, false otherwise.
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • waitSomeStatus

        public static Status[] waitSomeStatus​(Request[] requests)
                                       throws MPIException
        Blocks until at least one of the operations associated with the active requests in the array has completed.

        Java binding of the MPI operation MPI_WAITSOME.

        The size of the result array will be the number of operations that completed. The index in array of requests for each request that completed can be obtained from the returned status objects through the Status.getIndex() method. The corresponding element in array of requests becomes inactive.

        Parameters:
        requests - array of requests
        Returns:
        array of statuses or null if the number of operations completed is MPI_UNDEFINED.
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • waitSome

        public static int[] waitSome​(Request[] requests)
                              throws MPIException
        Blocks until at least one of the operations associated with the active active requests in the array has completed.

        Java binding of the MPI operation MPI_WAITSOME.

        The size of the result array will be the number of operations that completed. The corresponding element in array of requests becomes inactive.

        Parameters:
        requests - array of requests
        Returns:
        array of indexes of requests that completed or null if the number of operations completed is MPI_UNDEFINED.
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • testSomeStatus

        public static Status[] testSomeStatus​(Request[] requests)
                                       throws MPIException
        Behaves like waitSome, except that it returns immediately.

        Java binding of the MPI operation MPI_TESTSOME.

        If no operation has completed, testSome returns an array of length zero, otherwise the return value are as for waitSome.

        Parameters:
        requests - array of requests
        Returns:
        array of statuses
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • testSome

        public static int[] testSome​(Request[] requests)
                              throws MPIException
        Behaves like waitSome, except that it returns immediately.

        Java binding of the MPI operation MPI_TESTSOME.

        If no operation has completed, testSome returns an array of length zero, otherwise the return value are as for waitSome.

        Parameters:
        requests - array of requests
        Returns:
        array of indexes of requests that completed.
        Throws:
        MPIException - Signals that an MPI exception of some sort has occurred.
      • getHandles

        protected static long[] getHandles​(Request[] r)
      • setHandles

        protected static void setHandles​(Request[] r,
                                         long[] h)