Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DistGB] save as graphbolt graph directly after partition test case #7724

Merged
merged 22 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 34 additions & 17 deletions python/dgl/distributed/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,28 +109,45 @@ def _save_graphs(filename, g_list, formats=None, sort_etypes=False):
save_graphs(filename, g_list, formats=formats)


def _get_inner_node_mask(graph, ntype_id):
if NTYPE in graph.ndata:
dtype = F.dtype(graph.ndata["inner_node"])
return (
graph.ndata["inner_node"]
* F.astype(graph.ndata[NTYPE] == ntype_id, dtype)
== 1
def _get_inner_node_mask(graph, ntype_id, gpb=None):
ndata = (
graph.node_attributes
if isinstance(graph, gb.FusedCSCSamplingGraph)
else graph.ndata
)
assert "inner_node" in ndata, "'inner_node' is not in nodes' data"
if NTYPE in ndata or gpb is not None:
ntype = (
gpb.map_to_per_ntype(ndata[NID])[0]
if gpb is not None
else ndata[NTYPE]
)
dtype = F.dtype(ndata["inner_node"])
return ndata["inner_node"] * F.astype(ntype == ntype_id, dtype) == 1
else:
return graph.ndata["inner_node"] == 1
return ndata["inner_node"] == 1


def _get_inner_edge_mask(graph, etype_id):
if ETYPE in graph.edata:
dtype = F.dtype(graph.edata["inner_edge"])
return (
graph.edata["inner_edge"]
* F.astype(graph.edata[ETYPE] == etype_id, dtype)
== 1
)
def _get_inner_edge_mask(
graph,
etype_id,
):
edata = (
graph.edge_attributes
if isinstance(graph, gb.FusedCSCSamplingGraph)
else graph.edata
)
assert "inner_edge" in edata, "'inner_edge' is not in edges' data"
etype = (
graph.type_per_edge
if isinstance(graph, gb.FusedCSCSamplingGraph)
else (graph.edata[ETYPE] if ETYPE in graph.edata else None)
)
if etype is not None:
dtype = F.dtype(edata["inner_edge"])
CfromBU marked this conversation as resolved.
Show resolved Hide resolved
return edata["inner_edge"] * F.astype(etype == etype_id, dtype) == 1
else:
return graph.edata["inner_edge"] == 1
return edata["inner_edge"] == 1


def _get_part_ranges(id_ranges):
Expand Down
Loading
Loading