diff --git a/benchmarks/python_e2e/main.py b/benchmarks/python_e2e/main.py index 128b9e8584e..903cd323d31 100644 --- a/benchmarks/python_e2e/main.py +++ b/benchmarks/python_e2e/main.py @@ -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: diff --git a/python/cugraph/cugraph/structure/graph_classes.py b/python/cugraph/cugraph/structure/graph_classes.py index f0e27be9b27..e5f89fd94de 100644 --- a/python/cugraph/cugraph/structure/graph_classes.py +++ b/python/cugraph/cugraph/structure/graph_classes.py @@ -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: diff --git a/python/cugraph/cugraph/tests/dask/test_mg_renumber.py b/python/cugraph/cugraph/tests/dask/test_mg_renumber.py index 29ee0a68c1e..38eb619b3d2 100644 --- a/python/cugraph/cugraph/tests/dask/test_mg_renumber.py +++ b/python/cugraph/cugraph/tests/dask/test_mg_renumber.py @@ -31,6 +31,13 @@ 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" ) @@ -38,7 +45,6 @@ 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"]) @@ -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"]) @@ -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 / @@ -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) @@ -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)