Skip to content

Commit

Permalink
Merge branch 'branch-24.02' into perf-testing-dgl
Browse files Browse the repository at this point in the history
  • Loading branch information
BradReesWork authored Feb 2, 2024
2 parents f1dbc82 + 581d356 commit 18aeafb
Show file tree
Hide file tree
Showing 27 changed files with 723 additions and 91 deletions.
366 changes: 357 additions & 9 deletions benchmarks/nx-cugraph/pytest-based/bench_algos.py

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions benchmarks/nx-cugraph/pytest-based/run-2402.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
#
# Copyright (c) 2024, NVIDIA CORPORATION.
#
# Runs benchmarks for the 24.02 algos.
# Pass either a or b or both. This is useful for separating batches of runs on different GPUs:
# CUDA_VISIBLE_DEVICES=1 run-2402.sh b

mkdir -p logs

# benches="$benches ..." pattern is easy to comment out individual runs
benches=

while [[ $1 != "" ]]; do
if [[ $1 == "a" ]]; then
benches="$benches bench_ancestors"
benches="$benches bench_average_clustering"
benches="$benches bench_generic_bfs_edges"
benches="$benches bench_bfs_edges"
benches="$benches bench_bfs_layers"
benches="$benches bench_bfs_predecessors"
benches="$benches bench_bfs_successors"
benches="$benches bench_bfs_tree"
benches="$benches bench_clustering"
benches="$benches bench_core_number"
benches="$benches bench_descendants"
elif [[ $1 == "b" ]]; then
benches="$benches bench_descendants_at_distance"
benches="$benches bench_is_bipartite"
benches="$benches bench_is_strongly_connected"
benches="$benches bench_is_weakly_connected"
benches="$benches bench_number_strongly_connected_components"
benches="$benches bench_number_weakly_connected_components"
benches="$benches bench_overall_reciprocity"
benches="$benches bench_reciprocity"
benches="$benches bench_strongly_connected_components"
benches="$benches bench_transitivity"
benches="$benches bench_triangles"
benches="$benches bench_weakly_connected_components"
fi
shift
done

for bench in $benches; do
pytest -sv -k "soc-livejournal1" "bench_algos.py::$bench" 2>&1 | tee "logs/${bench}.log"
done
21 changes: 21 additions & 0 deletions ci/test_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,33 @@ popd

rapids-logger "pytest networkx using nx-cugraph backend"
pushd python/nx-cugraph
# Use editable install to make coverage work
pip install -e . --no-deps
./run_nx_tests.sh
# run_nx_tests.sh outputs coverage data, so check that total coverage is >0.0%
# in case nx-cugraph failed to load but fallback mode allowed the run to pass.
_coverage=$(coverage report|grep "^TOTAL")
echo "nx-cugraph coverage from networkx tests: $_coverage"
echo $_coverage | awk '{ if ($NF == "0.0%") exit 1 }'
# Ensure all algorithms were called by comparing covered lines to function lines.
# Run our tests again (they're fast enough) to add their coverage, then create coverage.json
pytest \
--pyargs nx_cugraph \
--config-file=./pyproject.toml \
--cov-config=./pyproject.toml \
--cov=nx_cugraph \
--cov-append \
--cov-report=
coverage report \
--include="*/nx_cugraph/algorithms/*" \
--omit=__init__.py \
--show-missing \
--rcfile=./pyproject.toml
coverage json --rcfile=./pyproject.toml
python -m nx_cugraph.tests.ensure_algos_covered
# Exercise (and show results of) scripts that show implemented networkx algorithms
python -m nx_cugraph.scripts.print_tree --dispatch-name --plc --incomplete --different
python -m nx_cugraph.scripts.print_table
popd

rapids-logger "pytest cugraph-service (single GPU)"
Expand Down
14 changes: 8 additions & 6 deletions cpp/include/cugraph_c/community_algorithms.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
* Copyright (c) 2022-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.
Expand All @@ -23,7 +23,6 @@
#include <cugraph_c/resource_handle.h>

/** @defgroup community Community algorithms
* @{
*/

#ifdef __cplusplus
Expand Down Expand Up @@ -60,18 +59,21 @@ cugraph_error_code_t cugraph_triangle_count(const cugraph_resource_handle_t* han
cugraph_error_t** error);

/**
* @ingroup community
* @brief Get triangle counting vertices
*/
cugraph_type_erased_device_array_view_t* cugraph_triangle_count_result_get_vertices(
cugraph_triangle_count_result_t* result);

/**
* @ingroup community
* @brief Get triangle counting counts
*/
cugraph_type_erased_device_array_view_t* cugraph_triangle_count_result_get_counts(
cugraph_triangle_count_result_t* result);

/**
* @ingroup community
* @brief Free a triangle count result
*
* @param [in] result The result from a sampling algorithm
Expand Down Expand Up @@ -147,24 +149,28 @@ cugraph_error_code_t cugraph_leiden(const cugraph_resource_handle_t* handle,
cugraph_error_t** error);

/**
* @ingroup community
* @brief Get hierarchical clustering vertices
*/
cugraph_type_erased_device_array_view_t* cugraph_hierarchical_clustering_result_get_vertices(
cugraph_hierarchical_clustering_result_t* result);

/**
* @ingroup community
* @brief Get hierarchical clustering clusters
*/
cugraph_type_erased_device_array_view_t* cugraph_hierarchical_clustering_result_get_clusters(
cugraph_hierarchical_clustering_result_t* result);

/**
* @ingroup community
* @brief Get modularity
*/
double cugraph_hierarchical_clustering_result_get_modularity(
cugraph_hierarchical_clustering_result_t* result);

/**
* @ingroup community
* @brief Free a hierarchical clustering result
*
* @param [in] result The result from a sampling algorithm
Expand Down Expand Up @@ -423,7 +429,3 @@ void cugraph_clustering_result_free(cugraph_clustering_result_t* result);
#ifdef __cplusplus
}
#endif

/**
* @}
*/
Loading

0 comments on commit 18aeafb

Please sign in to comment.