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

Simplify API context managers and decorators #6189

Draft
wants to merge 1 commit into
base: branch-25.02
Choose a base branch
from

Conversation

wphicks
Copy link
Contributor

@wphicks wphicks commented Dec 18, 2024

TODO (currently in draft)

Copy link

copy-pr-bot bot commented Dec 18, 2024

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions bot added the Cython / Python Cython or Python issue label Dec 18, 2024
output_dtype
def __enter__(self):
if global_settings.api_depth == 0:
self.cupy_allocator_cm = cupy_using_allocator(rmm_cupy_allocator)
Copy link
Member

Choose a reason for hiding this comment

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

Philosophically, this still proves a question that we have avoided so far: if a user is using cupy native pool, then gets into cuML, cuML allocates things in vanilla or pooled RMM, then at the end of the estimator processing the user ends up with cupy objects allocated by two different allocators!

Besides having to document this very well, doing this here instead of at import time like cuDF does makes this scenario way more plausible. As a matter of fact, I'm very convinced the reason we haven't seen much in the way of errors like this one is because cuDF sets cuPy allocator at import time for us.

):
# Dictionary mapping parameter names to their purpose (e.g. as input,
# target, etc.) for use in parsing input to a wrapped function
self.params_to_handle = {
Copy link
Member

Choose a reason for hiding this comment

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

Given that we already have the concept of handles in cuML and CUDA, I found this naming very confusing for a good couple of minutes, I wonder what would be better naming here

"""
def __init__(
self,
input_param='X',
Copy link
Member

Choose a reason for hiding this comment

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

We should be thinking of common parameters like weights (classes and samples)

"self": "self",
}
if input_param is not None:
self.params_to_handle[input_param] = "input"
Copy link
Member

Choose a reason for hiding this comment

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

This entry doesn't exist in params_to_handle yet, right? Just checking if I missed it somewhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cython / Python Cython or Python issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants