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

Python API updates to enable explicit control of internal graph_t creation and deletion #2023

Merged

Conversation

rlratzel
Copy link
Contributor

@rlratzel rlratzel commented Jan 20, 2022

Python API updates to enable explicit control of internal graph_t creation and deletion. These changes will allow users who need more control over how the internal graph_t object is managed to have additional APIs to do so. Current cugraph algos construct the appropriate graph_t at the C++ boundary, run the algo, and destroy the object each time. This is more convenient and safer in some cases since it does not require the user to understand the necessary data format requirements for each algo (CSC, CSR, etc.), but it adds overhead to each algo call. If a user knows which algos will be called ahead of time and the relevant graph creation options to use, they can reuse the underlying graph_t object and eliminate the redundant creation/deletion expense. These APIs also allow for benchmarks to measure only the algo run time without the initial graph creation time.

These changes are grouped into a category of enhancements sometimes referred to as "expert mode"

Changes here include:

  • Updates to pylibcugraph to add the APIs from the libcugraph_c library for graph_t management and calling Pagerank and SSSP
  • Addition of the experimental namespace to pylibcugraph, which is where some of the new APIs will be until we finalize decisions on names, signatures, etc.
  • Updates to cugraph Graph classes, Pagerank, and SSSP algos to call in to pylibcugraph

…t probably is not necessary given the dir name, updated @experimental decorator to not error on extension types (from cython), removed unnecessary gpu_graph_data class and replaced with cython SGGraph class.
…e callable, removed __init__.py file contents from connectivity in favor of just exposing functions in the top-level __init__.py.
…y copies), added additional types for C API structs, added tests.
@rlratzel rlratzel added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jan 20, 2022
@rlratzel rlratzel added this to the 22.02 milestone Jan 20, 2022
@rlratzel rlratzel self-assigned this Jan 20, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 20, 2022

Codecov Report

Merging #2023 (22667c6) into branch-22.02 (63efaea) will increase coverage by 0.93%.
The diff coverage is 91.12%.

Impacted file tree graph

@@               Coverage Diff                @@
##           branch-22.02    #2023      +/-   ##
================================================
+ Coverage         71.93%   72.87%   +0.93%     
================================================
  Files               146      150       +4     
  Lines              9264     9669     +405     
================================================
+ Hits               6664     7046     +382     
- Misses             2600     2623      +23     
Impacted Files Coverage Δ
python/pylibcugraph/pylibcugraph/tests/utils.py 34.61% <15.78%> (-52.89%) ⬇️
...n/pylibcugraph/pylibcugraph/utilities/api_tools.py 95.23% <95.23%> (ø)
python/pylibcugraph/pylibcugraph/tests/conftest.py 96.42% <96.36%> (-3.58%) ⬇️
python/pylibcugraph/pylibcugraph/__init__.py 100.00% <100.00%> (ø)
...pylibcugraph/pylibcugraph/experimental/__init__.py 100.00% <100.00%> (ø)
...ph/pylibcugraph/tests/test_connected_components.py 100.00% <100.00%> (ø)
...n/pylibcugraph/pylibcugraph/tests/test_graph_sg.py 100.00% <100.00%> (ø)
...n/pylibcugraph/pylibcugraph/tests/test_pagerank.py 100.00% <100.00%> (ø)
...ython/pylibcugraph/pylibcugraph/tests/test_sssp.py 100.00% <100.00%> (ø)
python/cugraph/cugraph/tests/test_ecg.py 100.00% <0.00%> (ø)
... and 60 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 63efaea...22667c6. Read the comment docs.

@rlratzel rlratzel marked this pull request as ready for review January 26, 2022 15:20
@rlratzel rlratzel requested review from a team as code owners January 26, 2022 15:20
@rlratzel rlratzel removed the DRAFT label Jan 26, 2022
Copy link
Collaborator

@ChuckHastings ChuckHastings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor observations. I think it's fine to go forward, but we probably should address these early in 22.04

python/pylibcugraph/pylibcugraph/graphs.pyx Outdated Show resolved Hide resolved
python/pylibcugraph/pylibcugraph/graphs.pyx Show resolved Hide resolved
python/pylibcugraph/pylibcugraph/pagerank.pyx Show resolved Hide resolved
python/pylibcugraph/pylibcugraph/sssp.pyx Show resolved Hide resolved
cpp/src/c_api/graph_mg.cpp Show resolved Hide resolved
c_api::cugraph_type_erased_device_array_t const* weights,
c_api::cugraph_type_erased_device_array_view_t const* src,
c_api::cugraph_type_erased_device_array_view_t const* dst,
c_api::cugraph_type_erased_device_array_view_t const* weights,
bool_t renumber,
bool_t check,
data_type_id_t edge_type)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, if we have 'edge_type', shouldn't there be 'vertex_type' as well?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vertex_type is embedded in the type erased array. Edge type cannot be deduced from the other parameters.

cpp/src/c_api/graph_sg.cpp Show resolved Hide resolved
cpp/tests/c_api/bfs_test.c Show resolved Hide resolved
python/pylibcugraph/pylibcugraph/graphs.pyx Outdated Show resolved Hide resolved
python/pylibcugraph/pylibcugraph/pagerank.pyx Outdated Show resolved Hide resolved
Copy link
Contributor

@seunghwak seunghwak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving (assuming FIXMEs will be addressed quickly in the next release).

@BradReesWork
Copy link
Member

@gpucibot merge

