コード例 #1
0
ファイル: array.py プロジェクト: steder/maroonmpi
def isend( array, destination, tag, communicator ):
    datatype = getMpiType(array)
    size = nm.size( array )
    shape = nm.shape( array )
    rank = nm.rank( array )
    request = core.isend( datatype, 1, core.MPI_INT, destination, tag, communicator )
    request = core.isend( rank, 1, core.MPI_INT, destination, tag+1, communicator )
    request = core.isend( shape, rank, core.MPI_INT, destination, tag+2, communicator )
    request = core.isend( size, 1, core.MPI_INT, destination, tag+3, communicator )
    return core.send( array, size, datatype, destination, tag+4, communicator )
コード例 #2
0
ファイル: pythonic.py プロジェクト: steder/maroonmpi
def isend(message, destination, tag=0, comm=core.MPI_COMM_WORLD):
    """
    request = comm.isend( message, destination[, tag(defaults to 0)])
    
    Sends message to destination with tag (default tag is 0).
    
    This is a NON-Blocking send, meaning this process will not wait for the data if it is not
    yet ready.  The call will immediately return a request object.
    """
    messageType = getMessageType( message )
    core.isend( messageType, 1, core.MPI_INT, destination, tag, comm )
    if messageType == SINGLE: #single elements (integers, characters)
        print "Single Element Case:"
        dataType = getSingleType( message )
        core.isend( dataType, 1, core.MPI_INT, destination, tag+1, comm )
        returnvalue = core.isend( message, 1, dataType, destination, tag+2, comm )
    elif messageType == SEQUENCE: #non-array sequences
        print "Sequence Case:"
        dataType = getSequenceType( message )
        dataType = int(core.isend( dataType, 1, core.MPI_INT, destination, tag+1, comm ))
        length = int(core.isend( len(message), 1, core.MPI_INT, destination,tag+2, comm))
        returnvalue = core.isend(  message, length, dataType, destination, tag+3, comm )
    elif messageType == ARRAY:
        print "Array Case:"
        returnvalue = array.isend(message, destination, tag+1, comm )
    else: #object case
        print "Generic Object Case:"
        returnvalue = sobj.isend( message, destinaion, tag+1, comm )# (2) are the same
    return returnvalue
コード例 #3
0
ファイル: request.py プロジェクト: steder/maroonmpi
def isend( buffer, count, datatype, destination, tag, comm ):
    """
    request = isend(buffer, count, datatype, destination, tag, communicator)

    Send 'buffer', which consists of 'count' elements of type 'datatype',
    to the processor in 'comm' that has rank 'destination' and is waiting
    for a message with tag == 'tag'.

    Buffer:  Can be a single numeric value or a numeric array.
    Count:  Number of elements in an array, or 1 for scalar data.
    Datatype:  One of a few type constants defined in the mpi module.
    Destination:  Rank in the specified communicator to send this message to.
    Tag:  An arbitrary value used to route messages more precisely.
          Tags are often ignored (especially in simpler programs).  If
          you don't care what the tag is use:  MPI_ANY_TAG
    Comm:  The communicator that contains 'destination'

    Request:  Request is an integer that represents this nonblocking
    send operation.  You use this handle to check on the status of this
    isend by calling functions like test() and wait().

    Example:

    request = send( Numeric.ones(10), 10, MPI_INT, 1, 7, MPI_COMM_WORLD )
    if ( test( request ) ):
        print 'Send complete!'

    # Wait for the send to complete before proceeding:
    wait( request )

    """
    #raise NotImplementedError,"Non-Blocking I/O does not work(yet)"    
    id = core.isend( buffer, count, datatype, destination, tag, comm )
    request = Request( "send", id, buffer, count, datatype, destination, tag, comm )
    return request