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

Add pynvml as a dependency for dask-cudf #17386

Merged
merged 3 commits into from
Nov 21, 2024

Conversation

pentschev
Copy link
Member

Description

#17250 started using pynvml but did not add the proper dependency, this change fixes the missing dependency.

Checklist

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

@pentschev pentschev requested a review from a team as a code owner November 20, 2024 20:17
@pentschev pentschev requested a review from msarahan November 20, 2024 20:17
@github-actions github-actions bot added the Python Affects Python cuDF API. label Nov 20, 2024
@jakirkham
Copy link
Member

Thanks Peter! 🙏

Do we want to drop this try...except... then?

def _get_device_size():
try:
# Use PyNVML to find the worker device size.
import pynvml
pynvml.nvmlInit()
index = os.environ.get("CUDA_VISIBLE_DEVICES", "0").split(",")[0]
if index and not index.isnumeric():
# This means index is UUID. This works for both MIG and non-MIG device UUIDs.
handle = pynvml.nvmlDeviceGetHandleByUUID(str.encode(index))
else:
# This is a device index
handle = pynvml.nvmlDeviceGetHandleByIndex(int(index))
return pynvml.nvmlDeviceGetMemoryInfo(handle).total
except (ImportError, ValueError):
# Fall back to a conservative 8GiB default
return 8 * 1024**3

@rjzamora
Copy link
Member

Do we want to drop this try...except... then?

The ImportError shouldn't happen anymore, but the ValueError could happen if CUDA_VISIBLE_DEVICES isn't set correctly (e.g. if Dask-CUDA isn't in use).

@pentschev pentschev requested a review from a team as a code owner November 20, 2024 21:24
@pentschev
Copy link
Member Author

Removed the ImportError catch in da92408

@pentschev pentschev added 3 - Ready for Review Ready for review by team improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Nov 20, 2024
@@ -43,6 +43,7 @@ requirements:
run:
- python
- cudf ={{ version }}
- pynvml >=11.4.1,<12.0.0a0
Copy link
Member

Choose a reason for hiding this comment

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

Pushed this small change to include pynvml in the dask-cudf Conda package. Hope that is ok 🙂

Copy link
Member

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

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

Thanks Peter and Rick! 🙏

@jakirkham
Copy link
Member

/merge

@rapids-bot rapids-bot bot merged commit 68c4285 into rapidsai:branch-24.12 Nov 21, 2024
107 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants