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] change test_mp_dataloader #7819

Merged
merged 8 commits into from
Oct 16, 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
21 changes: 21 additions & 0 deletions python/dgl/distributed/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,27 @@ def load_partition(part_config, part_id, load_feats=True, use_graphbolt=False):
"part-{}".format(part_id) in part_metadata
), "part-{} does not exist".format(part_id)
part_files = part_metadata["part-{}".format(part_id)]

exist_dgl_graph = exist_graphbolt_graph = False
if os.path.exists(os.path.join(config_path, f"part{part_id}", "graph.dgl")):
use_graphbolt = False
exist_dgl_graph = True
if os.path.exists(
os.path.join(
config_path, f"part{part_id}", "fused_csc_sampling_graph.pt"
)
):
use_graphbolt = True
exist_graphbolt_graph = True

# Check if both DGL graph and GraphBolt graph exist or not exist. Make sure only one exists.
if not exist_dgl_graph and not exist_graphbolt_graph:
raise ValueError("The graph object doesn't exist.")
if exist_dgl_graph and exist_graphbolt_graph:
raise ValueError(
"Both DGL graph and GraphBolt graph exist. Please remove one."
)

if use_graphbolt:
part_graph_field = "part_graph_graphbolt"
else:
Expand Down
2 changes: 2 additions & 0 deletions tests/distributed/test_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,7 @@ def test_dgl_partition_to_graphbolt_homo(
orig_g = dgl.load_graphs(
os.path.join(test_dir, f"part{part_id}/graph.dgl")
)[0][0]
os.remove(os.path.join(test_dir, f"part{part_id}/graph.dgl"))
new_g = load_partition(
part_config, part_id, load_feats=False, use_graphbolt=True
)[0]
Expand Down Expand Up @@ -1067,6 +1068,7 @@ def test_dgl_partition_to_graphbolt_hetero(
orig_g = dgl.load_graphs(
os.path.join(test_dir, f"part{part_id}/graph.dgl")
)[0][0]
os.remove(os.path.join(test_dir, f"part{part_id}/graph.dgl"))
new_g = load_partition(
part_config, part_id, load_feats=False, use_graphbolt=True
)[0]
Expand Down
Loading