From fdb154fd77b63024f866c991daf48c4425aa0ffe Mon Sep 17 00:00:00 2001 From: Ralph Liu Date: Tue, 16 Jul 2024 13:55:53 -0700 Subject: [PATCH 1/5] Update bench_algos.py to prevent SSSP failure --- benchmarks/cugraph/pytest-based/bench_algos.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/benchmarks/cugraph/pytest-based/bench_algos.py b/benchmarks/cugraph/pytest-based/bench_algos.py index 4a87b7086ea..bf627278d77 100644 --- a/benchmarks/cugraph/pytest-based/bench_algos.py +++ b/benchmarks/cugraph/pytest-based/bench_algos.py @@ -330,8 +330,18 @@ def bench_bfs(gpubenchmark, graph): def bench_sssp(gpubenchmark, graph): + if not graph.is_weighted(): + pytest.skip("Skipping: Unweighted Graphs are not supported by SSSP") + sssp = dask_cugraph.sssp if is_graph_distributed(graph) else cugraph.sssp - start = graph.edgelist.edgelist_df["src"][0] + + src_col = graph.edgelist.edgelist_df["src"] + if isinstance(graph, dask_cudf.Series): + start = src_col.compute().iloc[0] + else: + start = src_col.iloc[0] + + # breakpoint() # check if start exists gpubenchmark(sssp, graph, start) From dc81d47daa6f33963163103f6bd7118531a7650e Mon Sep 17 00:00:00 2001 From: Ralph Liu Date: Tue, 16 Jul 2024 13:56:16 -0700 Subject: [PATCH 2/5] Fix whitespace --- benchmarks/pytest.ini | 106 +++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/benchmarks/pytest.ini b/benchmarks/pytest.ini index b3d8a8bb36c..fe7fc31b6d6 100644 --- a/benchmarks/pytest.ini +++ b/benchmarks/pytest.ini @@ -1,67 +1,67 @@ [pytest] pythonpath = - shared/python + shared/python testpaths = - cugraph/pytest_based - cugraph-service/pytest_based + cugraph/pytest_based + cugraph-service/pytest_based addopts = - --benchmark-columns="min, max, mean, stddev, outliers" + --benchmark-columns="min, max, mean, stddev, outliers" markers = - managedmem_on: RMM managed memory enabled - managedmem_off: RMM managed memory disabled - poolallocator_on: RMM pool allocator enabled - poolallocator_off: RMM pool allocator disabled - tiny: tiny datasets - small: small datasets - medium: medium datasets - large: large datasets - directed: directed datasets - undirected: undirected datasets - matrix_types: inputs are matrices - nx_types: inputs are NetowrkX Graph objects - cugraph_types: inputs are cuGraph Graph objects - sg: single-GPU - mg: multi-GPU - snmg: single-node multi-GPU - mnmg: multi-node multi-GPU - local: local cugraph - remote: cugraph-service - batch_size_100: batch size of 100 for sampling algos - batch_size_500: batch size of 500 for sampling algos - batch_size_1000: batch size of 1000 for sampling algos - batch_size_2500: batch size of 2500 for sampling algos - batch_size_5000: batch size of 5000 for sampling algos - batch_size_10000: batch size of 10000 for sampling algos - batch_size_20000: batch size of 20000 for sampling algos - batch_size_30000: batch size of 30000 for sampling algos - batch_size_40000: batch size of 40000 for sampling algos - batch_size_50000: batch size of 50000 for sampling algos - batch_size_60000: batch size of 60000 for sampling algos - batch_size_70000: batch size of 70000 for sampling algos - batch_size_80000: batch size of 80000 for sampling algos - batch_size_90000: batch size of 90000 for sampling algos - batch_size_100000: batch size of 100000 for sampling algos - num_clients_2: start 2 cugraph-service clients - num_clients_4: start 4 cugraph-service clients - num_clients_8: start 8 cugraph-service clients - num_clients_16: start 16 cugraph-service clients - num_clients_32: start 32 cugraph-service clients - fanout_10_25: fanout [10, 25] for sampling algos - fanout_5_10_15: fanout [5, 10, 15] for sampling algos - rmat_data: RMAT-generated synthetic datasets - file_data: datasets from $RAPIDS_DATASET_ROOT_DIR + managedmem_on: RMM managed memory enabled + managedmem_off: RMM managed memory disabled + poolallocator_on: RMM pool allocator enabled + poolallocator_off: RMM pool allocator disabled + tiny: tiny datasets + small: small datasets + medium: medium datasets + large: large datasets + directed: directed datasets + undirected: undirected datasets + matrix_types: inputs are matrices + nx_types: inputs are NetowrkX Graph objects + cugraph_types: inputs are cuGraph Graph objects + sg: single-GPU + mg: multi-GPU + snmg: single-node multi-GPU + mnmg: multi-node multi-GPU + local: local cugraph + remote: cugraph-service + batch_size_100: batch size of 100 for sampling algos + batch_size_500: batch size of 500 for sampling algos + batch_size_1000: batch size of 1000 for sampling algos + batch_size_2500: batch size of 2500 for sampling algos + batch_size_5000: batch size of 5000 for sampling algos + batch_size_10000: batch size of 10000 for sampling algos + batch_size_20000: batch size of 20000 for sampling algos + batch_size_30000: batch size of 30000 for sampling algos + batch_size_40000: batch size of 40000 for sampling algos + batch_size_50000: batch size of 50000 for sampling algos + batch_size_60000: batch size of 60000 for sampling algos + batch_size_70000: batch size of 70000 for sampling algos + batch_size_80000: batch size of 80000 for sampling algos + batch_size_90000: batch size of 90000 for sampling algos + batch_size_100000: batch size of 100000 for sampling algos + num_clients_2: start 2 cugraph-service clients + num_clients_4: start 4 cugraph-service clients + num_clients_8: start 8 cugraph-service clients + num_clients_16: start 16 cugraph-service clients + num_clients_32: start 32 cugraph-service clients + fanout_10_25: fanout [10, 25] for sampling algos + fanout_5_10_15: fanout [5, 10, 15] for sampling algos + rmat_data: RMAT-generated synthetic datasets + file_data: datasets from $RAPIDS_DATASET_ROOT_DIR python_classes = - Bench* - Test* + Bench* + Test* python_files = - bench_* - test_* + bench_* + test_* python_functions = - bench_* - test_* + bench_* + test_* From 1e81cd3b48526b8a71d7134c7ca2a8d25dd8feaf Mon Sep 17 00:00:00 2001 From: Ralph Liu Date: Wed, 17 Jul 2024 08:16:15 -0700 Subject: [PATCH 3/5] Add additional check for Source argument dtype --- python/cugraph/cugraph/dask/traversal/sssp.py | 6 ++++++ python/cugraph/cugraph/traversal/sssp.py | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/python/cugraph/cugraph/dask/traversal/sssp.py b/python/cugraph/cugraph/dask/traversal/sssp.py index 04c4376a500..1a0c0ed39e6 100644 --- a/python/cugraph/cugraph/dask/traversal/sssp.py +++ b/python/cugraph/cugraph/dask/traversal/sssp.py @@ -110,6 +110,12 @@ def sssp(input_graph, source, cutoff=None, check_source=True): client = default_client() + if not isinstance(source, int): + raise ValueError( + f"Invalid source type. 'Source' must be an interger " + f"but was given a {type(source)}" + ) + def check_valid_vertex(G, source): is_valid_vertex = G.has_node(source) if not is_valid_vertex: diff --git a/python/cugraph/cugraph/traversal/sssp.py b/python/cugraph/cugraph/traversal/sssp.py index 5ab97e60390..0cfdf358283 100644 --- a/python/cugraph/cugraph/traversal/sssp.py +++ b/python/cugraph/cugraph/traversal/sssp.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-2024, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -223,6 +223,12 @@ def sssp( ) raise RuntimeError(err_msg) + if not isinstance(source, int): + raise ValueError( + f"Invalid source type. 'Source' must be an interger " + f"but was given a {type(source)}" + ) + if not G.has_node(source): raise ValueError("Graph does not contain source vertex") From 5cb832f15342786dd02533b53ac6f768c449358f Mon Sep 17 00:00:00 2001 From: Ralph Liu Date: Wed, 17 Jul 2024 08:19:04 -0700 Subject: [PATCH 4/5] Update checks for SSSP benchmark --- benchmarks/cugraph/pytest-based/bench_algos.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/benchmarks/cugraph/pytest-based/bench_algos.py b/benchmarks/cugraph/pytest-based/bench_algos.py index bf627278d77..04407d656d7 100644 --- a/benchmarks/cugraph/pytest-based/bench_algos.py +++ b/benchmarks/cugraph/pytest-based/bench_algos.py @@ -335,13 +335,12 @@ def bench_sssp(gpubenchmark, graph): sssp = dask_cugraph.sssp if is_graph_distributed(graph) else cugraph.sssp - src_col = graph.edgelist.edgelist_df["src"] - if isinstance(graph, dask_cudf.Series): - start = src_col.compute().iloc[0] - else: - start = src_col.iloc[0] + start_col = graph.select_random_vertices(num_vertices=1) + if is_graph_distributed(graph): + start_col = start_col.compute() + + start = start_col.to_arrow().to_pylist()[0] - # breakpoint() # check if start exists gpubenchmark(sssp, graph, start) From 8f3381d6fa29936b85914e4086dc4c3814088813 Mon Sep 17 00:00:00 2001 From: Ralph Liu Date: Thu, 18 Jul 2024 07:13:29 -0700 Subject: [PATCH 5/5] Revert dtype check --- python/cugraph/cugraph/dask/traversal/sssp.py | 6 ------ python/cugraph/cugraph/traversal/sssp.py | 8 +------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/python/cugraph/cugraph/dask/traversal/sssp.py b/python/cugraph/cugraph/dask/traversal/sssp.py index 1a0c0ed39e6..04c4376a500 100644 --- a/python/cugraph/cugraph/dask/traversal/sssp.py +++ b/python/cugraph/cugraph/dask/traversal/sssp.py @@ -110,12 +110,6 @@ def sssp(input_graph, source, cutoff=None, check_source=True): client = default_client() - if not isinstance(source, int): - raise ValueError( - f"Invalid source type. 'Source' must be an interger " - f"but was given a {type(source)}" - ) - def check_valid_vertex(G, source): is_valid_vertex = G.has_node(source) if not is_valid_vertex: diff --git a/python/cugraph/cugraph/traversal/sssp.py b/python/cugraph/cugraph/traversal/sssp.py index 0cfdf358283..5ab97e60390 100644 --- a/python/cugraph/cugraph/traversal/sssp.py +++ b/python/cugraph/cugraph/traversal/sssp.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2024, NVIDIA CORPORATION. +# Copyright (c) 2019-2023, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -223,12 +223,6 @@ def sssp( ) raise RuntimeError(err_msg) - if not isinstance(source, int): - raise ValueError( - f"Invalid source type. 'Source' must be an interger " - f"but was given a {type(source)}" - ) - if not G.has_node(source): raise ValueError("Graph does not contain source vertex")