@rapids-bot rapids-bot bot merged commit aecd54a into rapidsai:branch-22.02 Jan 27, 2022
jjacobelli pushed a commit to jjacobelli/cugraph that referenced this pull request Jan 27, 2022
…reation and deletion (rapidsai#2023)

Python API updates to enable explicit control of internal `graph_t` creation and deletion. These changes will allow users who need more control over how the internal `graph_t` object is managed to have additional APIs to do so.  Current cugraph algos construct the appropriate `graph_t` at the C++ boundary, run the algo, and destroy the object each time.  This is more convenient and safer in some cases since it does not require the user to understand the necessary data format requirements for each algo (CSC, CSR, etc.), but it adds overhead to each algo call. If a user knows which algos will be called ahead of time and the relevant graph creation options to use, they can reuse the underlying `graph_t` object and eliminate the redundant creation/deletion expense.  These APIs also allow for benchmarks to measure only the algo run time without the initial graph creation time.

These changes are grouped into a category of enhancements sometimes referred to as "expert mode"

Changes here include:
* Updates to `pylibcugraph` to add the APIs from the `libcugraph_c` library for `graph_t` management and calling Pagerank and SSSP
* Addition of the `experimental` namespace to `pylibcugraph`, which is where some of the new APIs will be until we finalize decisions on names, signatures, etc.
* <s>Updates to cugraph Graph classes, Pagerank, and SSSP algos to call in to `pylibcugraph`</s>

Authors:
  - Rick Ratzel (https://github.com/rlratzel)
  - Chuck Hastings (https://github.com/ChuckHastings)
  - Seunghwa Kang (https://github.com/seunghwak)

Approvers:
  - Chuck Hastings (https://github.com/ChuckHastings)
  - Seunghwa Kang (https://github.com/seunghwak)
  - Brad Rees (https://github.com/BradReesWork)

URL: rapidsai#2023
jjacobelli pushed a commit to jjacobelli/cugraph that referenced this pull request Jan 27, 2022
…reation and deletion (rapidsai#2023)

Python API updates to enable explicit control of internal `graph_t` creation and deletion. These changes will allow users who need more control over how the internal `graph_t` object is managed to have additional APIs to do so.  Current cugraph algos construct the appropriate `graph_t` at the C++ boundary, run the algo, and destroy the object each time.  This is more convenient and safer in some cases since it does not require the user to understand the necessary data format requirements for each algo (CSC, CSR, etc.), but it adds overhead to each algo call. If a user knows which algos will be called ahead of time and the relevant graph creation options to use, they can reuse the underlying `graph_t` object and eliminate the redundant creation/deletion expense.  These APIs also allow for benchmarks to measure only the algo run time without the initial graph creation time.

These changes are grouped into a category of enhancements sometimes referred to as "expert mode"

Changes here include:
* Updates to `pylibcugraph` to add the APIs from the `libcugraph_c` library for `graph_t` management and calling Pagerank and SSSP
* Addition of the `experimental` namespace to `pylibcugraph`, which is where some of the new APIs will be until we finalize decisions on names, signatures, etc.
* <s>Updates to cugraph Graph classes, Pagerank, and SSSP algos to call in to `pylibcugraph`</s>

Authors:
  - Rick Ratzel (https://github.com/rlratzel)
  - Chuck Hastings (https://github.com/ChuckHastings)
  - Seunghwa Kang (https://github.com/seunghwak)

Approvers:
  - Chuck Hastings (https://github.com/ChuckHastings)
  - Seunghwa Kang (https://github.com/seunghwak)
  - Brad Rees (https://github.com/BradReesWork)

URL: rapidsai#2023
jjacobelli pushed a commit to jjacobelli/cugraph that referenced this pull request Jan 27, 2022
…reation and deletion (rapidsai#2023)

Python API updates to enable explicit control of internal `graph_t` creation and deletion. These changes will allow users who need more control over how the internal `graph_t` object is managed to have additional APIs to do so.  Current cugraph algos construct the appropriate `graph_t` at the C++ boundary, run the algo, and destroy the object each time.  This is more convenient and safer in some cases since it does not require the user to understand the necessary data format requirements for each algo (CSC, CSR, etc.), but it adds overhead to each algo call. If a user knows which algos will be called ahead of time and the relevant graph creation options to use, they can reuse the underlying `graph_t` object and eliminate the redundant creation/deletion expense.  These APIs also allow for benchmarks to measure only the algo run time without the initial graph creation time.

These changes are grouped into a category of enhancements sometimes referred to as "expert mode"

Changes here include:
* Updates to `pylibcugraph` to add the APIs from the `libcugraph_c` library for `graph_t` management and calling Pagerank and SSSP
* Addition of the `experimental` namespace to `pylibcugraph`, which is where some of the new APIs will be until we finalize decisions on names, signatures, etc.
* <s>Updates to cugraph Graph classes, Pagerank, and SSSP algos to call in to `pylibcugraph`</s>

Authors:
  - Rick Ratzel (https://github.com/rlratzel)
  - Chuck Hastings (https://github.com/ChuckHastings)
  - Seunghwa Kang (https://github.com/seunghwak)

Approvers:
  - Chuck Hastings (https://github.com/ChuckHastings)
  - Seunghwa Kang (https://github.com/seunghwak)
  - Brad Rees (https://github.com/BradReesWork)

URL: rapidsai#2023
jjacobelli pushed a commit to jjacobelli/cugraph that referenced this pull request Jan 27, 2022
…reation and deletion (rapidsai#2023)

Python API updates to enable explicit control of internal `graph_t` creation and deletion. These changes will allow users who need more control over how the internal `graph_t` object is managed to have additional APIs to do so.  Current cugraph algos construct the appropriate `graph_t` at the C++ boundary, run the algo, and destroy the object each time.  This is more convenient and safer in some cases since it does not require the user to understand the necessary data format requirements for each algo (CSC, CSR, etc.), but it adds overhead to each algo call. If a user knows which algos will be called ahead of time and the relevant graph creation options to use, they can reuse the underlying `graph_t` object and eliminate the redundant creation/deletion expense.  These APIs also allow for benchmarks to measure only the algo run time without the initial graph creation time.

These changes are grouped into a category of enhancements sometimes referred to as "expert mode"

Changes here include:
* Updates to `pylibcugraph` to add the APIs from the `libcugraph_c` library for `graph_t` management and calling Pagerank and SSSP
* Addition of the `experimental` namespace to `pylibcugraph`, which is where some of the new APIs will be until we finalize decisions on names, signatures, etc.
* <s>Updates to cugraph Graph classes, Pagerank, and SSSP algos to call in to `pylibcugraph`</s>

Authors:
  - Rick Ratzel (https://github.com/rlratzel)
  - Chuck Hastings (https://github.com/ChuckHastings)
  - Seunghwa Kang (https://github.com/seunghwak)

Approvers:
  - Chuck Hastings (https://github.com/ChuckHastings)
  - Seunghwa Kang (https://github.com/seunghwak)
  - Brad Rees (https://github.com/BradReesWork)

URL: rapidsai#2023
@rlratzel rlratzel deleted the branch-22.02-initialexpertmode branch June 17, 2022 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants