This source file includes following definitions.
- MPI_Neighbor_allgather
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_Neighbor_allgather = PMPI_Neighbor_allgather
43 #endif
44 #define MPI_Neighbor_allgather PMPI_Neighbor_allgather
45 #endif
46
47 static const char FUNC_NAME[] = "MPI_Neighbor_allgather";
48
49
50 int MPI_Neighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
51 void *recvbuf, int recvcount, MPI_Datatype recvtype,
52 MPI_Comm comm)
53 {
54 int err;
55
56 SPC_RECORD(OMPI_SPC_NEIGHBOR_ALLGATHER, 1);
57
58 MEMCHECKER(
59 int rank;
60 ptrdiff_t ext;
61
62 rank = ompi_comm_rank(comm);
63 ompi_datatype_type_extent(recvtype, &ext);
64
65 memchecker_datatype(recvtype);
66 memchecker_comm(comm);
67
68 if (MPI_IN_PLACE != sendbuf) {
69 memchecker_datatype(sendtype);
70 memchecker_call(&opal_memchecker_base_isdefined, sendbuf, sendcount, sendtype);
71 }
72
73 memchecker_call(&opal_memchecker_base_isaddressable, recvbuf, recvcount, recvtype);
74 );
75
76 if (MPI_PARAM_CHECK) {
77
78
79
80
81 err = MPI_SUCCESS;
82 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
83 if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
84 OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
85 } else if (! OMPI_COMM_IS_TOPO(comm)) {
86 OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY, FUNC_NAME);
87 } else if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) {
88 err = MPI_ERR_TYPE;
89 } else if (recvcount < 0) {
90 err = MPI_ERR_COUNT;
91 } else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
92 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
93 } else {
94 OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
95 }
96 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
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
122
123
124 if ((0 == sendcount) || (0 == recvcount)) {
125 return MPI_SUCCESS;
126 }
127
128 OPAL_CR_ENTER_LIBRARY();
129
130
131 err = comm->c_coll->coll_neighbor_allgather(sendbuf, sendcount, sendtype,
132 recvbuf, recvcount, recvtype, comm,
133 comm->c_coll->coll_neighbor_allgather_module);
134 OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
135 }
136