Skip to content

UCT/CUDA: Added wrappers for nvml functions. - #10680

Merged
brminich merged 1 commit into
openucx:masterfrom
rakhmets:topic/nvml-wrap
Jul 10, 2025
Merged

brminich merged 1 commit into
openucx:masterfrom
rakhmets:topic/nvml-wrap

Conversation

@rakhmets

Copy link
Copy Markdown
Contributor

What?

Added wrappers for nvml functions.

Why?

To handle the lack of nvml functions in the dynamically loaded library.

@rakhmets
rakhmets force-pushed the topic/nvml-wrap branch 2 times, most recently from 84cc5db to 3dba04c Compare May 12, 2025 12:59
@rakhmets
rakhmets marked this pull request as ready for review May 12, 2025 12:59
@rakhmets rakhmets added the WIP-DNM Work in progress / Do not review label May 12, 2025
@rakhmets
rakhmets force-pushed the topic/nvml-wrap branch 6 times, most recently from 0a3ddeb to 70ddc1a Compare May 13, 2025 10:32
@rakhmets rakhmets removed the WIP-DNM Work in progress / Do not review label May 13, 2025
Comment thread src/ucs/sys/preprocessor_func.h Resolved
Comment thread src/uct/cuda/base/cuda_nvml.c Resolved
Comment thread src/uct/cuda/base/cuda_nvml.c Resolved
Comment thread test/gtest/uct/test_cuda_nvml.cc Resolved
iyastreb
iyastreb previously approved these changes May 21, 2025
Comment thread test/gtest/Makefile.am Resolved
Comment thread src/ucs/Makefile.am Resolved
Comment thread src/ucs/sys/preprocessor_func.h Resolved
Comment thread test/gtest/uct/test_cuda_nvml.cc Resolved
Comment thread src/uct/cuda/base/cuda_nvml.h Resolved
Comment thread src/uct/cuda/base/cuda_nvml.c Resolved
@rakhmets
rakhmets requested a review from brminich June 2, 2025 09:22
UCT_CUDA_NVML_WRAP_DECL(_func, UCS_FUNC_DEFINE_ARGS(__VA_ARGS__)) \
{ \
ucs_status_t _status; \
pthread_mutex_lock(&uct_cuda_nvml_mutex); \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we need to protect every nvml call, not just init?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's a workaround for hangs in NVML library. I'm not sure if nvmlInit is the only one with a thread safety issue.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i mean it is not thread safe, but can be used from different threads using different UCP contexts. Would not be that an issue?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, I see the question. Every NVML call is guarded by the mutex in this implementation. Except, nvmlShutdown.

@rakhmets
rakhmets requested review from brminich and yosefe June 26, 2025 14:23
brminich
brminich previously approved these changes Jun 26, 2025
tvegas1
tvegas1 previously approved these changes Jul 7, 2025
@brminich

brminich commented Jul 7, 2025

Copy link
Copy Markdown
Contributor

@rakhmets can you pls squash?

@rakhmets
rakhmets dismissed stale reviews from tvegas1 and brminich via 6381df7 July 7, 2025 13:26
@rakhmets
rakhmets requested a review from brminich July 9, 2025 16:15
@brminich
brminich merged commit afdf77b into openucx:master Jul 10, 2025
@rakhmets
rakhmets deleted the topic/nvml-wrap branch July 18, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants