This source file includes following definitions.
- MPI_Recv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #include "ompi_config.h"
22
23 #include "ompi/mpi/c/bindings.h"
24 #include "ompi/runtime/params.h"
25 #include "ompi/communicator/communicator.h"
26 #include "ompi/errhandler/errhandler.h"
27 #include "ompi/mca/pml/pml.h"
28 #include "ompi/memchecker.h"
29 #include "ompi/request/request.h"
30 #include "ompi/runtime/ompi_spc.h"
31
32 #if OMPI_BUILD_MPI_PROFILING
33 #if OPAL_HAVE_WEAK_SYMBOLS
34 #pragma weak MPI_Recv = PMPI_Recv
35 #endif
36 #define MPI_Recv PMPI_Recv
37 #endif
38
39 static const char FUNC_NAME[] = "MPI_Recv";
40
41
42 int MPI_Recv(void *buf, int count, MPI_Datatype type, int source,
43 int tag, MPI_Comm comm, MPI_Status *status)
44 {
45 int rc = MPI_SUCCESS;
46
47 SPC_RECORD(OMPI_SPC_RECV, 1);
48
49 MEMCHECKER(
50 memchecker_datatype(type);
51 memchecker_call(&opal_memchecker_base_isaddressable, buf, count, type);
52 memchecker_comm(comm);
53 );
54
55 if ( MPI_PARAM_CHECK ) {
56 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
57 OMPI_CHECK_DATATYPE_FOR_RECV(rc, type, count);
58 OMPI_CHECK_USER_BUFFER(rc, buf, type, count);
59
60 if (ompi_comm_invalid(comm)) {
61 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
62 } else if (((tag < 0) && (tag != MPI_ANY_TAG)) || (tag > mca_pml.pml_max_tag)) {
63 rc = MPI_ERR_TAG;
64 } else if ((source != MPI_ANY_SOURCE) &&
65 (MPI_PROC_NULL != source) &&
66 ompi_comm_peer_invalid(comm, source)) {
67 rc = MPI_ERR_RANK;
68 }
69
70 OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
71 }
72
73 if (MPI_PROC_NULL == source) {
74 if (MPI_STATUS_IGNORE != status) {
75 *status = ompi_request_empty.req_status;
76 }
77 return MPI_SUCCESS;
78 }
79
80 OPAL_CR_ENTER_LIBRARY();
81
82 rc = MCA_PML_CALL(recv(buf, count, type, source, tag, comm, status));
83 OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
84 }