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 5 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
41 changes: 31 additions & 10 deletions python/dgl/distributed/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,40 @@ 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, use_graphbolt=False):
if use_graphbolt:
if NTYPE in graph.node_attributes:
dtype = F.dtype(graph.node_attributes["inner_node"])
CfromBU marked this conversation as resolved.
Show resolved Hide resolved
return (
graph.node_attributes["inner_node"]
* F.astype(graph.node_attributes[NTYPE] == ntype_id, dtype)
== 1
)
else:
return graph.node_attributes["inner_node"] == 1
else:
return graph.ndata["inner_node"] == 1
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
)
else:
return graph.ndata["inner_node"] == 1


def _get_inner_edge_mask(graph, etype_id):
def _get_inner_edge_mask(graph, etype_id, use_graphbolt=False):
if use_graphbolt:
if graph.type_per_edge is not None:
dtype = F.dtype(graph.edge_attributes["inner_edge"])
CfromBU marked this conversation as resolved.
Show resolved Hide resolved
return (
graph.edge_attributes["inner_edge"]
* F.astype(graph.type_per_edge == etype_id, dtype)
== 1
)
else:
return graph.edge_attributes["inner_edge"] == 1
if ETYPE in graph.edata:
dtype = F.dtype(graph.edata["inner_edge"])
return (
Expand Down
Loading
Loading