CUDAAccelerator.setup_device: fix unrelated device init by matmul precision check#21726
Conversation
…cision check Without this fix, CUDAAccelerator.setup_device may initialize an unrelated device, via - _check_cuda_matmul_precision - _is_ampere_or_later - torch.cuda.get_device_capability - torch.cuda.get_device_properties - torch.cuda._lazy_init
justusschock
left a comment
There was a problem hiding this comment.
Great! Is there a way for us to test this?
If you mean unit tests, I can see a simple test monkeypatching |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #21726 +/- ##
=======================================
Coverage 87% 87%
=======================================
Files 270 270
Lines 23975 23975
=======================================
Hits 20750 20750
Misses 3225 3225 |
As long it is local to the specific test and doesn't have side-effects to other tests, i think that sounds like a good approach |
Without this fix, CUDAAccelerator.setup_device may initialize an unrelated device, via
What does this PR do?
Fixes #21725
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:
Reviewer checklist