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

[BUG] Enforce renumbering for MNMG algos #1943

Merged
merged 7 commits into from
Nov 12, 2021
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
1 change: 1 addition & 0 deletions benchmarks/python_e2e/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def run(algos,
success = benchmark.run()

algo_name = benchmark.results[1].name
algo_name = f"benchmarks.{algo_name}"
algo_time = benchmark.results[1].runtime
# Generate json files containing the benchmark results
if benchmark_dir is not None:
Expand Down
2 changes: 2 additions & 0 deletions python/cugraph/cugraph/structure/graph_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ def from_dask_cudf_edgelist(
If source and destination indices are not in range 0 to V where V
is number of vertices, renumber argument should be True.
"""
if renumber is False:
raise ValueError("'renumber' must be set to 'True' for MNMG algos")
if self._Impl is None:
self._Impl = simpleDistributedGraphImpl(self.graph_properties)
elif type(self._Impl) is not simpleDistributedGraphImpl:
Expand Down
60 changes: 53 additions & 7 deletions python/cugraph/cugraph/tests/dask/test_mg_renumber.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,20 @@
from cugraph.tests.utils import RAPIDS_DATASET_ROOT_DIR_PATH


# =============================================================================
# Pytest Setup / Teardown - called for each test function
# =============================================================================
def setup_function():
gc.collect()


@pytest.mark.skipif(
is_single_gpu(), reason="skipping MG testing on Single GPU system"
)
@pytest.mark.parametrize("graph_file", utils.DATASETS_UNRENUMBERED,
ids=[f"dataset={d.as_posix()}"
for d in utils.DATASETS_UNRENUMBERED])
def test_mg_renumber(graph_file, dask_client):
gc.collect()

M = utils.read_csv_for_nx(graph_file)
sources = cudf.Series(M["0"])
Expand Down Expand Up @@ -90,8 +96,6 @@ def test_mg_renumber(graph_file, dask_client):
ids=[f"dataset={d.as_posix()}"
for d in utils.DATASETS_UNRENUMBERED])
def test_mg_renumber_add_internal_vertex_id(graph_file, dask_client):
gc.collect()

M = utils.read_csv_for_nx(graph_file)
sources = cudf.Series(M["0"])
destinations = cudf.Series(M["1"])
Expand Down Expand Up @@ -126,8 +130,6 @@ def test_mg_renumber_add_internal_vertex_id(graph_file, dask_client):
is_single_gpu(), reason="skipping MG testing on Single GPU system"
)
def test_dask_pagerank(dask_client):
gc.collect()

pandas.set_option("display.max_rows", 10000)

input_data_path = (RAPIDS_DATASET_ROOT_DIR_PATH /
Expand All @@ -149,10 +151,10 @@ def test_dask_pagerank(dask_client):
dtype=["int32", "int32", "float32"],
)

g = cugraph.DiGraph()
g = cugraph.Graph(directed=True)
g.from_cudf_edgelist(df, "src", "dst")

dg = cugraph.DiGraph()
dg = cugraph.Graph(directed=True)
dg.from_dask_cudf_edgelist(ddf, "src", "dst")

expected_pr = cugraph.pagerank(g)
Expand All @@ -176,3 +178,47 @@ def test_dask_pagerank(dask_client):
err = err + 1
print("Mismatches:", err)
assert err == 0


@pytest.mark.skipif(
is_single_gpu(), reason="skipping MG testing on Single GPU system"
)
@pytest.mark.parametrize("renumber", [False])
def test_directed_graph_renumber_false(renumber, dask_client):
input_data_path = (RAPIDS_DATASET_ROOT_DIR_PATH /
"karate.csv").as_posix()
chunksize = dcg.get_chunksize(input_data_path)

ddf = dask_cudf.read_csv(
input_data_path,
chunksize=chunksize,
delimiter=" ",
names=["src", "dst", "value"],
dtype=["int32", "int32", "float32"],
)
dg = cugraph.Graph(directed=True)

with pytest.raises(ValueError):
dg.from_dask_cudf_edgelist(ddf, "src", "dst", renumber=renumber)


@pytest.mark.skipif(
is_single_gpu(), reason="skipping MG testing on Single GPU system"
)
@pytest.mark.parametrize("renumber", [False])
def test_multi_directed_graph_renumber_false(renumber, dask_client):
input_data_path = (RAPIDS_DATASET_ROOT_DIR_PATH /
"karate_multi_edge.csv").as_posix()
chunksize = dcg.get_chunksize(input_data_path)

ddf = dask_cudf.read_csv(
input_data_path,
chunksize=chunksize,
delimiter=" ",
names=["src", "dst", "value"],
dtype=["int32", "int32", "float32"],
)
dg = cugraph.MultiGraph(directed=True)

with pytest.raises(ValueError):
dg.from_dask_cudf_edgelist(ddf, "src", "dst", renumber=renumber)