This source file includes following definitions.
- mca_topo_base_dist_graph_neighbors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #include "ompi_config.h"
16
17 #include "ompi/communicator/communicator.h"
18 #include "ompi/info/info.h"
19 #include "ompi/mca/topo/base/base.h"
20
21
22 int mca_topo_base_dist_graph_neighbors(ompi_communicator_t *comm,
23 int maxindegree,
24 int sources[], int sourceweights[],
25 int maxoutdegree, int destinations[],
26 int destweights[])
27 {
28 mca_topo_base_comm_dist_graph_2_2_0_t *dg = comm->c_topo->mtc.dist_graph;
29 int i;
30
31 if (!OMPI_COMM_IS_DIST_GRAPH(comm)) {
32 return OMPI_ERR_NOT_FOUND;
33 }
34 if (maxindegree > dg->indegree) {
35 maxindegree = dg->indegree;
36 }
37 if (maxoutdegree > dg->outdegree) {
38 maxoutdegree = dg->outdegree;
39 }
40
41 for (i = 0; i < maxindegree; ++i) {
42 sources[i] = dg->in[i];
43 if (MPI_UNWEIGHTED != sourceweights && NULL != dg->inw) {
44 sourceweights[i] = dg->inw[i];
45 }
46 }
47 for (i = 0; i < maxoutdegree; ++i) {
48 destinations[i] = dg->out[i];
49 if (MPI_UNWEIGHTED != destweights && NULL != dg->outw) {
50 destweights[i] = dg->outw[i];
51 }
52 }
53
54 return MPI_SUCCESS;
55 }
56