MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / comm_graph

Function comm_graph

python/dolfinx/graph.py:149–182  ·  view source on GitHub ↗

Build a parallel communication graph from an index map. The communication graph is a directed graph that represents the communication pattern for a distributed array, and specifically the forward scatter operation where the values for owned indices are sent to ghosting ranks. The gr

(map: _cpp.common.IndexMap, root: int = 0)

Source from the content-addressed store, hash-verified

147
148
149def comm_graph(map: _cpp.common.IndexMap, root: int = 0) -> AdjacencyList:
150 """Build a parallel communication graph from an index map.
151
152 The communication graph is a directed graph that represents the
153 communication pattern for a distributed array, and specifically the
154 forward scatter operation where the values for owned indices are
155 sent to ghosting ranks. The graph is built from an index map, which
156 describes the local and ghosted indices of the array.
157
158 Edges in the graph represent communication from the owning rank to
159 ranks that ghost the data. The edge data holds the (0) target node,
160 (1) edge weight, and (2) an indicator for whether the sending and
161 receiving ranks share memory (``local==1``) or if the ranks do not
162 share memory (``local==0``). The node data holds the local size
163 (number of owned indices) and the number of ghost indices.
164
165 The graph can be processed using :func:`comm_graph` to build data
166 structures that can be used to build a `NetworkX
167 <https://networkx.org/>`_ directed graph.
168
169 Note:
170 This function is collective across all MPI ranks. The
171 communication graph is returned on the `root` rank. All other
172 ranks return an empty graph
173
174 Args:
175 map: Index map to build the communication graph from.
176 root: Rank that will return the communication graph. Other ranks
177 return an empty graph.
178
179 Returns:
180 An adjacency list representing the communication graph.
181 """
182 return AdjacencyList(_cpp.graph.comm_graph(map))
183
184
185def comm_graph_data(

Callers 2

graphFunction · 0.85
test_comm_graphsFunction · 0.85

Calls 2

comm_graphMethod · 0.80
AdjacencyListClass · 0.70

Tested by 1

test_comm_graphsFunction · 0.68