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):
414414 return dev .has_aspect_gpu
415415
416416
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+
417437def is_win_platform ():
418438 """
419439 Return True if a test is running on Windows OS, False otherwise.
Original file line number Diff line number Diff line change 3232 get_integer_float_dtypes ,
3333 has_support_aspect16 ,
3434 has_support_aspect64 ,
35+ is_intel_numpy ,
3536 numpy_version ,
3637)
3738from .third_party .cupy import testing
@@ -1751,11 +1752,11 @@ def test_zeros(self, dt):
17511752
17521753 result = dpnp .spacing (ia )
17531754 expected = numpy .spacing (a )
1754- if numpy_version () < "2.0.0" :
1755+ if is_intel_numpy () :
17551756 assert_allclose (result , expected )
17561757 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
17591760 # negative input the NumPy result will be also a negative value.
17601761 expected [1 ] *= - 1
17611762 assert_allclose (result , expected )
You can’t perform that action at this time.
0 commit comments