Skip to content

Load NVML at runtime via dlopen#33

Merged
patryk-przybysz merged 1 commit into
develfrom
feat/nvml-dlopen
Jun 13, 2026
Merged

Load NVML at runtime via dlopen#33
patryk-przybysz merged 1 commit into
develfrom
feat/nvml-dlopen

Conversation

@patryk-przybysz

Copy link
Copy Markdown
Collaborator

Summary

Currently the agent resolves NVML at compile time: CMake either links libnvidia-ml directly or falls back to a compile-time stub that fakes GPU metrics. That means the binary's behaviour depends on what was present when it was built, not what's on the host at runtime and we can't ship one artifact to mixed GPU/non-GPU machines without awkward build-time branching.

This PR loads NVML lazily at runtime via dlopen/dlsym in a new platform/nvml_loader module. NvmlCollector calls NVML through a function-pointer table; if the library isn't present, the collector is simply unsupported.

Verification

Tested on WSL, please check on a native Linux machine with an NVIDIA GPU before merging

@patryk-przybysz patryk-przybysz self-assigned this Jun 11, 2026
@patryk-przybysz patryk-przybysz added the enhancement New feature or request label Jun 11, 2026
@patryk-przybysz patryk-przybysz requested review from FW-Nagorko and varev-dev and removed request for FW-Nagorko June 11, 2026 16:18

@varev-dev varev-dev left a comment

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.

lgtm

@patryk-przybysz patryk-przybysz merged commit 39ad5f3 into devel Jun 13, 2026
1 check passed
@patryk-przybysz patryk-przybysz deleted the feat/nvml-dlopen branch June 13, 2026 15:44
@github-project-automation github-project-automation Bot moved this to Done in volta Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants