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

Don't initialize NVML in ThreadPool when not setting affinity. #5472

Merged
merged 1 commit into from
May 16, 2024

Conversation

mzient
Copy link
Contributor

@mzient mzient commented May 16, 2024

Category:

Other Optimization

Description:

NVML initialization takes considerable time. This PR skips the NVML initialization in ThreadPool when not setting thread affinity (which is the only situation when we need NVML). This change enables small tests using ThreadPool to take much less time.

Additional information:

Affected modules and functionalities:

Key points relevant for the review:

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

Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [15060425]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [15060425]: BUILD PASSED

@awolant awolant self-assigned this May 16, 2024
@jantonguirao jantonguirao self-assigned this May 16, 2024
// only for the CPU pipeline
if (device_id != CPU_ONLY_DEVICE_ID) {
// We use NVML only for setting thread affinity
if (device_id != CPU_ONLY_DEVICE_ID && set_affinity) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it would be good to add the ( ) to not depend on the readers knowledge of operator priority in C++?

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 don't think it's counterintuitive here (unlike with bitwise ops, which are a mess), so I'll spare the reader parsing parentheses.

@mzient mzient merged commit 3062216 into NVIDIA:main May 16, 2024
6 checks passed
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