source: proiecte/hpl/openmpi_compiled/share/man/man3/MPI_Probe.3 @ 97

Last change on this file since 97 was 97, checked in by (none), 14 years ago

Adding compiled files

File size: 4.8 KB
Line 
1.\"Copyright 2006-2008 Sun Microsystems, Inc.
2.\" Copyright (c) 1996 Thinking Machines Corporation
3.TH MPI_Probe 3 "Dec 08, 2009" "1.4" "Open MPI"
4.SH NAME
5\fBMPI_Probe\fP \- Blocking test for a message.
6
7.SH SYNTAX
8.ft R
9.SH C Syntax
10.nf
11#include <mpi.h>
12int MPI_Probe(int \fIsource\fP, int\fI tag\fP, MPI_Comm\fI comm\fP, MPI_Status\fI *status\fP)
13
14.SH Fortran Syntax
15.nf
16INCLUDE 'mpif.h'
17MPI_PROBE(\fISOURCE, TAG, COMM, STATUS, IERROR\fP)
18        INTEGER \fISOURCE, TAG, COMM, STATUS(MPI_STATUS_SIZE), IERROR\fP
19
20.SH C++ Syntax
21.nf
22#include <mpi.h>
23void Comm::Probe(int \fIsource\fP, int \fItag\fP, Status& \fIstatus\fP) const
24
25void Comm::Probe(int \fIsource\fP, int \fItag\fP) const
26
27.SH INPUT PARAMETERS
28.ft R
29.TP 1i
30source
31Source rank or MPI_ANY_SOURCE (integer).
32.TP 1i
33tag
34Tag value or MPI_ANY_TAG (integer).
35.TP 1i
36comm
37Communicator (handle).
38
39.SH OUTPUT PARAMETERS
40.ft R
41.TP 1i
42status
43Status object (status).
44.ft R
45.TP 1i
46IERROR
47Fortran only: Error status (integer).
48
49.SH DESCRIPTION
50.ft R
51The MPI_Probe and MPI_Iprobe operations allow checking of incoming messages, without actual receipt of them. The user can then decide how to receive them, based on the information returned by the probe in the status variable. For example, the user may allocate memory for the receive buffer, according to the length of the probed message.
52.sp
53MPI_Probe behaves like MPI_Iprobe except that it is a blocking call that returns only after a matching message has been found.
54.sp
55If your application does not need to examine the \fIstatus\fP field, you can save resources by using the predefined constant MPI_STATUS_IGNORE as a special value for the \fIstatus\fP argument.
56.sp
57The semantics of MPI_Probe and MPI_Iprobe guarantee progress: If a call to MPI_Probe has been issued by a process, and a send that matches the probe has been initiated by some process, then the call to MPI_Probe will return, unless the message is received by another concurrent receive operation (that is executed by another thread at the probing process). Similarly, if a process busy waits with MPI_Iprobe and a matching message has been issued, then the call to MPI_Iprobe will eventually return flag = true unless the message is received by another concurrent receive operation.
58.sp
59\fBExample 1:\fP Use blocking probe to wait for an incoming message.
60.sp
61.nf
62CALL MPI_COMM_RANK(comm, rank, ierr)
63       IF (rank.EQ.0) THEN
64            CALL MPI_SEND(i, 1, MPI_INTEGER, 2, 0, comm, ierr)
65       ELSE IF(rank.EQ.1) THEN
66            CALL MPI_SEND(x, 1, MPI_REAL, 2, 0, comm, ierr)
67       ELSE   ! rank.EQ.2
68           DO i=1, 2
69              CALL MPI_PROBE(MPI_ANY_SOURCE, 0,
70                              comm, status, ierr)
71              IF (status(MPI_SOURCE) = 0) THEN
72100                CALL MPI_RECV(i, 1, MPI_INTEGER, 0, 0, status, ierr)
73              ELSE
74200                CALL MPI_RECV(x, 1, MPI_REAL, 1, 0, status, ierr)
75              END IF
76           END DO
77       END IF
78.fi
79.sp
80Each message is received with the right type.
81.sp
82\fBExample 2:\fP A program similar to the previous example, but with a problem.
83.sp
84.nf
85CALL MPI_COMM_RANK(comm, rank, ierr)
86       IF (rank.EQ.0) THEN
87            CALL MPI_SEND(i, 1, MPI_INTEGER, 2, 0, comm, ierr)
88       ELSE IF(rank.EQ.1) THEN
89            CALL MPI_SEND(x, 1, MPI_REAL, 2, 0, comm, ierr)
90       ELSE
91           DO i=1, 2
92              CALL MPI_PROBE(MPI_ANY_SOURCE, 0,
93                              comm, status, ierr)
94              IF (status(MPI_SOURCE) = 0) THEN
95100                CALL MPI_RECV(i, 1, MPI_INTEGER, MPI_ANY_SOURCE,
96                                 0, status, ierr)
97              ELSE
98200                CALL MPI_RECV(x, 1, MPI_REAL, MPI_ANY_SOURCE,
99                                 0, status, ierr)
100              END IF
101           END DO
102       END IF
103.fi
104.sp
105We slightly modified Example 2, using MPI_ANY_SOURCE as the source argument in the two receive calls in statements labeled 100 and 200. The program is now incorrect: The receive operation may receive a message that is distinct from the message probed by the preceding call to MPI_Probe.
106
107.SH ERRORS
108Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ functions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism will be used to throw an MPI:Exception object.
109.sp
110Before the error value is returned, the current MPI error handler is
111called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN 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. 
112
113.SH SEE ALSO
114.ft R
115.sp
116MPI_Iprobe
117.br
118MPI_Cancel
119
Note: See TracBrowser for help on using the repository browser.