-
Notifications
You must be signed in to change notification settings - Fork 1.5k
8587 test erros on pytorch release 2508 on series 50 #8770
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
base: dev
Are you sure you want to change the base?
Changes from all commits
ba56a6d
5216b7a
eacd783
c64825f
66b6c17
19cab57
09c2cd9
7cd0607
3fd7546
4f6df07
36e2623
356956a
17b9910
8de64af
7c2ddb6
cfe5524
1dec216
ec8bf1f
4b5bf1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,83 @@ | ||||||||||||||
| # Copyright (c) MONAI Consortium | ||||||||||||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||
| # you may not use this file except in compliance with the License. | ||||||||||||||
| # You may obtain a copy of the License at | ||||||||||||||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||
| # Unless required by applicable law or agreed to in writing, software | ||||||||||||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||
| # See the License for the specific language governing permissions and | ||||||||||||||
| # limitations under the License. | ||||||||||||||
|
|
||||||||||||||
| """Test GPU support detection and fallback paths for spatial transforms.""" | ||||||||||||||
|
|
||||||||||||||
| from __future__ import annotations | ||||||||||||||
|
|
||||||||||||||
| import unittest | ||||||||||||||
|
|
||||||||||||||
| import torch | ||||||||||||||
|
|
||||||||||||||
| from monai.transforms.spatial.functional import _compiled_unsupported | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| class TestCompiledUnsupported(unittest.TestCase): | ||||||||||||||
| """Test _compiled_unsupported device detection.""" | ||||||||||||||
|
|
||||||||||||||
| def test_cpu_device_always_supported(self): | ||||||||||||||
| """CPU devices should never be marked unsupported.""" | ||||||||||||||
| device = torch.device("cpu") | ||||||||||||||
| self.assertFalse(_compiled_unsupported(device)) | ||||||||||||||
|
|
||||||||||||||
| def test_non_cuda_device_always_supported(self): | ||||||||||||||
| """Non-CUDA devices should always be supported.""" | ||||||||||||||
| device = torch.device("cpu") | ||||||||||||||
| self.assertFalse(_compiled_unsupported(device)) | ||||||||||||||
|
|
||||||||||||||
| @unittest.skipIf(not torch.cuda.is_available(), reason="CUDA not available") | ||||||||||||||
| def test_cuda_device_detection(self): | ||||||||||||||
| """Verify CUDA compute capability detection.""" | ||||||||||||||
| device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") | ||||||||||||||
| if device.type == "cuda": | ||||||||||||||
| cc_major = torch.cuda.get_device_properties(device).major | ||||||||||||||
| unsupported = _compiled_unsupported(device) | ||||||||||||||
| # Device is unsupported if cc_major >= 12 | ||||||||||||||
| if cc_major >= 12: | ||||||||||||||
| self.assertTrue(unsupported) | ||||||||||||||
| else: | ||||||||||||||
| self.assertFalse(unsupported) | ||||||||||||||
|
|
||||||||||||||
| def test_compiled_unsupported_return_type(self): | ||||||||||||||
| """Verify return type is bool.""" | ||||||||||||||
| device = torch.device("cpu") | ||||||||||||||
| result = _compiled_unsupported(device) | ||||||||||||||
| self.assertIsInstance(result, bool) | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| class TestResampleFallback(unittest.TestCase): | ||||||||||||||
| """Test Resample fallback behavior on unsupported devices.""" | ||||||||||||||
|
|
||||||||||||||
| @unittest.skipIf(not torch.cuda.is_available(), reason="CUDA not available") | ||||||||||||||
| def test_resample_compilation_flag_respected(self): | ||||||||||||||
| """Verify Resample respects _compiled_unsupported check.""" | ||||||||||||||
| # This would require internal inspection or output verification | ||||||||||||||
| # Could test with mock device properties or actual Blackwell GPU | ||||||||||||||
|
Comment on lines
+59
to
+63
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty test method provides no coverage.
♻️ Option: Skip explicitly with reason `@unittest.skipIf`(not torch.cuda.is_available(), reason="CUDA not available")
+ `@unittest.skip`("TODO: implement with mock device properties or Blackwell GPU")
def test_resample_compilation_flag_respected(self):
"""Verify Resample respects _compiled_unsupported check."""
- # This would require internal inspection or output verification
- # Could test with mock device properties or actual Blackwell GPU
+ pass🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| def test_compiled_unsupported_logic(self): | ||||||||||||||
| """Test that unsupported devices are correctly detected.""" | ||||||||||||||
| # CPU should be supported | ||||||||||||||
| cpu_device = torch.device("cpu") | ||||||||||||||
| self.assertFalse(_compiled_unsupported(cpu_device)) | ||||||||||||||
|
|
||||||||||||||
| # Verify logic: return True if CUDA and cc_major >= 12 | ||||||||||||||
| cuda_device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") | ||||||||||||||
| if cuda_device.type == "cuda": | ||||||||||||||
| cc_major = torch.cuda.get_device_properties(cuda_device).major | ||||||||||||||
| expected = cc_major >= 12 | ||||||||||||||
| actual = _compiled_unsupported(cuda_device) | ||||||||||||||
| self.assertEqual(actual, expected) | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| if __name__ == "__main__": | ||||||||||||||
| unittest.main() | ||||||||||||||
| if __name__ == "__main__": | ||||||||||||||
| unittest.main() | ||||||||||||||
|
Comment on lines
+80
to
+83
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicated Copy-paste error—remove the duplicate. 🐛 Fix if __name__ == "__main__":
unittest.main()
-if __name__ == "__main__":
- unittest.main()📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.