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

Fix inconsistent calls to nvml::Init and nvml::Shutdown #5317

Merged
merged 8 commits into from
Feb 15, 2024

Conversation

JanuszL
Copy link
Contributor

@JanuszL JanuszL commented Feb 13, 2024

  • in the worker thread and thread poll the nvml is called
    only for non-CPU pipelines but the shutdown is called
    unconditionally
  • resolves the problem by making nvml initialization a
    RAII pattern
  • adds suppression for nvmlInitWithFlags call

Category:

Bug fix (non-breaking change which fixes an issue)

Description:

  • in the worker thread and thread poll the nvml is called
    only for non-CPU pipelines but the shutdown is called
    unconditionally
  • resolves the problem by making nvml initialization a
    RAII pattern
  • adds suppression for nvmlInitWithFlags call

Additional information:

Affected modules and functionalities:

  • thread_pool
  • worker thread
    • nvml wrapper

Key points relevant for the review:

  • NA

Tests:

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

@JanuszL JanuszL added the important-fix Fixes an important issue in the software or development environment. label Feb 13, 2024
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [12783002]: BUILD STARTED

- in the worker thread and thread poll the nvml is called
  only for non-CPU pipelines but the shutdown is called
  unconditionally

Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [12783062]: BUILD STARTED

Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [12787486]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [12787486]: BUILD FAILED

dali/util/nvml.h Outdated
@@ -241,6 +241,43 @@ inline void Shutdown() {
CUDA_CALL(nvmlShutdown());
}


class nvmlHandle {
Copy link
Contributor

Choose a reason for hiding this comment

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

We have NvmlError and NvmlBadAlloc, so I guess it'd be good to have Nvml... something.
I'm not convinced we should call it NvmlHandle, since it's not a handle nor does it wrap any handle.
Other names to consider:
NvmlScope
NvmlInstance

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Fixed.

Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [12807069]: BUILD STARTED

dali/util/nvml.h Outdated Show resolved Hide resolved
Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [12810692]: BUILD STARTED

Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [12810908]: BUILD STARTED

Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [12813834]: BUILD STARTED

@JanuszL JanuszL merged commit 029e73b into NVIDIA:main Feb 15, 2024
5 of 6 checks passed
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [12813834]: BUILD PASSED

@JanuszL JanuszL deleted the fix_nvml_shut branch February 15, 2024 15:38
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
important-fix Fixes an important issue in the software or development environment.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants