[DO NOT MERGE] [CUDA12] Conditionally set device in device guard#91219
Closed
Aidyn-A wants to merge 28 commits intopytorch:masterfrom
Closed
[DO NOT MERGE] [CUDA12] Conditionally set device in device guard#91219Aidyn-A wants to merge 28 commits intopytorch:masterfrom
Aidyn-A wants to merge 28 commits intopytorch:masterfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/91219
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 FailuresAs of commit 790d2d9: NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Do the logic if CUDA_VERSION >= 12000
5 tasks
Collaborator
Author
|
cc @ngimel |
Collaborator
32819e7 to
f2eaff9
Compare
Collaborator
Author
|
The usage of |
Collaborator
|
looks like c10 bzl rule is still setting cc'ing @vors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CUDA 12 introduces behavioral changes in
cudaSetDevice. In the old version it would just set the device to be used for kernel launches and memory allocations without creating a CUDA context. Now, in CUDA 12, every time cudaSetDevice is called for the first time it creates a CUDA context. See issue #91122.This PR introduces a workaround for cases like:
in which the primary context would be allocated on devices 0 and 1 because device 0 the default one.
The real danger would have happened in distributed jobs where all ranks set device to 0 in the destructor of CUDA guard creating
nproc_per_nodeCUDA contexts.