This source file includes following definitions.
- MPIX_Neighbor_alltoall_init
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 #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h"
40
41 #if OMPI_BUILD_MPI_PROFILING
42 #if OPAL_HAVE_WEAK_SYMBOLS
43 #pragma weak MPIX_Neighbor_alltoall_init = PMPIX_Neighbor_alltoall_init
44 #endif
45 #define MPIX_Neighbor_alltoall_init PMPIX_Neighbor_alltoall_init
46 #endif
47
48 static const char FUNC_NAME[] = "MPIX_Neighbor_alltoall_init";
49
50
51 int MPIX_Neighbor_alltoall_init(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
52 void *recvbuf, int recvcount, MPI_Datatype recvtype,
53 MPI_Comm comm, MPI_Info info, MPI_Request *request)
54 {
55 size_t sendtype_size, recvtype_size;
56 int err;
57
58 SPC_RECORD(OMPI_SPC_NEIGHBOR_ALLTOALL_INIT, 1);
59
60 MEMCHECKER(
61 memchecker_comm(comm);
62 if (MPI_IN_PLACE != sendbuf) {
63 memchecker_datatype(sendtype);
64 memchecker_call(&opal_memchecker_base_isdefined, (void *)sendbuf, sendcount, sendtype);
65 }
66 memchecker_datatype(recvtype);
67 memchecker_call(&opal_memchecker_base_isaddressable, recvbuf, recvcount, recvtype);
68 );
69
70 if (MPI_PARAM_CHECK) {
71
72
73
74
75 err = MPI_SUCCESS;
76 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
77 if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
78 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
79 FUNC_NAME);
80 } else if (! OMPI_COMM_IS_TOPO(comm)) {
81 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY,
82 FUNC_NAME);
83 } else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
84 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
85 FUNC_NAME);
86 } else {
87 OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
88 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
89 OMPI_CHECK_DATATYPE_FOR_RECV(err, recvtype, recvcount);
90 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
91 }
92
93 ompi_datatype_type_size(sendtype, &sendtype_size);
94 ompi_datatype_type_size(recvtype, &recvtype_size);
95 if ((sendtype_size*sendcount) != (recvtype_size*recvcount)) {
96 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TRUNCATE, FUNC_NAME);
97 }
98
99 if( OMPI_COMM_IS_CART(comm) ) {
100 const mca_topo_base_comm_cart_2_2_0_t *cart = comm->c_topo->mtc.cart;
101 if( 0 > cart->ndims ) {
102 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
103 }
104 }
105 else if( OMPI_COMM_IS_GRAPH(comm) ) {
106 int degree;
107 mca_topo_base_graph_neighbors_count(comm, ompi_comm_rank(comm), °ree);
108 if( 0 > degree ) {
109 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
110 }
111 }
112 else if( OMPI_COMM_IS_DIST_GRAPH(comm) ) {
113 const mca_topo_base_comm_dist_graph_2_2_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
114 int indegree = dist_graph->indegree;
115 int outdegree = dist_graph->outdegree;
116 if( indegree < 0 || outdegree < 0 ) {
117 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
118 }
119 }
120 }
121
122 OPAL_CR_ENTER_LIBRARY();
123
124
125 err = comm->c_coll->coll_neighbor_alltoall_init(sendbuf, sendcount, sendtype,
126 recvbuf, recvcount, recvtype, comm,
127 info, request,
128 comm->c_coll->coll_neighbor_alltoall_init_module);
129 OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
130 }