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

Set affinity by device UUID. #5566

Merged
merged 3 commits into from
Jul 18, 2024
Merged

Conversation

mzient
Copy link
Contributor

@mzient mzient commented Jul 16, 2024

Category:

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

Description:

NVML and CUDA runtime use different device indices. Device UUID is a reliable way of establishing device identity.

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

@mzient mzient closed this Jul 16, 2024
@mzient mzient reopened this Jul 16, 2024
Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [16649134]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [16649134]: BUILD FAILED

@mzient mzient marked this pull request as draft July 17, 2024 10:34
@mzient mzient marked this pull request as ready for review July 17, 2024 10:47
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [16669228]: BUILD STARTED

return dev;
}

void GetNVMLAffinityMask(cpu_set_t *mask, size_t num_cpus) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function is moved here from the header.

size_t cpu_set_size = (num_cpus + 63) / 64;
std::vector<unsigned long> nvml_mask_container(cpu_set_size); // NOLINT(runtime/int)
auto * nvml_mask = nvml_mask_container.data();
nvmlDevice_t device = nvmlGetDeviceHandleForCUDA(device_idx);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the important line.

CPU_AND(mask, &nvml_set, &current_set);
}

void SetCPUAffinity(int core) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved here from the header without any changes.

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

CI MESSAGE: [16669418]: BUILD STARTED

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

CI MESSAGE: [16671324]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [16671324]: BUILD PASSED

@mzient mzient merged commit 127015f into NVIDIA:main Jul 18, 2024
6 checks passed
This pull request was closed.
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