From e2d1917ae3cd43ba47a213dd629bcacf452a25e2 Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Mon, 26 Aug 2024 11:28:21 -0400 Subject: [PATCH 1/2] do not use custom, 2D separable kernels due to some known test failures - disable failing test cases for these internal customers now that they are disabled - if the test failures are resolved we can enable using these kernels on Windows again in the future --- .../cucim/skimage/_vendored/_ndimage_filters.py | 5 ++++- .../filters/tests/test_separable_filtering.py | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/python/cucim/src/cucim/skimage/_vendored/_ndimage_filters.py b/python/cucim/src/cucim/skimage/_vendored/_ndimage_filters.py index b7e2ab4a3..afd915ace 100644 --- a/python/cucim/src/cucim/skimage/_vendored/_ndimage_filters.py +++ b/python/cucim/src/cucim/skimage/_vendored/_ndimage_filters.py @@ -1,5 +1,6 @@ """A vendored subset of cupyx.scipy.ndimage._filters""" import math +import platform import warnings import cupy @@ -22,6 +23,8 @@ except ImportError: compile_errors = (ResourceLimitError,) +_is_not_windows = platform.system() != "Windows" + def correlate(input, weights, output=None, mode="reflect", cval=0.0, origin=0): """Multi-dimensional correlate. @@ -231,7 +234,7 @@ def _correlate_or_convolve1d( default_algorithm = False if algorithm is None: default_algorithm = True - if input.ndim == 2 and weights.size <= 256: + if input.ndim == 2 and weights.size <= 256 and _is_not_windows: algorithm = "shared_memory" else: algorithm = "elementwise" diff --git a/python/cucim/src/cucim/skimage/filters/tests/test_separable_filtering.py b/python/cucim/src/cucim/skimage/filters/tests/test_separable_filtering.py index 026b8c84b..186eb529d 100644 --- a/python/cucim/src/cucim/skimage/filters/tests/test_separable_filtering.py +++ b/python/cucim/src/cucim/skimage/filters/tests/test_separable_filtering.py @@ -1,3 +1,5 @@ +import platform + import cupy as cp import pytest @@ -227,6 +229,13 @@ def test_separable_image_shapes_and_modes(shape, axis, kernel_size, mode): ) +@pytest.mark.skipif( + platform.system() == "Windows", + reason=( + "custom separable kernels disabled on Windows until dtype-related " + "test failures can be resolved" + ), +) @pytest.mark.parametrize("axis", (0, 1)) @pytest.mark.parametrize("image_dtype", image_dtypes_tested) @pytest.mark.parametrize( @@ -246,6 +255,13 @@ def test_separable_image_and_kernel_dtypes(axis, image_dtype, kernel_dtype): ) +@pytest.mark.skipif( + platform.system() == "Windows", + reason=( + "custom separable kernels disabled on Windows until dtype-related " + "test failures can be resolved" + ), +) @pytest.mark.parametrize("axis", (0, 1)) @pytest.mark.parametrize("image_dtype", image_dtypes_tested) @pytest.mark.parametrize( From 6b95079c6a8f9c532ae3020a58b2aef7a1f043e3 Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Thu, 29 Aug 2024 06:45:57 -0400 Subject: [PATCH 2/2] Update python/cucim/src/cucim/skimage/_vendored/_ndimage_filters.py Co-authored-by: jakirkham --- python/cucim/src/cucim/skimage/_vendored/_ndimage_filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cucim/src/cucim/skimage/_vendored/_ndimage_filters.py b/python/cucim/src/cucim/skimage/_vendored/_ndimage_filters.py index afd915ace..e98fb3eb8 100644 --- a/python/cucim/src/cucim/skimage/_vendored/_ndimage_filters.py +++ b/python/cucim/src/cucim/skimage/_vendored/_ndimage_filters.py @@ -234,7 +234,7 @@ def _correlate_or_convolve1d( default_algorithm = False if algorithm is None: default_algorithm = True - if input.ndim == 2 and weights.size <= 256 and _is_not_windows: + if _is_not_windows and input.ndim == 2 and weights.size <= 256: algorithm = "shared_memory" else: algorithm = "elementwise"