-
Notifications
You must be signed in to change notification settings - Fork 304
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
[FIX] Rename cugraph-ops
symbols (refactoring) and update GHA workflows to call pytest via python -m pytest
#3688
Changes from all commits
f283fc4
142b68d
4d39bad
6d9b367
5cb3b13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,7 +94,7 @@ jobs: | |
with: | ||
build_type: pull-request | ||
package-name: pylibcugraph | ||
test-unittest: "RAPIDS_DATASET_ROOT_DIR=./datasets pytest ./python/pylibcugraph/pylibcugraph/tests" | ||
test-unittest: "RAPIDS_DATASET_ROOT_DIR=./datasets python -m pytest ./python/pylibcugraph/pylibcugraph/tests" | ||
test-smoketest: "python ci/wheel_smoke_test_pylibcugraph.py" | ||
wheel-build-cugraph: | ||
needs: wheel-tests-pylibcugraph | ||
|
@@ -120,5 +120,5 @@ jobs: | |
test-before-amd64: "cd ./datasets && bash ./get_test_data.sh && cd - && RAPIDS_PY_WHEEL_NAME=pylibcugraph_${{ '${PIP_CU_VERSION}' }} rapids-download-wheels-from-s3 ./local-pylibcugraph-dep && pip install --no-deps ./local-pylibcugraph-dep/*.whl && pip install git+https://github.com/dask/dask.git@main git+https://github.com/dask/distributed.git@main git+https://github.com/rapidsai/[email protected]" | ||
# Skip dataset downloads on arm to save CI time -- arm only runs smoke tests. | ||
test-before-arm64: "RAPIDS_PY_WHEEL_NAME=pylibcugraph_${{ '${PIP_CU_VERSION}' }} rapids-download-wheels-from-s3 ./local-pylibcugraph-dep && pip install --no-deps ./local-pylibcugraph-dep/*.whl && pip install git+https://github.com/dask/dask.git@main git+https://github.com/dask/distributed.git@main git+https://github.com/rapidsai/[email protected]" | ||
test-unittest: "RAPIDS_DATASET_ROOT_DIR=/__w/cugraph/cugraph/datasets pytest -m sg ./python/cugraph/cugraph/tests" | ||
test-unittest: "RAPIDS_DATASET_ROOT_DIR=/__w/cugraph/cugraph/datasets python -m pytest -m sg ./python/cugraph/cugraph/tests" | ||
test-smoketest: "python ci/wheel_smoke_test_cugraph.py" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ jobs: | |
date: ${{ inputs.date }} | ||
sha: ${{ inputs.sha }} | ||
package-name: pylibcugraph | ||
test-unittest: "RAPIDS_DATASET_ROOT_DIR=./datasets pytest ./python/pylibcugraph/pylibcugraph/tests" | ||
test-unittest: "RAPIDS_DATASET_ROOT_DIR=./datasets python -m pytest ./python/pylibcugraph/pylibcugraph/tests" | ||
wheel-tests-cugraph: | ||
secrets: inherit | ||
uses: rapidsai/shared-action-workflows/.github/workflows/[email protected] | ||
|
@@ -52,4 +52,4 @@ jobs: | |
# Always want to test against latest dask/distributed. | ||
test-before-amd64: "cd ./datasets && bash ./get_test_data.sh && cd - && pip install git+https://github.com/dask/dask.git@main git+https://github.com/dask/distributed.git@main git+https://github.com/rapidsai/[email protected]" | ||
test-before-arm64: "cd ./datasets && bash ./get_test_data.sh && cd - && pip install git+https://github.com/dask/dask.git@main git+https://github.com/dask/distributed.git@main git+https://github.com/rapidsai/[email protected]" | ||
test-unittest: "RAPIDS_DATASET_ROOT_DIR=/__w/cugraph/cugraph/datasets pytest -m sg ./python/cugraph/cugraph/tests" | ||
test-unittest: "RAPIDS_DATASET_ROOT_DIR=/__w/cugraph/cugraph/datasets python -m pytest -m sg ./python/cugraph/cugraph/tests" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ | |
|
||
#include <raft/random/rng_state.hpp> | ||
|
||
#include <type_traits> | ||
|
||
namespace cugraph { | ||
|
||
template <typename vertex_t, typename edge_t> | ||
|
@@ -34,14 +36,19 @@ sample_neighbors_adjacency_list(raft::handle_t const& handle, | |
size_t sampling_size, | ||
ops::graph::SamplingAlgoT sampling_algo) | ||
{ | ||
const auto [ops_graph, max_degree] = detail::get_graph_and_max_degree(graph_view); | ||
return ops::graph::uniform_sample_csr(rng_state, | ||
using base_vertex_t = std::decay_t<vertex_t>; | ||
using base_edge_t = std::decay_t<edge_t>; | ||
static_assert(std::is_same_v<base_vertex_t, base_edge_t>, | ||
"cugraph-ops sampling not yet implemented for different node and edge types"); | ||
|
||
const auto ops_graph = detail::get_graph(graph_view); | ||
return ops::graph::uniform_sample_csc(rng_state, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, see below, this is part of the refactoring |
||
ops_graph, | ||
ptr_d_start, | ||
num_start_vertices, | ||
sampling_size, | ||
sampling_algo, | ||
max_degree, | ||
ops_graph.dst_max_in_degree, | ||
handle.get_stream()); | ||
} | ||
|
||
|
@@ -55,14 +62,19 @@ std::tuple<rmm::device_uvector<vertex_t>, rmm::device_uvector<vertex_t>> sample_ | |
size_t sampling_size, | ||
ops::graph::SamplingAlgoT sampling_algo) | ||
{ | ||
const auto [ops_graph, max_degree] = detail::get_graph_and_max_degree(graph_view); | ||
using base_vertex_t = std::decay_t<vertex_t>; | ||
using base_edge_t = std::decay_t<edge_t>; | ||
Comment on lines
+65
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, if decay is necessary, I think we should apply this in the caller site. |
||
static_assert(std::is_same_v<base_vertex_t, base_edge_t>, | ||
"cugraph-ops sampling not yet implemented for different node and edge types"); | ||
|
||
const auto ops_graph = detail::get_graph(graph_view); | ||
return ops::graph::uniform_sample_coo(rng_state, | ||
ops_graph, | ||
ptr_d_start, | ||
num_start_vertices, | ||
sampling_size, | ||
sampling_algo, | ||
max_degree, | ||
ops_graph.dst_max_in_degree, | ||
handle.get_stream()); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,34 +20,26 @@ | |
|
||
#include <cugraph-ops/graph/format.hpp> | ||
|
||
#include <tuple> | ||
|
||
namespace cugraph { | ||
namespace detail { | ||
|
||
template <typename NodeTypeT, typename EdgeTypeT> | ||
ops::graph::fg_csr<EdgeTypeT> get_graph( | ||
ops::graph::csc<EdgeTypeT, NodeTypeT> get_graph( | ||
graph_view_t<NodeTypeT, EdgeTypeT, false, false> const& gview) | ||
{ | ||
ops::graph::fg_csr<EdgeTypeT> graph; | ||
graph.n_nodes = gview.number_of_vertices(); | ||
graph.n_indices = gview.number_of_edges(); | ||
ops::graph::csc<EdgeTypeT, NodeTypeT> graph; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to double check. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes indeed, part of the refactoring was to align more with general naming conventions |
||
graph.n_src_nodes = gview.number_of_vertices(); | ||
graph.n_dst_nodes = gview.number_of_vertices(); | ||
graph.n_indices = gview.number_of_edges(); | ||
// FIXME this is sufficient for now, but if there is a fast (cached) way | ||
// of getting max degree, use that instead | ||
Comment on lines
+34
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for curiosity, is there any performance benefit in providing a tighter bound for max_in_degree? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For neighborhood sampling, no. For other operations in cugraph-ops, yes. |
||
graph.dst_max_in_degree = std::numeric_limits<EdgeTypeT>::max(); | ||
// FIXME: this is evil and is just temporary until we have a matching type in cugraph-ops | ||
// or we change the type accepted by the functions calling into cugraph-ops | ||
graph.offsets = const_cast<EdgeTypeT*>(gview.local_edge_partition_view().offsets().data()); | ||
graph.indices = const_cast<EdgeTypeT*>(gview.local_edge_partition_view().indices().data()); | ||
return graph; | ||
} | ||
|
||
template <typename NodeTypeT, typename EdgeTypeT> | ||
std::tuple<ops::graph::fg_csr<EdgeTypeT>, NodeTypeT> get_graph_and_max_degree( | ||
graph_view_t<NodeTypeT, EdgeTypeT, false, false> const& gview) | ||
{ | ||
// FIXME this is sufficient for now, but if there is a fast (cached) way | ||
// of getting max degree, use that instead | ||
auto max_degree = std::numeric_limits<NodeTypeT>::max(); | ||
return std::make_tuple(get_graph(gview), max_degree); | ||
} | ||
|
||
} // namespace detail | ||
} // namespace cugraph |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we require
decay
here, should we better apply decay at the caller site?vertex_t
implies it is a non-const non-volatile value type in our code base, and I think we should better maintain that convention.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that makes sense, I don't know about cugraph conventions, so
decay
would not hurt in case someone does end up calling this with a reference type or const or volatile. It is mainly used for the type checks anyway.Do you want me to remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, yeah, then, I don't care whether we apply decay here or not (I initially thought the caller is also our code, but if the caller is a user, then, I am not sure removing decay here is good or bad).