-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Mark CV-CUDA tests with needs_cuda #9305
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: main
Are you sure you want to change the base?
Conversation
…s-cuda-marks update my branch.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9305
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (2 Unrelated Failures)As of commit 8a2c4c7 with merge base 96e7797 ( BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| marks=( | ||
| pytest.mark.skipif(not CVCUDA_AVAILABLE, reason="CVCUDA is not available"), | ||
| pytest.mark.needs_cuda, | ||
| ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to use these two marks on every single CV-CUDA test, so instead of duplicating this everywhere, let's simply define a global mark on top of the file as
CV_CUDA_TEST = (
pytest.mark.skipif(not CVCUDA_AVAILABLE, reason="CVCUDA is not available"),
pytest.mark.needs_cuda,
)and then use marks=CV_CUDA_TEST for all of these.
Let's also update the previous test classes from @AntoineSimoulin:
vision/test/test_transforms_v2.py
Lines 6859 to 6861 in 96e7797
| @pytest.mark.skipif(not CVCUDA_AVAILABLE, reason="test requires CVCUDA") | |
| @needs_cuda | |
| class TestCVDUDAToTensor: |
and
vision/test/test_transforms_v2.py
Lines 6797 to 6799 in 96e7797
| @pytest.mark.skipif(not CVCUDA_AVAILABLE, reason="test requires CVCUDA") | |
| @needs_cuda | |
| class TestToCVCUDATensor: |
to use this mark as well.
I suspect we might be able to also remove the CVCUDA_AVAILABLE global variable now (not sure).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can create a @needs_cvcuda decorator (similar to @needs_cuda)? We will also have to modify the pytest_configure function to add this decorator. This way we can identify easily tests requiring cvcuda?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This significantly reduces the boilerplate!
I have gone ahead and updated the branch implementing CV-CUDA for the ToDtype transform and I will preemptively update the others as well.
As a note, I defined CV_CUDA_TEST as a list so we can use it with the pytestmark class attribute for TestCVCUDAToTensor and TestToCVCUDATensor. Example here
Mark CV-CUDA tests with needs_cuda by:
marks=( pytest.mark.skipif(not CVCUDA_AVAILABLE, reason="CVCUDA is not available"), pytest.mark.needs_cuda, ),