Manual Pages for UNIX Darwin command on man MPI_Waitany
MyWebUniversity

Manual Pages for UNIX Darwin command on man MPI_Waitany

MPIWaitany(3OpenMPI) MPIWaitany(3OpenMPI)

NAME

MMPPIIWWaaiittaannyy - Waits for any specified send or receive to complete.

SSYYNNTTAAXX CC SSyynnttaaxx

#include

int MPIWaitany(int count, MPIRequest *arrayofrequests, int *index, MPIStatus *status) FFoorrttrraann SSyynnttaaxx INCLUDE 'mpif.h'

MPIWAITANY(COUNT, ARRAYOFREQUESTS, INDEX, STATUS, IERROR)

INTEGER COUNT, ARRAYOFREQUESTS(*), INDEX

INTEGER STATUS(MPISTATUSSIZE), IERROR

CC++++ SSyynnttaaxx

#include

static int Request::Waitany(int count, Request arrayofrequests[], Status& status) static int Request::Waitany(int count, Request arrayofrequests[]) IINNPPUUTT PPAARRAAMMEETTEERRSS count List length (integer). arrayofrequests Array of requests (array of handles). OOUUTTPPUUTT PPAARRAAMMEETTEERRSS index Index of handle for operation that completed (integer). In

the range 0 to count-1. In Fortran, the range is 1 to count.

status Status object (status).

IERROR Fortran only: Error status (integer).

DESCRIPTION

A call to MPIWaitany can be used to wait for the completion of one out of several requests. The arrayofrequests list may contain null or inactive handles. If the list contains no active handles (list has length zero or all entries are null or inactive), then the call returns immediately with index = MPIUNDEFINED, and an empty status. The execution of MPIWaitany(count, arrayofrequests, index, status) has the same effect as the execution of MPIWait(&arrayofrequests[i], status), where i is the value returned by index (unless the value of index is MPIUNDEFINED). MPIWaitany with an array containing one active entry is equivalent to MPIWait. If your application does not need to examine the status field, you can save resources by using the predefined constant MPISTATUSIGNORE as a special value for the status argument.

EExxaammppllee:: Client-server code (starvation can occur).

CALL MPICOMMSIZE(comm, size, ierr) CALL MPICOMMRANK(comm, rank, ierr) IF(rank .GT 0) THEN ! client code DO WHILE(.TRUE.) CALL MPIISEND(a, n, MPIREAL, 0, tag, comm, request, ierr) CALL MPIWAIT(request, status, ierr) END DO

ELSE ! rank=0 - server code

DO i=1, size-1

CALL MPIIRECV(a(1,i), n, MPIREAL, i tag, comm, requestlist(i), ierr) END DO DO WHILE(.TRUE.)

CALL MPIWAITANY(size-1, requestlist, index, status, ierr)

CALL DOSERVICE(a(1,index)) ! handle one message CALL MPIIRECV(a(1, index), n, MPIREAL, index, tag, comm, requestlist(index), ierr) END DO END IF EERRRROORRSS Almost all MPI routines return an error value; C routines as the value

of the function and Fortran routines in the last argument. C++ func-

tions do not return errors. If the default error handler is set to

MPI::ERRORSTHROWEXCEPTIONS, then on error the C++ exception mechanism

will be used to throw an MPI::Exception object. Before the error value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPICommseterrhandler, MPIFileseterrhandler, or

MPIWinseterrhandler (depending on the type of MPI handle that gener-

ated the request); the predefined error handler MPIERRORSRETURN may

be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.

Note that per MPI-1 section 3.2.5, MPI exceptions on requests passed to

MPIWAITANY do not set the status.MPIERROR field in the returned sta-

tus. The error code is passed to the back-end error handler and may be

passed back to the caller through the return value of MPIWAITANY if

the back-end error handler returns it. The pre-defined MPI error han-

dler MPIERRORSRETURN exhibits this behavior, for example.

SEE ALSO

MPICommseterrhandler MPIFileseterrhandler MPITest MPITestall MPITestany MPITestsome MPIWait MPIWaitall MPIWaitsome MPIWinseterrhandler Open MPI 1.2 September 2006 MPIWaitany(3OpenMPI)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™