File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -414,6 +414,26 @@ def is_gpu_device(device=None):
414
414
return dev .has_aspect_gpu
415
415
416
416
417
+ def is_intel_numpy ():
418
+ """
419
+ Return True if Intel NumPy is used during testing.
420
+
421
+ The check is based on MKL backend name stored in Build Dependencies, where
422
+ in case of Intel Numpy there "mkl" is expected at the beginning of the name
423
+ for both BLAS and LAPACK (the full name is "mkl-dynamic-ilp64-iomp").
424
+
425
+ """
426
+
427
+ build_deps = numpy .show_config (mode = "dicts" )["Build Dependencies" ]
428
+ blas = build_deps ["blas" ]
429
+ lapack = build_deps ["lapack" ]
430
+
431
+ if numpy_version () < "2.0.0" :
432
+ # numpy 1.26.4 has LAPACK name equals to 'dep140030038112336'
433
+ return blas ["name" ].startswith ("mkl" )
434
+ return all (dep ["name" ].startswith ("mkl" ) for dep in [blas , lapack ])
435
+
436
+
417
437
def is_win_platform ():
418
438
"""
419
439
Return True if a test is running on Windows OS, False otherwise.
Original file line number Diff line number Diff line change 32
32
get_integer_float_dtypes ,
33
33
has_support_aspect16 ,
34
34
has_support_aspect64 ,
35
+ is_intel_numpy ,
35
36
numpy_version ,
36
37
)
37
38
from .third_party .cupy import testing
@@ -1751,11 +1752,11 @@ def test_zeros(self, dt):
1751
1752
1752
1753
result = dpnp .spacing (ia )
1753
1754
expected = numpy .spacing (a )
1754
- if numpy_version () < "2.0.0" :
1755
+ if is_intel_numpy () :
1755
1756
assert_allclose (result , expected )
1756
1757
else :
1757
- # numpy.spacing(-0.0) == numpy.spacing(0.0), i.e. NumPy returns
1758
- # positive value (looks as a bug in NumPy ), because for any other
1758
+ # numpy.spacing(-0.0) == numpy.spacing(0.0), i.e. the stock NumPy
1759
+ # returns positive value (looks as a bug), because for any other
1759
1760
# negative input the NumPy result will be also a negative value.
1760
1761
expected [1 ] *= - 1
1761
1762
assert_allclose (result , expected )
You can’t perform that action at this time.
0 commit comments