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

Control pinned memory use with environment variables #17657

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

Conversation

vuule
Copy link
Contributor

@vuule vuule commented Dec 23, 2024

Description

Adds LIBCUDF_KERNEL_PINNED_COPY_THRESHOLD and LIBCUDF_ALLOCATE_HOST_AS_PINNED_THRESHOLD environment variables to set the pinned memory optimizations' thresholds.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Copy link

copy-pr-bot bot commented Dec 23, 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 libcudf Affects libcudf (C++/CUDA) code. label Dec 23, 2024
@vuule vuule added feature request New feature or request non-breaking Non-breaking change labels Dec 23, 2024
@vuule
Copy link
Contributor Author

vuule commented Dec 23, 2024

/ok to test

@vuule vuule marked this pull request as ready for review December 24, 2024 22:35
@vuule vuule requested a review from a team as a code owner December 24, 2024 22:35
@vuule vuule requested review from ttnghia and davidwendt December 24, 2024 22:35
@@ -277,7 +279,7 @@ bool config_default_pinned_memory_resource(pinned_mr_options const& opts)
CUDF_EXPORT auto& kernel_pinned_copy_threshold()
{
// use cudaMemcpyAsync for all pinned copies
static std::atomic<size_t> threshold = 0;
static std::atomic<size_t> threshold = getenv_or("LIBCUDF_KERNEL_PINNED_COPY_THRESHOLD", 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

One issue with static variable is that, they are initialized only once. The user will not be able to change them after they are set. Can we remove static?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm torn on this one. You're right, but:
I really like reading the env var once so I can log it cleanly (already a part of getenv_or).
Also, there are (C++) APIs to set these thresholds at runtime.
I'd keep this static until we have a use case that requires runtime changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants