Repository navigation
Description
Describe the issue:
I just installed numpy 2.3.2 on top of python 3.11.11, compiled from source with intel oneapi 2024.2.1 compilers with
CC=icx CXX=icpx CFLAGS='-fveclib=none -fp-model=strict -march=skylake-avx512' FFLAGS='-fp-model=strict -march=skylake-avx512' CXXFLAGS='-fp-model=strict -march=skylake-avx512' python -m pip install --no-build-isolation -v . -Cbuild-dir=build -Csetup-args=-Dallow-noblas=false -Csetup-args=-Dblas-order=mkl -Csetup-args=-Dlapack-order=mkl -Csetup-args=-Dblas=mkl-dynamic-lp64-iomp -Csetup-args=-Dlapack=mkl-dynamic-lp64-iomp
Numpy test fails with the errors pasted below. This reminds me of the assertion errors I reported in #27111, which I just let be as recommended by others here. However, I'm not sure if the errors I see now can also be just ignored or they point to something more serious.
Reproduce the code example:
python -c 'import numpy; numpy.test()'Error message:
_________________________________________________________________ TestFloatExceptions.test_floating_exceptions[G] __________________________________________________________________
self = <test_numeric.TestFloatExceptions object at 0x1548c579ded0>, typecode = 'G'
@pytest.mark.skipif(IS_WASM, reason="no wasm fp exception support")
@pytest.mark.parametrize("typecode", np.typecodes["AllFloat"])
def test_floating_exceptions(self, typecode):
if 'bsd' in sys.platform and typecode in 'gG':
pytest.skip(reason="Fallback impl for (c)longdouble may not raise "
"FPE errors as expected on BSD OSes, "
"see gh-24876, gh-23379")
# Test basic arithmetic function errors
with np.errstate(all='raise'):
ftype = obj2sctype(typecode)
if np.dtype(ftype).kind == 'f':
# Get some extreme values for the type
fi = np.finfo(ftype)
ft_tiny = fi._machar.tiny
ft_max = fi.max
ft_eps = fi.eps
underflow = 'underflow'
divbyzero = 'divide by zero'
else:
# 'c', complex, corresponding real dtype
rtype = type(ftype(0).real)
fi = np.finfo(rtype)
ft_tiny = ftype(fi._machar.tiny)
ft_max = ftype(fi.max)
ft_eps = ftype(fi.eps)
# The complex types raise different exceptions
underflow = ''
divbyzero = ''
overflow = 'overflow'
invalid = 'invalid'
# The value of tiny for double double is NaN, so we need to
# pass the assert
if not np.isnan(ft_tiny):
self.assert_raises_fpe(underflow,
lambda a, b: a / b, ft_tiny, ft_max)
self.assert_raises_fpe(underflow,
lambda a, b: a * b, ft_tiny, ft_tiny)
self.assert_raises_fpe(overflow,
lambda a, b: a * b, ft_max, ftype(2))
self.assert_raises_fpe(overflow,
lambda a, b: a / b, ft_max, ftype(0.5))
self.assert_raises_fpe(overflow,
lambda a, b: a + b, ft_max, ft_max * ft_eps)
self.assert_raises_fpe(overflow,
lambda a, b: a - b, -ft_max, ft_max * ft_eps)
> self.assert_raises_fpe(overflow,
np.power, ftype(2), ftype(2**fi.nexp))
divbyzero = ''
fi = finfo(resolution=1e-18, min=-1.189731495357231765e+4932, max=1.189731495357231765e+4932, dtype=float128)
ft_eps = np.clongdouble('1.084202172485504434e-19+0j')
ft_max = np.clongdouble('1.189731495357231765e+4932+0j')
ft_tiny = np.clongdouble('3.3621031431120935063e-4932+0j')
ftype = <class 'numpy.clongdouble'>
invalid = 'invalid'
overflow = 'overflow'
rtype = <class 'numpy.longdouble'>
self = <test_numeric.TestFloatExceptions object at 0x1548c579ded0>
typecode = 'G'
underflow = ''
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_numeric.py:1045:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_numeric.TestFloatExceptions object at 0x1548c579ded0>, fpeerr = 'overflow', flop = <ufunc 'power'>, x = np.clongdouble('2+0j'), y = np.clongdouble('32768+0j')
def assert_raises_fpe(self, fpeerr, flop, x, y):
ftype = type(x)
try:
flop(x, y)
> assert_(False,
f"Type {ftype} did not raise fpe error '{fpeerr}'.")
E AssertionError: Type <class 'numpy.clongdouble'> did not raise fpe error 'overflow'.
flop = <ufunc 'power'>
fpeerr = 'overflow'
ftype = <class 'numpy.clongdouble'>
self = <test_numeric.TestFloatExceptions object at 0x1548c579ded0>
x = np.clongdouble('2+0j')
y = np.clongdouble('32768+0j')
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_numeric.py:979: AssertionError
____________________________________________________________________ TestRemainder.test_float_divmod_errors[d] _____________________________________________________________________
self = <test_umath.TestRemainder object at 0x1548c324e110>, dtype = 'd'
@pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm")
@pytest.mark.xfail(sys.platform.startswith("darwin"),
reason="MacOS seems to not give the correct 'invalid' warning for "
"`fmod`. Hopefully, others always do.")
@pytest.mark.parametrize('dtype', np.typecodes['Float'])
def test_float_divmod_errors(self, dtype):
# Check valid errors raised for divmod and remainder
fzero = np.array(0.0, dtype=dtype)
fone = np.array(1.0, dtype=dtype)
finf = np.array(np.inf, dtype=dtype)
fnan = np.array(np.nan, dtype=dtype)
# since divmod is combination of both remainder and divide
# ops it will set both dividebyzero and invalid flags
with np.errstate(divide='raise', invalid='ignore'):
assert_raises(FloatingPointError, np.divmod, fone, fzero)
with np.errstate(divide='ignore', invalid='raise'):
assert_raises(FloatingPointError, np.divmod, fone, fzero)
with np.errstate(invalid='raise'):
assert_raises(FloatingPointError, np.divmod, fzero, fzero)
with np.errstate(invalid='raise'):
> assert_raises(FloatingPointError, np.divmod, finf, finf)
dtype = 'd'
finf = array(inf)
fnan = array(nan)
fone = array(1.)
fzero = array(0.)
self = <test_umath.TestRemainder object at 0x1548c324e110>
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath.py:813:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../python/3.11.11/lib/python3.11/unittest/case.py:766: in assertRaises
return context.handle('assertRaises', args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
args = (<ufunc 'divmod'>, array(inf), array(inf))
context = None
expected_exception = <class 'FloatingPointError'>
kwargs = {}
self = <numpy.testing._private.utils._Dummy testMethod=nop>
../python/3.11.11/lib/python3.11/unittest/case.py:236: in handle
with self:
args = [array(inf), array(inf)]
callable_obj = <ufunc 'divmod'>
kwargs = {}
name = 'assertRaises'
self = None
../python/3.11.11/lib/python3.11/unittest/case.py:259: in __exit__
self._raiseFailure("{} not raised by {}".format(exc_name,
exc_name = 'FloatingPointError'
exc_type = None
exc_value = None
self = <unittest.case._AssertRaisesContext object at 0x1548b28e5a50>
tb = None
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <unittest.case._AssertRaisesContext object at 0x1548b28e5a50>, standardMsg = 'FloatingPointError not raised by divmod'
def _raiseFailure(self, standardMsg):
msg = self.test_case._formatMessage(self.msg, standardMsg)
> raise self.test_case.failureException(msg)
E AssertionError: FloatingPointError not raised by divmod
msg = 'FloatingPointError not raised by divmod'
self = <unittest.case._AssertRaisesContext object at 0x1548b28e5a50>
standardMsg = 'FloatingPointError not raised by divmod'
../python/3.11.11/lib/python3.11/unittest/case.py:199: AssertionError
____________________________________________________________________ TestRemainder.test_float_divmod_errors[g] _____________________________________________________________________
self = <test_umath.TestRemainder object at 0x1548c324df50>, dtype = 'g'
@pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm")
@pytest.mark.xfail(sys.platform.startswith("darwin"),
reason="MacOS seems to not give the correct 'invalid' warning for "
"`fmod`. Hopefully, others always do.")
@pytest.mark.parametrize('dtype', np.typecodes['Float'])
def test_float_divmod_errors(self, dtype):
# Check valid errors raised for divmod and remainder
fzero = np.array(0.0, dtype=dtype)
fone = np.array(1.0, dtype=dtype)
finf = np.array(np.inf, dtype=dtype)
fnan = np.array(np.nan, dtype=dtype)
# since divmod is combination of both remainder and divide
# ops it will set both dividebyzero and invalid flags
with np.errstate(divide='raise', invalid='ignore'):
assert_raises(FloatingPointError, np.divmod, fone, fzero)
with np.errstate(divide='ignore', invalid='raise'):
> assert_raises(FloatingPointError, np.divmod, fone, fzero)
dtype = 'g'
finf = array(inf, dtype=float128)
fnan = array(nan, dtype=float128)
fone = array(1., dtype=float128)
fzero = array(0., dtype=float128)
self = <test_umath.TestRemainder object at 0x1548c324df50>
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath.py:809:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../python/3.11.11/lib/python3.11/unittest/case.py:766: in assertRaises
return context.handle('assertRaises', args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
args = (<ufunc 'divmod'>, array(1., dtype=float128), array(0., dtype=float128))
context = None
expected_exception = <class 'FloatingPointError'>
kwargs = {}
self = <numpy.testing._private.utils._Dummy testMethod=nop>
../python/3.11.11/lib/python3.11/unittest/case.py:236: in handle
with self:
args = [array(1., dtype=float128), array(0., dtype=float128)]
callable_obj = <ufunc 'divmod'>
kwargs = {}
name = 'assertRaises'
self = None
../python/3.11.11/lib/python3.11/unittest/case.py:259: in __exit__
self._raiseFailure("{} not raised by {}".format(exc_name,
exc_name = 'FloatingPointError'
exc_type = None
exc_value = None
self = <unittest.case._AssertRaisesContext object at 0x1548b142b0d0>
tb = None
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <unittest.case._AssertRaisesContext object at 0x1548b142b0d0>, standardMsg = 'FloatingPointError not raised by divmod'
def _raiseFailure(self, standardMsg):
msg = self.test_case._formatMessage(self.msg, standardMsg)
> raise self.test_case.failureException(msg)
E AssertionError: FloatingPointError not raised by divmod
msg = 'FloatingPointError not raised by divmod'
self = <unittest.case._AssertRaisesContext object at 0x1548b142b0d0>
standardMsg = 'FloatingPointError not raised by divmod'
../python/3.11.11/lib/python3.11/unittest/case.py:199: AssertionError
________________________________________________________________ TestRemainder.test_float_remainder_errors[fmod-e] _________________________________________________________________
self = <test_umath.TestRemainder object at 0x1548c324c0d0>, dtype = 'e', fn = <ufunc 'fmod'>
@pytest.mark.skipif(hasattr(np.__config__, "blas_ssl2_info"),
reason="gh-22982")
@pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm")
@pytest.mark.xfail(sys.platform.startswith("darwin"),
reason="MacOS seems to not give the correct 'invalid' warning for "
"`fmod`. Hopefully, others always do.")
@pytest.mark.parametrize('dtype', np.typecodes['Float'])
@pytest.mark.parametrize('fn', [np.fmod, np.remainder])
def test_float_remainder_errors(self, dtype, fn):
fzero = np.array(0.0, dtype=dtype)
fone = np.array(1.0, dtype=dtype)
finf = np.array(np.inf, dtype=dtype)
fnan = np.array(np.nan, dtype=dtype)
# The following already contain a NaN and should not warn.
with np.errstate(all='raise'):
with pytest.raises(FloatingPointError,
match="invalid value"):
> fn(fone, fzero)
E FloatingPointError: divide by zero encountered in fmod
dtype = 'e'
finf = array(inf, dtype=float16)
fn = <ufunc 'fmod'>
fnan = array(nan, dtype=float16)
fone = array(1., dtype=float16)
fzero = array(0., dtype=float16)
self = <test_umath.TestRemainder object at 0x1548c324c0d0>
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath.py:838: FloatingPointError
During handling of the above exception, another exception occurred:
self = <test_umath.TestRemainder object at 0x1548c324c0d0>, dtype = 'e', fn = <ufunc 'fmod'>
@pytest.mark.skipif(hasattr(np.__config__, "blas_ssl2_info"),
reason="gh-22982")
@pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm")
@pytest.mark.xfail(sys.platform.startswith("darwin"),
reason="MacOS seems to not give the correct 'invalid' warning for "
"`fmod`. Hopefully, others always do.")
@pytest.mark.parametrize('dtype', np.typecodes['Float'])
@pytest.mark.parametrize('fn', [np.fmod, np.remainder])
def test_float_remainder_errors(self, dtype, fn):
fzero = np.array(0.0, dtype=dtype)
fone = np.array(1.0, dtype=dtype)
finf = np.array(np.inf, dtype=dtype)
fnan = np.array(np.nan, dtype=dtype)
# The following already contain a NaN and should not warn.
with np.errstate(all='raise'):
> with pytest.raises(FloatingPointError,
match="invalid value"):
E AssertionError: Regex pattern did not match.
E Regex: 'invalid value'
E Input: 'divide by zero encountered in fmod'
dtype = 'e'
finf = array(inf, dtype=float16)
fn = <ufunc 'fmod'>
fnan = array(nan, dtype=float16)
fone = array(1., dtype=float16)
fzero = array(0., dtype=float16)
self = <test_umath.TestRemainder object at 0x1548c324c0d0>
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath.py:836: AssertionError
________________________________________________________________ TestRemainder.test_float_remainder_errors[fmod-f] _________________________________________________________________
self = <test_umath.TestRemainder object at 0x1548c3243e50>, dtype = 'f', fn = <ufunc 'fmod'>
@pytest.mark.skipif(hasattr(np.__config__, "blas_ssl2_info"),
reason="gh-22982")
@pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm")
@pytest.mark.xfail(sys.platform.startswith("darwin"),
reason="MacOS seems to not give the correct 'invalid' warning for "
"`fmod`. Hopefully, others always do.")
@pytest.mark.parametrize('dtype', np.typecodes['Float'])
@pytest.mark.parametrize('fn', [np.fmod, np.remainder])
def test_float_remainder_errors(self, dtype, fn):
fzero = np.array(0.0, dtype=dtype)
fone = np.array(1.0, dtype=dtype)
finf = np.array(np.inf, dtype=dtype)
fnan = np.array(np.nan, dtype=dtype)
# The following already contain a NaN and should not warn.
with np.errstate(all='raise'):
with pytest.raises(FloatingPointError,
match="invalid value"):
> fn(fone, fzero)
E FloatingPointError: divide by zero encountered in fmod
dtype = 'f'
finf = array(inf, dtype=float32)
fn = <ufunc 'fmod'>
fnan = array(nan, dtype=float32)
fone = array(1., dtype=float32)
fzero = array(0., dtype=float32)
self = <test_umath.TestRemainder object at 0x1548c3243e50>
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath.py:838: FloatingPointError
During handling of the above exception, another exception occurred:
self = <test_umath.TestRemainder object at 0x1548c3243e50>, dtype = 'f', fn = <ufunc 'fmod'>
@pytest.mark.skipif(hasattr(np.__config__, "blas_ssl2_info"),
reason="gh-22982")
@pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm")
@pytest.mark.xfail(sys.platform.startswith("darwin"),
reason="MacOS seems to not give the correct 'invalid' warning for "
"`fmod`. Hopefully, others always do.")
@pytest.mark.parametrize('dtype', np.typecodes['Float'])
@pytest.mark.parametrize('fn', [np.fmod, np.remainder])
def test_float_remainder_errors(self, dtype, fn):
fzero = np.array(0.0, dtype=dtype)
fone = np.array(1.0, dtype=dtype)
finf = np.array(np.inf, dtype=dtype)
fnan = np.array(np.nan, dtype=dtype)
# The following already contain a NaN and should not warn.
with np.errstate(all='raise'):
> with pytest.raises(FloatingPointError,
match="invalid value"):
E AssertionError: Regex pattern did not match.
E Regex: 'invalid value'
E Input: 'divide by zero encountered in fmod'
dtype = 'f'
finf = array(inf, dtype=float32)
fn = <ufunc 'fmod'>
fnan = array(nan, dtype=float32)
fone = array(1., dtype=float32)
fzero = array(0., dtype=float32)
self = <test_umath.TestRemainder object at 0x1548c3243e50>
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath.py:836: AssertionError
________________________________________________________________ TestRemainder.test_float_remainder_errors[fmod-g] _________________________________________________________________
self = <test_umath.TestRemainder object at 0x1548c3243890>, dtype = 'g', fn = <ufunc 'fmod'>
@pytest.mark.skipif(hasattr(np.__config__, "blas_ssl2_info"),
reason="gh-22982")
@pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm")
@pytest.mark.xfail(sys.platform.startswith("darwin"),
reason="MacOS seems to not give the correct 'invalid' warning for "
"`fmod`. Hopefully, others always do.")
@pytest.mark.parametrize('dtype', np.typecodes['Float'])
@pytest.mark.parametrize('fn', [np.fmod, np.remainder])
def test_float_remainder_errors(self, dtype, fn):
fzero = np.array(0.0, dtype=dtype)
fone = np.array(1.0, dtype=dtype)
finf = np.array(np.inf, dtype=dtype)
fnan = np.array(np.nan, dtype=dtype)
# The following already contain a NaN and should not warn.
with np.errstate(all='raise'):
> with pytest.raises(FloatingPointError,
match="invalid value"):
E Failed: DID NOT RAISE <class 'FloatingPointError'>
dtype = 'g'
finf = array(inf, dtype=float128)
fn = <ufunc 'fmod'>
fnan = array(nan, dtype=float128)
fone = array(1., dtype=float128)
fzero = array(0., dtype=float128)
self = <test_umath.TestRemainder object at 0x1548c3243890>
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath.py:836: Failed
______________________________________________________________ TestRemainder.test_float_remainder_errors[remainder-e] ______________________________________________________________
self = <test_umath.TestRemainder object at 0x1548c32435d0>, dtype = 'e', fn = <ufunc 'remainder'>
@pytest.mark.skipif(hasattr(np.__config__, "blas_ssl2_info"),
reason="gh-22982")
@pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm")
@pytest.mark.xfail(sys.platform.startswith("darwin"),
reason="MacOS seems to not give the correct 'invalid' warning for "
"`fmod`. Hopefully, others always do.")
@pytest.mark.parametrize('dtype', np.typecodes['Float'])
@pytest.mark.parametrize('fn', [np.fmod, np.remainder])
def test_float_remainder_errors(self, dtype, fn):
fzero = np.array(0.0, dtype=dtype)
fone = np.array(1.0, dtype=dtype)
finf = np.array(np.inf, dtype=dtype)
fnan = np.array(np.nan, dtype=dtype)
# The following already contain a NaN and should not warn.
with np.errstate(all='raise'):
with pytest.raises(FloatingPointError,
match="invalid value"):
> fn(fone, fzero)
E FloatingPointError: divide by zero encountered in remainder
dtype = 'e'
finf = array(inf, dtype=float16)
fn = <ufunc 'remainder'>
fnan = array(nan, dtype=float16)
fone = array(1., dtype=float16)
fzero = array(0., dtype=float16)
self = <test_umath.TestRemainder object at 0x1548c32435d0>
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath.py:838: FloatingPointError
During handling of the above exception, another exception occurred:
self = <test_umath.TestRemainder object at 0x1548c32435d0>, dtype = 'e', fn = <ufunc 'remainder'>
@pytest.mark.skipif(hasattr(np.__config__, "blas_ssl2_info"),
reason="gh-22982")
@pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm")
@pytest.mark.xfail(sys.platform.startswith("darwin"),
reason="MacOS seems to not give the correct 'invalid' warning for "
"`fmod`. Hopefully, others always do.")
@pytest.mark.parametrize('dtype', np.typecodes['Float'])
@pytest.mark.parametrize('fn', [np.fmod, np.remainder])
def test_float_remainder_errors(self, dtype, fn):
fzero = np.array(0.0, dtype=dtype)
fone = np.array(1.0, dtype=dtype)
finf = np.array(np.inf, dtype=dtype)
fnan = np.array(np.nan, dtype=dtype)
# The following already contain a NaN and should not warn.
with np.errstate(all='raise'):
> with pytest.raises(FloatingPointError,
match="invalid value"):
E AssertionError: Regex pattern did not match.
E Regex: 'invalid value'
E Input: 'divide by zero encountered in remainder'
dtype = 'e'
finf = array(inf, dtype=float16)
fn = <ufunc 'remainder'>
fnan = array(nan, dtype=float16)
fone = array(1., dtype=float16)
fzero = array(0., dtype=float16)
self = <test_umath.TestRemainder object at 0x1548c32435d0>
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath.py:836: AssertionError
______________________________________________________________ TestRemainder.test_float_remainder_errors[remainder-f] ______________________________________________________________
self = <test_umath.TestRemainder object at 0x1548c3243310>, dtype = 'f', fn = <ufunc 'remainder'>
@pytest.mark.skipif(hasattr(np.__config__, "blas_ssl2_info"),
reason="gh-22982")
@pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm")
@pytest.mark.xfail(sys.platform.startswith("darwin"),
reason="MacOS seems to not give the correct 'invalid' warning for "
"`fmod`. Hopefully, others always do.")
@pytest.mark.parametrize('dtype', np.typecodes['Float'])
@pytest.mark.parametrize('fn', [np.fmod, np.remainder])
def test_float_remainder_errors(self, dtype, fn):
fzero = np.array(0.0, dtype=dtype)
fone = np.array(1.0, dtype=dtype)
finf = np.array(np.inf, dtype=dtype)
fnan = np.array(np.nan, dtype=dtype)
# The following already contain a NaN and should not warn.
with np.errstate(all='raise'):
with pytest.raises(FloatingPointError,
match="invalid value"):
> fn(fone, fzero)
E FloatingPointError: divide by zero encountered in remainder
dtype = 'f'
finf = array(inf, dtype=float32)
fn = <ufunc 'remainder'>
fnan = array(nan, dtype=float32)
fone = array(1., dtype=float32)
fzero = array(0., dtype=float32)
self = <test_umath.TestRemainder object at 0x1548c3243310>
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath.py:838: FloatingPointError
During handling of the above exception, another exception occurred:
self = <test_umath.TestRemainder object at 0x1548c3243310>, dtype = 'f', fn = <ufunc 'remainder'>
@pytest.mark.skipif(hasattr(np.__config__, "blas_ssl2_info"),
reason="gh-22982")
@pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm")
@pytest.mark.xfail(sys.platform.startswith("darwin"),
reason="MacOS seems to not give the correct 'invalid' warning for "
"`fmod`. Hopefully, others always do.")
@pytest.mark.parametrize('dtype', np.typecodes['Float'])
@pytest.mark.parametrize('fn', [np.fmod, np.remainder])
def test_float_remainder_errors(self, dtype, fn):
fzero = np.array(0.0, dtype=dtype)
fone = np.array(1.0, dtype=dtype)
finf = np.array(np.inf, dtype=dtype)
fnan = np.array(np.nan, dtype=dtype)
# The following already contain a NaN and should not warn.
with np.errstate(all='raise'):
> with pytest.raises(FloatingPointError,
match="invalid value"):
E AssertionError: Regex pattern did not match.
E Regex: 'invalid value'
E Input: 'divide by zero encountered in remainder'
dtype = 'f'
finf = array(inf, dtype=float32)
fn = <ufunc 'remainder'>
fnan = array(nan, dtype=float32)
fone = array(1., dtype=float32)
fzero = array(0., dtype=float32)
self = <test_umath.TestRemainder object at 0x1548c3243310>
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath.py:836: AssertionError
______________________________________________________________ TestRemainder.test_float_remainder_errors[remainder-g] ______________________________________________________________
self = <test_umath.TestRemainder object at 0x1548c3242a50>, dtype = 'g', fn = <ufunc 'remainder'>
@pytest.mark.skipif(hasattr(np.__config__, "blas_ssl2_info"),
reason="gh-22982")
@pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm")
@pytest.mark.xfail(sys.platform.startswith("darwin"),
reason="MacOS seems to not give the correct 'invalid' warning for "
"`fmod`. Hopefully, others always do.")
@pytest.mark.parametrize('dtype', np.typecodes['Float'])
@pytest.mark.parametrize('fn', [np.fmod, np.remainder])
def test_float_remainder_errors(self, dtype, fn):
fzero = np.array(0.0, dtype=dtype)
fone = np.array(1.0, dtype=dtype)
finf = np.array(np.inf, dtype=dtype)
fnan = np.array(np.nan, dtype=dtype)
# The following already contain a NaN and should not warn.
with np.errstate(all='raise'):
> with pytest.raises(FloatingPointError,
match="invalid value"):
E Failed: DID NOT RAISE <class 'FloatingPointError'>
dtype = 'g'
finf = array(inf, dtype=float128)
fn = <ufunc 'remainder'>
fnan = array(nan, dtype=float128)
fone = array(1., dtype=float128)
fzero = array(0., dtype=float128)
self = <test_umath.TestRemainder object at 0x1548c3242a50>
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath.py:836: Failed
___________________________________________________________________________ TestClog.test_special_values ___________________________________________________________________________
self = <test_umath_complex.TestClog object at 0x1548c2f81b90>
@platform_skip
@pytest.mark.skipif(platform.machine() == "armv5tel", reason="See gh-413.")
def test_special_values(self):
xl = []
yl = []
# From C99 std (Sec 6.3.2)
# XXX: check exceptions raised
# --- raise for invalid fails.
# clog(-0 + i0) returns -inf + i pi and raises the 'divide-by-zero'
# floating-point exception.
with np.errstate(divide='raise'):
x = np.array([ncu.NZERO], dtype=complex)
y = complex(-np.inf, np.pi)
> assert_raises(FloatingPointError, np.log, x)
self = <test_umath_complex.TestClog object at 0x1548c2f81b90>
x = array([-0.+0.j])
xl = []
y = (-inf+3.141592653589793j)
yl = []
../python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath_complex.py:158:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../python/3.11.11/lib/python3.11/unittest/case.py:766: in assertRaises
return context.handle('assertRaises', args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
args = (<ufunc 'log'>, array([-0.+0.j]))
context = None
expected_exception = <class 'FloatingPointError'>
kwargs = {}
self = <numpy.testing._private.utils._Dummy testMethod=nop>
../python/3.11.11/lib/python3.11/unittest/case.py:236: in handle
with self:
args = [array([-0.+0.j])]
callable_obj = <ufunc 'log'>
kwargs = {}
name = 'assertRaises'
self = None
../python/3.11.11/lib/python3.11/unittest/case.py:259: in __exit__
self._raiseFailure("{} not raised by {}".format(exc_name,
exc_name = 'FloatingPointError'
exc_type = None
exc_value = None
self = <unittest.case._AssertRaisesContext object at 0x1547dcab9390>
tb = None
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <unittest.case._AssertRaisesContext object at 0x1547dcab9390>, standardMsg = 'FloatingPointError not raised by log'
def _raiseFailure(self, standardMsg):
msg = self.test_case._formatMessage(self.msg, standardMsg)
> raise self.test_case.failureException(msg)
E AssertionError: FloatingPointError not raised by log
msg = 'FloatingPointError not raised by log'
self = <unittest.case._AssertRaisesContext object at 0x1547dcab9390>
standardMsg = 'FloatingPointError not raised by log'
../python/3.11.11/lib/python3.11/unittest/case.py:199: AssertionError
________________________________________________________________________________ TestKind.test_int _________________________________________________________________________________
self = <numpy.f2py.tests.test_kind.TestKind object at 0x1548c243a710>
@pytest.mark.skipif(sys.maxsize < 2 ** 31 + 1,
reason="Fails for 32 bit machines")
def test_int(self):
"""Test `int` kind_func for integers up to 10**40."""
selectedintkind = self.module.selectedintkind
for i in range(40):
> assert selectedintkind(i) == selected_int_kind(
i
), f"selectedintkind({i}): expected {selected_int_kind(i)!r} but got {selectedintkind(i)!r}"
E AssertionError: selectedintkind(19): expected 16 but got -1
E assert -1 == 16
E + where -1 = <fortran function selectedintkind>(19)
E + and 16 = selected_int_kind(19)
i = 19
selectedintkind = <fortran function selectedintkind>
self = <numpy.f2py.tests.test_kind.TestKind object at 0x1548c243a710>
../python/3.11.11/lib/python3.11/site-packages/numpy/f2py/tests/test_kind.py:26: AssertionError
________________________________________________________________________________ TestKind.test_real ________________________________________________________________________________
self = <numpy.f2py.tests.test_kind.TestKind object at 0x1548c2340e90>
def test_real(self):
"""
Test (processor-dependent) `real` kind_func for real numbers
of up to 31 digits precision (extended/quadruple).
"""
selectedrealkind = self.module.selectedrealkind
for i in range(32):
> assert selectedrealkind(i) == selected_real_kind(
i
), f"selectedrealkind({i}): expected {selected_real_kind(i)!r} but got {selectedrealkind(i)!r}"
E AssertionError: selectedrealkind(16): expected 10 but got 16
E assert 16 == 10
E + where 16 = <fortran function selectedrealkind>(16)
E + and 10 = selected_real_kind(16)
i = 16
selectedrealkind = <fortran function selectedrealkind>
self = <numpy.f2py.tests.test_kind.TestKind object at 0x1548c2340e90>
../python/3.11.11/lib/python3.11/site-packages/numpy/f2py/tests/test_kind.py:38: AssertionError
================================================================================= warnings summary =================================================================================
../python/3.11.11/lib/python3.11/site-packages/setuptools/_distutils/msvccompiler.py:66
/work2/noaa/co2/sbasu/packages/python/3.11.11/lib/python3.11/site-packages/setuptools/_distutils/msvccompiler.py:66: DeprecationWarning: msvccompiler is deprecated and slated to be removed in the future. Please discontinue use or file an issue with pypa/distutils describing your use case.
warnings.warn(
_core/tests/test_umath.py::TestRemainder::test_float_remainder_corner_cases
/work2/noaa/co2/sbasu/packages/python/3.11.11/lib/python3.11/site-packages/numpy/_core/tests/test_umath.py:910: RuntimeWarning: divide by zero encountered in remainder
rem = np.remainder(fone, fzer)
distutils/tests/test_fcompiler_gnu.py: 10 warnings
/work2/noaa/co2/sbasu/packages/python/3.11.11/lib/python3.11/site-packages/numpy/distutils/fcompiler/gnu.py:276: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(v) >= "4":
distutils/tests/test_fcompiler_gnu.py: 10 warnings
/work2/noaa/co2/sbasu/packages/python/3.11.11/lib/python3.11/site-packages/setuptools/_distutils/version.py:346: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
other = LooseVersion(other)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================= short test summary info ==============================================================================
FAILED _core/tests/test_numeric.py::TestFloatExceptions::test_floating_exceptions[G] - AssertionError: Type <class 'numpy.clongdouble'> did not raise fpe error 'overflow'.
FAILED _core/tests/test_umath.py::TestRemainder::test_float_divmod_errors[d] - AssertionError: FloatingPointError not raised by divmod
FAILED _core/tests/test_umath.py::TestRemainder::test_float_divmod_errors[g] - AssertionError: FloatingPointError not raised by divmod
FAILED _core/tests/test_umath.py::TestRemainder::test_float_remainder_errors[fmod-e] - AssertionError: Regex pattern did not match.
FAILED _core/tests/test_umath.py::TestRemainder::test_float_remainder_errors[fmod-f] - AssertionError: Regex pattern did not match.
FAILED _core/tests/test_umath.py::TestRemainder::test_float_remainder_errors[fmod-g] - Failed: DID NOT RAISE <class 'FloatingPointError'>
FAILED _core/tests/test_umath.py::TestRemainder::test_float_remainder_errors[remainder-e] - AssertionError: Regex pattern did not match.
FAILED _core/tests/test_umath.py::TestRemainder::test_float_remainder_errors[remainder-f] - AssertionError: Regex pattern did not match.
FAILED _core/tests/test_umath.py::TestRemainder::test_float_remainder_errors[remainder-g] - Failed: DID NOT RAISE <class 'FloatingPointError'>
FAILED _core/tests/test_umath_complex.py::TestClog::test_special_values - AssertionError: FloatingPointError not raised by log
FAILED f2py/tests/test_kind.py::TestKind::test_int - AssertionError: selectedintkind(19): expected 16 but got -1
FAILED f2py/tests/test_kind.py::TestKind::test_real - AssertionError: selectedrealkind(16): expected 10 but got 16
12 failed, 45404 passed, 335 skipped, 2820 deselected, 33 xfailed, 5 xpassed, 22 warnings in 491.86s (0:08:11)Python and NumPy Versions:
python -c 'import sys,numpy; print(sys.version) ; print(numpy.__version__)'
3.11.11 (main, Sep 9 2025, 10:29:54) [Clang 19.0.0 (icx 2024.2.1.20240711)]
2.3.2
Runtime Environment:
[{'numpy_version': '2.3.2',
'python': '3.11.11 (main, Sep 9 2025, 10:29:54) [Clang 19.0.0 (icx '
'2024.2.1.20240711)]',
'uname': uname_result(system='Linux', node='orion-login-3.hpc.msstate.edu', release='5.14.0-162.23.1.el9_1.x86_64', version='#1 SMP PREEMPT_DYNAMIC Tue Apr 11 19:09:37 UTC 2023', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE',
'SSE2',
'SSE3',
'SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2',
'AVX512F',
'AVX512CD',
'AVX512_SKX'],
'found': [],
'not_found': ['AVX512_KNL',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}},
{'filepath': '/apps/spack-managed-skylake_avx512-v1.0/gcc-11.3.1/intel-oneapi-compilers-2024.2.1-at2u4flm6j2vvnwqgttej7jnni7d4vd4/compiler/2024.2/lib/libiomp5.so',
'internal_api': 'openmp',
'num_threads': 80,
'prefix': 'libiomp',
'user_api': 'openmp',
'version': None}]
Context for the issue:
No response
Activity
ngoldbaum commentedon Sep 9, 2025
We don't test numpy using the intel compilers so breakage there is unsurprising.
It looks like there are some slight differences around floating point exceptions in a few operations as well as a couple of spots in f2py.
If you don't care about either then I wouldn't worry about the test failures.
AgilentGCMS commentedon Sep 9, 2025
That's the problem, I don't know if I should care about these errors. I do use
f2pyquite a lot, but I don't know what these errors mean for my code.ngoldbaum commentedon Sep 9, 2025
It looks like the f2py failures showed up last year as well, so if it hasn't been a problem
I wouldn't worry.
Also: consider not using the intel compilers to build python modules. Almost no one does that. I'd be surprised if you can use e.g. a GNU toolchain or llvm on your cluster and you have to use the intel
compilers to build everything.
AgilentGCMS commentedon Sep 10, 2025
So if those tests aren't important, why are they a part of the test suite? To scare folks like us? Jokes aside, isn't a test suite useful primarily if failures point to something that needs fixing?
This is news to me, but you may be right. For almost a decade now I've been compiling numpy with intel compilers and linking against MKL on intel CPUs, and back when I started I saw definite speedups compared to gcc-compiled numpy. Very likely because so much of my work involves linear algebra. Are you saying that gcc has become so good now that it can benefit from AVX512 instructions on intel CPUs and pull in all the MKL routines seamlessly?
jorenham commentedon Sep 10, 2025
numpy.test()is public API, so I think it's reasonable to expect that it works on the platforms that numpy supports.So maybe we should state somewhere that we don't (fully) support intel compilers then?
jorenham commentedon Sep 10, 2025
And FWIW, I get no test errors when I run
ngoldbaum commentedon Sep 10, 2025
I agree that ideally these bugs would be fixed. I just can't reproduce them because I don't have the intel compilers. I'm also not particularly motivated to fix issues that show up on proprietary stacks like this.
If someone else wants to look closer to understand the failures and fix them or add workarounds, that would be great.
Modern GCC and LLVM versions emit AVX512 instructions. But you're right, the generated code might be slightly more efficient on Intel CPUs with intel compilers. If you'd like, you could try to understand these test failures more deeply to see if you'd like to send in fixes.
That said, it's likely that building your BLAS library with the intel compilers will get you almost all of the speedup. That doesn't necessitate building NumPy with those compilers. In my hazy decade-old HPC experience, I regularly linked libraries that were compiled using the intel compilers into python extensions that were built with GCC. It should be possible to link in the MKL math and linear algrebra libraries using a GNU or LLVM toolchain.
AgilentGCMS commentedon Sep 17, 2025
I understand the sentiment, and the limitation of not having access to intel compilers (they are, however, free to download and install). However, there's a fairly large body of numpy/scipy/pandas users on HPCs who use non-GNU compilers, so I think it's worth the time to fix issues. Alternatively, the numpy project could just say "if things don't work on non-GNU systems don't bother complaining", and we can spread the word in the scientific computing community that numpy only works properly with GNU compilers.
I know I'm coming across as cranky, but this is not the first time I've seen
test()failures only to be told (in essence) "they probably don't matter, just proceed". This is not good coding practice. If those test failures don't matter, then they should not be tests in the first place. If they do matter, then they're pointing to issues -- either in the tests or in numpy -- that need fixing.ngoldbaum commentedon Sep 17, 2025
I think you're confusing my personal opinion with the opinions of the project.
Since you care about supporting the Intel compilers, I invite you to make contributions to improve the situation.
mattip commentedon Sep 17, 2025
There is a third option: that the problems are in the way the intel compilers differ from clang/gcc. This is something we, as an open source project with limited resources, are not capable of checking.