1 | .\"Copyright 2006-2008 Sun Microsystems, Inc. |
---|
2 | .\" Copyright (c) 1996 Thinking Machines Corporation |
---|
3 | .TH MPI_Bsend 3 "Dec 08, 2009" "1.4" "Open MPI" |
---|
4 | .SH NAME |
---|
5 | \fBMPI_Bsend\fP \- Basic send with user-specified buffering. |
---|
6 | |
---|
7 | .SH SYNTAX |
---|
8 | .ft R |
---|
9 | .SH C Syntax |
---|
10 | .nf |
---|
11 | #include <mpi.h> |
---|
12 | int MPI_Bsend(void \fI*buf\fP, int\fI count\fP, MPI_Datatype\fI datatype\fP, |
---|
13 | int\fI dest\fP, int\fI tag\fP, MPI_Comm\fI comm\fP) |
---|
14 | |
---|
15 | .SH Fortran Syntax |
---|
16 | .nf |
---|
17 | INCLUDE 'mpif.h' |
---|
18 | MPI_BSEND(\fIBUF\fP,\fI COUNT\fP,\fIDATATYPE\fP,\fI DEST\fP,\fI TAG\fP,\fI COMM\fP,\fI IERROR\fP) |
---|
19 | <type> \fIBUF\fP(*) |
---|
20 | INTEGER \fICOUNT\fP,\fI DATATYPE\fP,\fI DEST\fP,\fI TAG\fP,\fI COMM\fP,\fI IERROR\fP |
---|
21 | |
---|
22 | .SH C++ Syntax |
---|
23 | .nf |
---|
24 | #include <mpi.h> |
---|
25 | void Comm::Bsend(const void* \fIbuf\fP, int \fIcount\fP, const |
---|
26 | Datatype& \fIdatatype\fP, int \fIdest\fP, int \fItag\fP) const |
---|
27 | |
---|
28 | .SH INPUT PARAMETERS |
---|
29 | .ft R |
---|
30 | .TP 1i |
---|
31 | buf |
---|
32 | Initial address of send buffer (choice). |
---|
33 | .TP 1i |
---|
34 | count |
---|
35 | Number of entries in send buffer (nonnegative integer). |
---|
36 | .TP 1i |
---|
37 | datatype |
---|
38 | Datatype of each send buffer element (handle). |
---|
39 | .TP 1i |
---|
40 | dest |
---|
41 | Rank of destination (integer). |
---|
42 | .TP 1i |
---|
43 | tag |
---|
44 | Message tag (integer). |
---|
45 | .TP 1i |
---|
46 | comm |
---|
47 | Communicator (handle). |
---|
48 | |
---|
49 | .SH OUTPUT PARAMETER |
---|
50 | .ft R |
---|
51 | .TP 1i |
---|
52 | IERROR |
---|
53 | Fortran only: Error status (integer). |
---|
54 | |
---|
55 | .SH DESCRIPTION |
---|
56 | .ft R |
---|
57 | MPI_Bsend performs a buffered-mode, blocking send. |
---|
58 | |
---|
59 | .SH NOTES |
---|
60 | .ft R |
---|
61 | This send is provided as a convenience function; it allows the user to send messages without worrying about where they are buffered (because the user must have provided buffer space with MPI_Buffer_attach). |
---|
62 | .sp |
---|
63 | In deciding how much buffer space to allocate, remember that the buffer space |
---|
64 | is not available for reuse by subsequent \fIMPI_Bsend\fPs unless you are certain |
---|
65 | that the message |
---|
66 | has been received (not just that it should have been received). For example, |
---|
67 | this code does not allocate enough buffer space: |
---|
68 | .nf |
---|
69 | |
---|
70 | MPI_Buffer_attach( b, n*sizeof(double) + MPI_BSEND_OVERHEAD ); |
---|
71 | for (i=0; i<m; i++) { |
---|
72 | MPI_Bsend( buf, n, MPI_DOUBLE, ... ); |
---|
73 | } |
---|
74 | |
---|
75 | .fi |
---|
76 | because only enough buffer space is provided for a single send, and the |
---|
77 | loop may start a second |
---|
78 | .I MPI_Bsend |
---|
79 | before the first is done making use of the |
---|
80 | buffer. |
---|
81 | |
---|
82 | In C, you can |
---|
83 | force the messages to be delivered by |
---|
84 | MPI_Buffer_detach( &b, &n ); |
---|
85 | MPI_Buffer_attach( b, n ); |
---|
86 | (The |
---|
87 | .I MPI_Buffer_detach |
---|
88 | will not complete until all buffered messages are |
---|
89 | delivered.) |
---|
90 | |
---|
91 | |
---|
92 | .SH ERRORS |
---|
93 | Almost 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. |
---|
94 | .sp |
---|
95 | Before the error value is returned, the current MPI error handler is |
---|
96 | called. 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. |
---|
97 | |
---|
98 | .SH SEE ALSO |
---|
99 | .ft R |
---|
100 | .nf |
---|
101 | MPI_Buffer_attach |
---|
102 | MPI_Ibsend |
---|
103 | MPI_Bsend_init |
---|
104 | |
---|