From 77526c44e4d654c55fa6c204e869546743b49792 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 22 Jan 2025 03:04:37 -0800 Subject: [PATCH 1/6] Add no cover for Windows-specific code --- dpnp/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpnp/__init__.py b/dpnp/__init__.py index b9f7ff83471..724eef50edb 100644 --- a/dpnp/__init__.py +++ b/dpnp/__init__.py @@ -42,7 +42,7 @@ # are not installed under any of default paths where Python is searching. from platform import system -if system() == "Windows": +if system() == "Windows": # pragma: no cover if hasattr(os, "add_dll_directory"): os.add_dll_directory(mypath) os.add_dll_directory(dpctlpath) From 9f492fed1ea548bdfe876915581cb4e27d73cd4f Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 22 Jan 2025 03:28:16 -0800 Subject: [PATCH 2/6] Add no cover for _align_dtypes() --- dpnp/dpnp_iface_histograms.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dpnp/dpnp_iface_histograms.py b/dpnp/dpnp_iface_histograms.py index adf44a5d535..628beca8939 100644 --- a/dpnp/dpnp_iface_histograms.py +++ b/dpnp/dpnp_iface_histograms.py @@ -91,7 +91,7 @@ def _align_dtypes(a_dtype, bins_dtype, ntype, supported_types, device): return sample_type, hist_type # should not happen - return None, None + return None, None # pragma: no cover def _ravel_check_a_and_weights(a, weights): @@ -392,7 +392,7 @@ def bincount(x, weights=None, minlength=None): x.dtype, x.dtype, ntype, supported_types, device ) - if x_casted_dtype is None or ntype_casted is None: + if x_casted_dtype is None or ntype_casted is None: # pragma: no cover raise ValueError( f"function '{bincount}' does not support input types " f"({x.dtype}, {ntype}), " @@ -607,7 +607,7 @@ def histogram(a, bins=10, range=None, density=None, weights=None): a.dtype, bin_edges.dtype, ntype, supported_types, device ) - if a_bin_dtype is None or hist_dtype is None: + if a_bin_dtype is None or hist_dtype is None: # pragma: no cover raise ValueError( f"function '{histogram}' does not support input types " f"({a.dtype}, {bin_edges.dtype}, {ntype}), " From b2b883ce703b6d3bf2dd4d664d328ce8e7be5446 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 22 Jan 2025 03:39:34 -0800 Subject: [PATCH 3/6] Remove unused fixture --- dpnp/tests/third_party/cupy/indexing_tests/test_insert.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dpnp/tests/third_party/cupy/indexing_tests/test_insert.py b/dpnp/tests/third_party/cupy/indexing_tests/test_insert.py index f3edc5cadc8..7399343e7e5 100644 --- a/dpnp/tests/third_party/cupy/indexing_tests/test_insert.py +++ b/dpnp/tests/third_party/cupy/indexing_tests/test_insert.py @@ -205,7 +205,6 @@ def test_putmask(self, xp, dtype): return a -@pytest.mark.usefixtures("allow_fall_back_on_numpy") class TestPutmask(unittest.TestCase): @testing.numpy_cupy_array_equal() From 3c1c2d346ffea4b8861d28f0ac87e5f913dd1d9e Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 22 Jan 2025 03:50:24 -0800 Subject: [PATCH 4/6] Add no cover for _count_reduce_items() --- dpnp/dpnp_iface_statistics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpnp/dpnp_iface_statistics.py b/dpnp/dpnp_iface_statistics.py index aa971ec257c..1ede262e388 100644 --- a/dpnp/dpnp_iface_statistics.py +++ b/dpnp/dpnp_iface_statistics.py @@ -108,7 +108,7 @@ def _count_reduce_items(arr, axis, where=True): for ax in axis: items *= arr.shape[normalize_axis_index(ax, arr.ndim)] items = dpnp.intp(items) - else: + else: # pragma: no cover raise NotImplementedError( "where keyword argument is only supported with its default value." ) From 26753706c55c062602eff29429796ae6d8d79d09 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 22 Jan 2025 03:54:07 -0800 Subject: [PATCH 5/6] Add no cover for to_supported_dtypes() --- dpnp/dpnp_iface_statistics.py | 2 +- dpnp/dpnp_utils/dpnp_utils_common.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dpnp/dpnp_iface_statistics.py b/dpnp/dpnp_iface_statistics.py index 1ede262e388..49a87a99c20 100644 --- a/dpnp/dpnp_iface_statistics.py +++ b/dpnp/dpnp_iface_statistics.py @@ -576,7 +576,7 @@ def correlate(a, v, mode="valid"): rdtype = result_type_for_device([a.dtype, v.dtype], device) supported_dtype = to_supported_dtypes(rdtype, supported_types, device) - if supported_dtype is None: + if supported_dtype is None: # pragma: no cover raise ValueError( f"function does not support input types " f"({a.dtype.name}, {v.dtype.name}), " diff --git a/dpnp/dpnp_utils/dpnp_utils_common.py b/dpnp/dpnp_utils/dpnp_utils_common.py index 3cc2ebf4d31..087d916d0e3 100644 --- a/dpnp/dpnp_utils/dpnp_utils_common.py +++ b/dpnp/dpnp_utils/dpnp_utils_common.py @@ -78,4 +78,4 @@ def is_castable(dtype, stype): ): return stypes - return None + return None # pragma: no cover From f52bbbef9d7867fd5197c61b2387138ddaa35069 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 22 Jan 2025 04:16:58 -0800 Subject: [PATCH 6/6] Add no cover for dpnp.is_cuda_backend() --- dpnp/dpnp_iface.py | 2 +- dpnp/dpnp_iface_indexing.py | 2 +- dpnp/dpnp_iface_libmath.py | 2 +- dpnp/dpnp_iface_mathematical.py | 2 +- dpnp/dpnp_iface_sorting.py | 2 +- dpnp/linalg/dpnp_utils_linalg.py | 4 +-- dpnp/random/dpnp_iface_random.py | 62 ++++++++++++++++---------------- dpnp/random/dpnp_random_state.py | 6 ++-- 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/dpnp/dpnp_iface.py b/dpnp/dpnp_iface.py index a852d1c7fd8..d9756c316c6 100644 --- a/dpnp/dpnp_iface.py +++ b/dpnp/dpnp_iface.py @@ -712,7 +712,7 @@ def is_cuda_backend(obj=None): if ( sycl_device is not None and sycl_device.backend == dpctl.backend_type.cuda - ): + ): # pragma: no cover return True return False diff --git a/dpnp/dpnp_iface_indexing.py b/dpnp/dpnp_iface_indexing.py index 85547433a8f..2bc7f122320 100644 --- a/dpnp/dpnp_iface_indexing.py +++ b/dpnp/dpnp_iface_indexing.py @@ -138,7 +138,7 @@ def choose(x1, choices, out=None, mode="raise"): ) if x1_desc: - if dpnp.is_cuda_backend(x1_desc.get_array()): + if dpnp.is_cuda_backend(x1_desc.get_array()): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) diff --git a/dpnp/dpnp_iface_libmath.py b/dpnp/dpnp_iface_libmath.py index 9bb6328cb19..eaf6c5676a4 100644 --- a/dpnp/dpnp_iface_libmath.py +++ b/dpnp/dpnp_iface_libmath.py @@ -82,7 +82,7 @@ def erf(in_array1): in_array1, copy_when_strides=False, copy_when_nondefault_queue=False ) if x1_desc: - if dpnp.is_cuda_backend(x1_desc.get_array()): + if dpnp.is_cuda_backend(x1_desc.get_array()): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) diff --git a/dpnp/dpnp_iface_mathematical.py b/dpnp/dpnp_iface_mathematical.py index 25d8c7e01c8..cf3d14b98de 100644 --- a/dpnp/dpnp_iface_mathematical.py +++ b/dpnp/dpnp_iface_mathematical.py @@ -2946,7 +2946,7 @@ def modf(x1, **kwargs): x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False) if x1_desc: - if dpnp.is_cuda_backend(x1_desc.get_array()): + if dpnp.is_cuda_backend(x1_desc.get_array()): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) diff --git a/dpnp/dpnp_iface_sorting.py b/dpnp/dpnp_iface_sorting.py index 22a1f447da4..6700dc8ffb8 100644 --- a/dpnp/dpnp_iface_sorting.py +++ b/dpnp/dpnp_iface_sorting.py @@ -215,7 +215,7 @@ def partition(x1, kth, axis=-1, kind="introselect", order=None): x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False) if x1_desc: - if dpnp.is_cuda_backend(x1_desc.get_array()): + if dpnp.is_cuda_backend(x1_desc.get_array()): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) diff --git a/dpnp/linalg/dpnp_utils_linalg.py b/dpnp/linalg/dpnp_utils_linalg.py index fda4af36f79..97ff26a7043 100644 --- a/dpnp/linalg/dpnp_utils_linalg.py +++ b/dpnp/linalg/dpnp_utils_linalg.py @@ -401,7 +401,7 @@ def _batched_qr(a, mode="reduced"): # w/a to avoid raice conditional on CUDA during multiple runs # TODO: Remove it ones the OneMath issue is resolved # https://github.com/uxlfoundation/oneMath/issues/626 - if dpnp.is_cuda_backend(a_sycl_queue): + if dpnp.is_cuda_backend(a_sycl_queue): # pragma: no cover ht_ev.wait() else: _manager.add_event_pair(ht_ev, geqrf_ev) @@ -2479,7 +2479,7 @@ def dpnp_qr(a, mode="reduced"): # w/a to avoid raice conditional on CUDA during multiple runs # TODO: Remove it ones the OneMath issue is resolved # https://github.com/uxlfoundation/oneMath/issues/626 - if dpnp.is_cuda_backend(a_sycl_queue): + if dpnp.is_cuda_backend(a_sycl_queue): # pragma: no cover ht_ev.wait() else: _manager.add_event_pair(ht_ev, geqrf_ev) diff --git a/dpnp/random/dpnp_iface_random.py b/dpnp/random/dpnp_iface_random.py index 74c7d378b19..d20b4f64c2a 100644 --- a/dpnp/random/dpnp_iface_random.py +++ b/dpnp/random/dpnp_iface_random.py @@ -140,7 +140,7 @@ def beta(a, b, size=None): """ if not use_origin_backend(a): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -191,7 +191,7 @@ def binomial(n, p, size=None): """ if not use_origin_backend(n): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -248,7 +248,7 @@ def chisquare(df, size=None): """ if not use_origin_backend(df): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -321,7 +321,7 @@ def exponential(scale=1.0, size=None): """ if not use_origin_backend(scale): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -358,7 +358,7 @@ def f(dfnum, dfden, size=None): """ if not use_origin_backend(dfnum): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -401,7 +401,7 @@ def gamma(shape, scale=1.0, size=None): """ if not use_origin_backend(scale): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -444,7 +444,7 @@ def geometric(p, size=None): """ if not use_origin_backend(p): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -483,7 +483,7 @@ def gumbel(loc=0.0, scale=1.0, size=None): """ if not use_origin_backend(loc): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -526,7 +526,7 @@ def hypergeometric(ngood, nbad, nsample, size=None): """ if not use_origin_backend(ngood): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -579,7 +579,7 @@ def laplace(loc=0.0, scale=1.0, size=None): """ if not use_origin_backend(loc): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -618,7 +618,7 @@ def logistic(loc=0.0, scale=1.0, size=None): """ if not use_origin_backend(loc): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -664,7 +664,7 @@ def lognormal(mean=0.0, sigma=1.0, size=None): """ if not use_origin_backend(mean): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -726,7 +726,7 @@ def multinomial(n, pvals, size=None): pvals_sum = sum(pvals) pvals_desc = dpnp.get_dpnp_descriptor(dpnp.array(pvals)) d = len(pvals) - if dpnp.is_cuda_backend(pvals_desc.get_array()): + if dpnp.is_cuda_backend(pvals_desc.get_array()): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -780,7 +780,7 @@ def multivariate_normal(mean, cov, size=None, check_valid="warn", tol=1e-8): cov_ = dpnp.get_dpnp_descriptor(dpnp.array(cov, dtype=dpnp.float64)) if dpnp.is_cuda_backend(mean_.get_array()) or dpnp.is_cuda_backend( cov_.get_array() - ): + ): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -839,7 +839,7 @@ def negative_binomial(n, p, size=None): """ if not use_origin_backend(n): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -929,7 +929,7 @@ def noncentral_chisquare(df, nonc, size=None): """ if not use_origin_backend(df): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -988,7 +988,7 @@ def pareto(a, size=None): """ if not use_origin_backend(a): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -1062,7 +1062,7 @@ def poisson(lam=1.0, size=None): """ if not use_origin_backend(lam): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -1102,7 +1102,7 @@ def power(a, size=None): """ if not use_origin_backend(a): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -1524,7 +1524,7 @@ def rayleigh(scale=1.0, size=None): """ if not use_origin_backend(scale): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -1606,7 +1606,7 @@ def shuffle(x1): x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_strides=False) if x1_desc: - if dpnp.is_cuda_backend(x1_desc.get_array()): + if dpnp.is_cuda_backend(x1_desc.get_array()): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -1655,7 +1655,7 @@ def seed(seed=None, device=None, sycl_queue=None): ) if not use_origin_backend(seed): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -1700,7 +1700,7 @@ def standard_cauchy(size=None): """ if not use_origin_backend(size): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -1729,7 +1729,7 @@ def standard_exponential(size=None): """ if not use_origin_backend(size): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -1761,7 +1761,7 @@ def standard_gamma(shape, size=None): """ if not use_origin_backend(shape): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -1844,7 +1844,7 @@ def standard_t(df, size=None): """ if not use_origin_backend(df): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -1885,7 +1885,7 @@ def triangular(left, mode, right, size=None): """ if not use_origin_backend(left): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -1998,7 +1998,7 @@ def vonmises(mu, kappa, size=None): """ if not use_origin_backend(mu): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -2039,7 +2039,7 @@ def wald(mean, scale, size=None): """ if not use_origin_backend(mean): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -2080,7 +2080,7 @@ def weibull(a, size=None): """ if not use_origin_backend(a): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -2117,7 +2117,7 @@ def zipf(a, size=None): """ if not use_origin_backend(a): - if dpnp.is_cuda_backend(): + if dpnp.is_cuda_backend(): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) diff --git a/dpnp/random/dpnp_random_state.py b/dpnp/random/dpnp_random_state.py index 7cd6e05c81f..774095d518e 100644 --- a/dpnp/random/dpnp_random_state.py +++ b/dpnp/random/dpnp_random_state.py @@ -235,7 +235,7 @@ def normal( """ if not use_origin_backend(): - if dpnp.is_cuda_backend(self): + if dpnp.is_cuda_backend(self): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -369,7 +369,7 @@ def randint(self, low, high=None, size=None, dtype=int, usm_type="device"): """ if not use_origin_backend(low): - if dpnp.is_cuda_backend(self): + if dpnp.is_cuda_backend(self): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" ) @@ -598,7 +598,7 @@ def uniform( """ if not use_origin_backend(): - if dpnp.is_cuda_backend(self): + if dpnp.is_cuda_backend(self): # pragma: no cover raise NotImplementedError( "Running on CUDA is currently not supported" )