This source file includes following definitions.
- MPI_Graph_create
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 #include "ompi_config.h"
26 #include <stdio.h>
27
28 #include "ompi/mpi/c/bindings.h"
29 #include "ompi/runtime/params.h"
30 #include "ompi/communicator/communicator.h"
31 #include "ompi/errhandler/errhandler.h"
32 #include "ompi/mca/topo/base/base.h"
33 #include "ompi/memchecker.h"
34
35 #if OMPI_BUILD_MPI_PROFILING
36 #if OPAL_HAVE_WEAK_SYMBOLS
37 #pragma weak MPI_Graph_create = PMPI_Graph_create
38 #endif
39 #define MPI_Graph_create PMPI_Graph_create
40 #endif
41
42 static const char FUNC_NAME[] = "MPI_Graph_create";
43
44
45 int MPI_Graph_create(MPI_Comm old_comm, int nnodes, const int indx[],
46 const int edges[], int reorder, MPI_Comm *comm_graph)
47 {
48 mca_topo_base_module_t* topo;
49 int err;
50
51 MEMCHECKER(
52 memchecker_comm(old_comm);
53 );
54
55
56 if (MPI_PARAM_CHECK) {
57 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
58 if (ompi_comm_invalid(old_comm)) {
59 return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM,
60 FUNC_NAME);
61 } else if (OMPI_COMM_IS_INTER(old_comm)) {
62 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
63 FUNC_NAME);
64 }
65 if (nnodes < 0) {
66 return OMPI_ERRHANDLER_INVOKE (old_comm, MPI_ERR_ARG,
67 FUNC_NAME);
68 } else if (nnodes >= 1 && ((NULL == indx) || (NULL == edges))) {
69 return OMPI_ERRHANDLER_INVOKE (old_comm, MPI_ERR_ARG,
70 FUNC_NAME);
71 }
72
73 if (nnodes > ompi_comm_size(old_comm)) {
74 return OMPI_ERRHANDLER_INVOKE (old_comm, MPI_ERR_ARG,
75 FUNC_NAME);
76 }
77 }
78
79
80
81 if (0 == nnodes) {
82 *comm_graph = MPI_COMM_NULL;
83 return MPI_SUCCESS;
84 }
85 if( nnodes > old_comm->c_local_group->grp_proc_count ) {
86 return OMPI_ERRHANDLER_INVOKE (old_comm, MPI_ERR_ARG,
87 FUNC_NAME);
88 }
89
90 OPAL_CR_ENTER_LIBRARY();
91
92
93
94
95
96 if (OMPI_SUCCESS != (err = mca_topo_base_comm_select(old_comm,
97 NULL,
98 &topo,
99 OMPI_COMM_GRAPH))) {
100 return err;
101 }
102
103
104 err = topo->topo.graph.graph_create(topo, old_comm,
105 nnodes, indx, edges,
106 (0 == reorder) ? false : true, comm_graph);
107 OPAL_CR_EXIT_LIBRARY();
108
109 if (MPI_SUCCESS != err) {
110 OBJ_RELEASE(topo);
111 return OMPI_ERRHANDLER_INVOKE(old_comm, err, FUNC_NAME);
112 }
113
114
115 return MPI_SUCCESS;
116 }