This source file includes following definitions.
- MPI_Ineighbor_alltoall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #include "ompi_config.h"
28 #include <stdio.h>
29
30 #include "ompi/mpi/c/bindings.h"
31 #include "ompi/runtime/params.h"
32 #include "ompi/communicator/communicator.h"
33 #include "ompi/errhandler/errhandler.h"
34 #include "ompi/datatype/ompi_datatype.h"
35 #include "ompi/memchecker.h"
36 #include "ompi/mca/topo/topo.h"
37 #include "ompi/mca/topo/base/base.h"
38 #include "ompi/runtime/ompi_spc.h"
39
40 #if OMPI_BUILD_MPI_PROFILING
41 #if OPAL_HAVE_WEAK_SYMBOLS
42 #pragma weak MPI_Ineighbor_alltoall = PMPI_Ineighbor_alltoall
43 #endif
44 #define MPI_Ineighbor_alltoall PMPI_Ineighbor_alltoall
45 #endif
46
47 static const char FUNC_NAME[] = "MPI_Ineighbor_alltoall";
48
49
50 int MPI_Ineighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
51 void *recvbuf, int recvcount, MPI_Datatype recvtype,
52 MPI_Comm comm, MPI_Request *request)
53 {
54 size_t sendtype_size, recvtype_size;
55 int err;
56
57 SPC_RECORD(OMPI_SPC_INEIGHBOR_ALLTOALL, 1);
58
59 MEMCHECKER(
60 memchecker_comm(comm);
61 if (MPI_IN_PLACE != sendbuf) {
62 memchecker_datatype(sendtype);
63 memchecker_call(&opal_memchecker_base_isdefined, (void *)sendbuf, sendcount, sendtype);
64 }
65 memchecker_datatype(recvtype);
66 memchecker_call(&opal_memchecker_base_isaddressable, recvbuf, recvcount, recvtype);
67 );
68
69 if (MPI_PARAM_CHECK) {
70
71
72
73
74 err = MPI_SUCCESS;
75 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
76 if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
77 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
78 FUNC_NAME);
79 } else if (! OMPI_COMM_IS_TOPO(comm)) {
80 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY,
81 FUNC_NAME);
82 } else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
83 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
84 FUNC_NAME);
85 } else {
86 OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
87 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
88 OMPI_CHECK_DATATYPE_FOR_RECV(err, recvtype, recvcount);
89 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
90 }
91
92 ompi_datatype_type_size(sendtype, &sendtype_size);
93 ompi_datatype_type_size(recvtype, &recvtype_size);
94 if ((sendtype_size*sendcount) != (recvtype_size*recvcount)) {
95 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TRUNCATE, FUNC_NAME);
96 }
97
98 if( OMPI_COMM_IS_CART(comm) ) {
99 const mca_topo_base_comm_cart_2_2_0_t *cart = comm->c_topo->mtc.cart;
100 if( 0 > cart->ndims ) {
101 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
102 }
103 }
104 else if( OMPI_COMM_IS_GRAPH(comm) ) {
105 int degree;
106 mca_topo_base_graph_neighbors_count(comm, ompi_comm_rank(comm), °ree);
107 if( 0 > degree ) {
108 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
109 }
110 }
111 else if( OMPI_COMM_IS_DIST_GRAPH(comm) ) {
112 const mca_topo_base_comm_dist_graph_2_2_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
113 int indegree = dist_graph->indegree;
114 int outdegree = dist_graph->outdegree;
115 if( indegree < 0 || outdegree < 0 ) {
116 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
117 }
118 }
119 }
120
121 OPAL_CR_ENTER_LIBRARY();
122
123
124 err = comm->c_coll->coll_ineighbor_alltoall(sendbuf, sendcount, sendtype,
125 recvbuf, recvcount, recvtype, comm,
126 request, comm->c_coll->coll_ineighbor_alltoall_module);
127 OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
128 }