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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dali/pipeline/util/thread_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ ThreadPool::ThreadPool(int num_thread, int device_id, bool set_affinity, const c
, active_threads_(0) {
DALI_ENFORCE(num_thread > 0, "Thread pool must have non-zero size");
#if NVML_ENABLED
// 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.

nvml_handle_ = nvml::NvmlInstance::CreateNvmlInstance();
}
#endif
Expand Down
Loading