-
-
Save isuruf/aaead06e2b1d801a20910bc44a9ffcdf to your computer and use it in GitHub Desktop.
git clone https://github.com/isuruf/vecLibFort | |
cd vecLibFort | |
conda create -n numpy pytest hypothesis numpy "libblas=*=*netlib" --yes | |
conda activate numpy | |
clang -O3 -c -o vecLibFort.o vecLibFort.c | |
clang -shared -o libblas.3.dylib vecLibFort.o -Wl,-reexport_library,$(xcrun -show-sdk-path)/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.tbd | |
codesign -s - -f libblas.3.dylib | |
rm $CONDA_PREFIX/lib/libblas.3.dylib | |
rm $CONDA_PREFIX/lib/libcblas.3.dylib | |
cp libblas.3.dylib $CONDA_PREFIX/lib/libblas.3.dylib | |
cp libblas.3.dylib $CONDA_PREFIX/lib/libcblas.3.dylib | |
python -c "import numpy; numpy.test()" |
The build works fine but when I run the numpy test, I get the following crash at 48%, when running the f2py tests:
Fatal Python error: Bus error
Current thread 0x00000001013bbd40 (most recent call first):
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/f2py/tests/test_callback.py", line 103 in check_function
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/f2py/tests/test_callback.py", line 68 in test_all
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/python.py", line 183 in pytest_pyfunc_call
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/callers.py", line 187 in _multicall
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/manager.py", line 84 in <lambda>
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/manager.py", line 93 in _hookexec
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/hooks.py", line 286 in __call__
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/python.py", line 1641 in runtest
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/runner.py", line 162 in pytest_runtest_call
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/callers.py", line 187 in _multicall
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/manager.py", line 84 in <lambda>
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/manager.py", line 93 in _hookexec
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/hooks.py", line 286 in __call__
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/runner.py", line 255 in <lambda>
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/runner.py", line 311 in from_call
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/runner.py", line 254 in call_runtest_hook
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/runner.py", line 215 in call_and_report
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/runner.py", line 126 in runtestprotocol
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/runner.py", line 109 in pytest_runtest_protocol
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/callers.py", line 187 in _multicall
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/manager.py", line 84 in <lambda>
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/manager.py", line 93 in _hookexec
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/hooks.py", line 286 in __call__
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/main.py", line 348 in pytest_runtestloop
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/callers.py", line 187 in _multicall
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/manager.py", line 84 in <lambda>
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/manager.py", line 93 in _hookexec
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/hooks.py", line 286 in __call__
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/main.py", line 323 in _main
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/main.py", line 269 in wrap_session
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/main.py", line 316 in pytest_cmdline_main
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/callers.py", line 187 in _multicall
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/manager.py", line 84 in <lambda>
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/manager.py", line 93 in _hookexec
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/pluggy/hooks.py", line 286 in __call__
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/_pytest/config/__init__.py", line 162 in main
File "/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/_pytesttester.py", line 209 in __call__
File "<string>", line 1 in <module>
zsh: bus error python -c "import numpy; numpy.test()" -v
conda list output:
(numpy) ogrisel@mba vecLibFort % conda list
# packages in environment at /Users/ogrisel/miniforge3/envs/numpy:
#
# Name Version Build Channel
appdirs 1.4.4 pyh9f0ad1d_0 conda-forge
attrs 20.3.0 pyhd3deb0d_0 conda-forge
black 20.8b1 py_1 conda-forge
ca-certificates 2020.12.5 h4653dfc_0 conda-forge
certifi 2020.12.5 py39h2804cbe_1 conda-forge
click 7.1.2 pyh9f0ad1d_0 conda-forge
cython 0.29.21 py39h93dc1e2_2 conda-forge
dataclasses 0.7 pyhb2cacf7_7 conda-forge
hypothesis 6.1.1 pyhd8ed1ab_0 conda-forge
iniconfig 1.1.1 pyh9f0ad1d_0 conda-forge
joblib 1.0.0 pyhd8ed1ab_0 conda-forge
libblas 3.9.0 3_he9612bc_netlib conda-forge
libcblas 3.9.0 3_he9612bc_netlib conda-forge
libcxx 11.0.1 h168391b_0 conda-forge
libgfortran 5.0.0.dev0 11_0_0_hdc626ea_17 conda-forge
libgfortran5 11.0.0.dev0 hdc626ea_17 conda-forge
liblapack 3.9.0 3_he9612bc_netlib conda-forge
llvm-openmp 11.0.1 hb3022d6_0 conda-forge
more-itertools 8.6.0 pyhd8ed1ab_0 conda-forge
mypy_extensions 0.4.3 py39h2804cbe_3 conda-forge
ncurses 6.2 h9aa5885_4 conda-forge
numpy 1.20.0 py39h69a04d8_0 conda-forge
openssl 1.1.1i h27ca646_0 conda-forge
packaging 20.8 pyhd3deb0d_0 conda-forge
pathspec 0.8.1 pyhd3deb0d_0 conda-forge
pip 21.0.1 pyhd8ed1ab_0 conda-forge
pluggy 0.13.1 py39h2804cbe_4 conda-forge
py 1.10.0 pyhd3deb0d_0 conda-forge
pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
pytest 6.2.2 py39h2804cbe_0 conda-forge
python 3.9.1 hcbd9b3a_5_cpython conda-forge
python_abi 3.9 1_cp39 conda-forge
readline 8.0 hc8eb9b7_2 conda-forge
regex 2020.11.13 py39h46acfd9_1 conda-forge
scikit-learn 0.24.1 py39hb966dd2_0 conda-forge
scipy 1.6.0 py39h73ea49b_0 conda-forge
setuptools 49.6.0 py39h2804cbe_3 conda-forge
sortedcontainers 2.3.0 pyhd8ed1ab_0 conda-forge
sqlite 3.34.0 h6d56c25_0 conda-forge
threadpoolctl 2.1.0 pyh5ca1d4c_0 conda-forge
tk 8.6.10 hf7e6567_1 conda-forge
toml 0.10.2 pyhd8ed1ab_0 conda-forge
typed-ast 1.4.2 py39h46acfd9_0 conda-forge
typing_extensions 3.7.4.3 py_0 conda-forge
tzdata 2021a he74cb21_0 conda-forge
wheel 0.36.2 pyhd3deb0d_0 conda-forge
xz 5.2.5 h642e427_1 conda-forge
zlib 1.2.11 h31e879b_1009 conda-forge
Can you try installing compilers
into that env?
If you use the openblas build, tests work?
Ok the f2py crash went away with the compilers package. I get now get 6 failures. Here is the full report:
========================================================================= FAILURES ==========================================================================
___________________________________________ TestUfuncGenericLoops.test_unary_PyUFunc_O_O_method_full[reciprocal] ____________________________________________
self = <numpy.core.tests.test_ufunc.TestUfuncGenericLoops object at 0x113c22220>, ufunc = <ufunc 'reciprocal'>
@pytest.mark.parametrize("ufunc", UNARY_OBJECT_UFUNCS)
def test_unary_PyUFunc_O_O_method_full(self, ufunc):
"""Compare the result of the object loop with non-object one"""
val = np.float64(np.pi/4)
class MyFloat(np.float64):
def __getattr__(self, attr):
try:
return super().__getattr__(attr)
except AttributeError:
return lambda: getattr(np.core.umath, attr)(val)
num_arr = np.array([val], dtype=np.float64)
obj_arr = np.array([MyFloat(val)], dtype="O")
with np.errstate(all="raise"):
try:
> res_num = ufunc(num_arr)
E FloatingPointError: divide by zero encountered in reciprocal
MyFloat = <class 'numpy.core.tests.test_ufunc.TestUfuncGenericLoops.test_unary_PyUFunc_O_O_method_full.<locals>.MyFloat'>
num_arr = array([0.78539816])
obj_arr = array([0.7853981633974483], dtype=object)
self = <numpy.core.tests.test_ufunc.TestUfuncGenericLoops object at 0x113c22220>
ufunc = <ufunc 'reciprocal'>
val = 0.7853981633974483
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_ufunc.py:172: FloatingPointError
During handling of the above exception, another exception occurred:
self = <numpy.core.tests.test_ufunc.TestUfuncGenericLoops object at 0x113c22220>, ufunc = <ufunc 'reciprocal'>
@pytest.mark.parametrize("ufunc", UNARY_OBJECT_UFUNCS)
def test_unary_PyUFunc_O_O_method_full(self, ufunc):
"""Compare the result of the object loop with non-object one"""
val = np.float64(np.pi/4)
class MyFloat(np.float64):
def __getattr__(self, attr):
try:
return super().__getattr__(attr)
except AttributeError:
return lambda: getattr(np.core.umath, attr)(val)
num_arr = np.array([val], dtype=np.float64)
obj_arr = np.array([MyFloat(val)], dtype="O")
with np.errstate(all="raise"):
try:
res_num = ufunc(num_arr)
except Exception as exc:
with assert_raises(type(exc)):
> ufunc(obj_arr)
MyFloat = <class 'numpy.core.tests.test_ufunc.TestUfuncGenericLoops.test_unary_PyUFunc_O_O_method_full.<locals>.MyFloat'>
num_arr = array([0.78539816])
obj_arr = array([0.7853981633974483], dtype=object)
self = <numpy.core.tests.test_ufunc.TestUfuncGenericLoops object at 0x113c22220>
ufunc = <ufunc 'reciprocal'>
val = 0.7853981633974483
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_ufunc.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
miniforge3/envs/numpy/lib/python3.9/unittest/case.py:226: in __exit__
self._raiseFailure("{} not raised".format(exc_name))
exc_name = 'FloatingPointError'
exc_type = None
exc_value = None
self = <unittest.case._AssertRaisesContext object at 0x113c31c10>
tb = None
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <unittest.case._AssertRaisesContext object at 0x113c31c10>, standardMsg = 'FloatingPointError not raised'
def _raiseFailure(self, standardMsg):
msg = self.test_case._formatMessage(self.msg, standardMsg)
> raise self.test_case.failureException(msg)
E AssertionError: FloatingPointError not raised
msg = 'FloatingPointError not raised'
self = <unittest.case._AssertRaisesContext object at 0x113c31c10>
standardMsg = 'FloatingPointError not raised'
miniforge3/envs/numpy/lib/python3.9/unittest/case.py:163: AssertionError
____________________________________________________ TestSharedMemory.test_in_from_2casttype[LONGDOUBLE] ____________________________________________________
self = <numpy.f2py.tests.test_array_from_pyobj.TestSharedMemory object at 0x124a41e80>
def test_in_from_2casttype(self):
for t in self.type.cast_types():
obj = array(self.num2seq, dtype=t.dtype)
> a = self.array([len(self.num2seq)], intent.in_, obj)
a = <numpy.f2py.tests.test_array_from_pyobj.Array object at 0x124a561c0>
obj = array([1, 2])
self = <numpy.f2py.tests.test_array_from_pyobj.TestSharedMemory object at 0x124a41e80>
t = <numpy.f2py.tests.test_array_from_pyobj.Type object at 0x124899d30>
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py:322:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py:313: in <lambda>
Array(Type(request.param), dims, intent, obj)
dims = [2]
intent = Intent(['in'])
obj = array([1, 2])
request = <SubRequest 'setup_type' for <Function test_in_from_2seq[LONGDOUBLE]>>
self = <numpy.f2py.tests.test_array_from_pyobj.TestSharedMemory object at 0x124a41e80>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <numpy.f2py.tests.test_array_from_pyobj.Array object at 0x124a56250>, typ = <numpy.f2py.tests.test_array_from_pyobj.Type object at 0x124899fd0>
dims = [2], intent = Intent(['in']), obj = array([1, 2])
def __init__(self, typ, dims, intent, obj):
self.type = typ
self.dims = dims
self.intent = intent
self.obj_copy = copy.deepcopy(obj)
self.obj = obj
# arr.dtypechar may be different from typ.dtypechar
self.arr = wrap.call(typ.type_num, dims, intent.flags, obj)
assert_(isinstance(self.arr, ndarray), repr(type(self.arr)))
self.arr_attr = wrap.array_attrs(self.arr)
if len(dims) > 1:
if self.intent.is_intent('c'):
assert_(intent.flags & wrap.F2PY_INTENT_C)
assert_(not self.arr.flags['FORTRAN'],
repr((self.arr.flags, getattr(obj, 'flags', None))))
assert_(self.arr.flags['CONTIGUOUS'])
assert_(not self.arr_attr[6] & wrap.FORTRAN)
else:
assert_(not intent.flags & wrap.F2PY_INTENT_C)
assert_(self.arr.flags['FORTRAN'])
assert_(not self.arr.flags['CONTIGUOUS'])
assert_(self.arr_attr[6] & wrap.FORTRAN)
if obj is None:
self.pyarr = None
self.pyarr_attr = None
return
if intent.is_intent('cache'):
assert_(isinstance(obj, ndarray), repr(type(obj)))
self.pyarr = array(obj).reshape(*dims).copy()
else:
self.pyarr = array(array(obj, dtype=typ.dtypechar).reshape(*dims),
order=self.intent.is_intent('c') and 'C' or 'F')
assert_(self.pyarr.dtype == typ,
repr((self.pyarr.dtype, typ)))
assert_(self.pyarr.flags['OWNDATA'], (obj, intent))
self.pyarr_attr = wrap.array_attrs(self.pyarr)
if len(dims) > 1:
if self.intent.is_intent('c'):
assert_(not self.pyarr.flags['FORTRAN'])
assert_(self.pyarr.flags['CONTIGUOUS'])
assert_(not self.pyarr_attr[6] & wrap.FORTRAN)
else:
assert_(self.pyarr.flags['FORTRAN'])
assert_(not self.pyarr.flags['CONTIGUOUS'])
assert_(self.pyarr_attr[6] & wrap.FORTRAN)
assert_(self.arr_attr[1] == self.pyarr_attr[1]) # nd
assert_(self.arr_attr[2] == self.pyarr_attr[2]) # dimensions
if self.arr_attr[1] <= 1:
assert_(self.arr_attr[3] == self.pyarr_attr[3],
repr((self.arr_attr[3], self.pyarr_attr[3],
self.arr.tobytes(), self.pyarr.tobytes()))) # strides
assert_(self.arr_attr[5][-2:] == self.pyarr_attr[5][-2:],
repr((self.arr_attr[5], self.pyarr_attr[5]))) # descr
assert_(self.arr_attr[6] == self.pyarr_attr[6],
repr((self.arr_attr[6], self.pyarr_attr[6],
flags2names(0 * self.arr_attr[6] - self.pyarr_attr[6]),
flags2names(self.arr_attr[6]), intent))) # flags
if intent.is_intent('cache'):
assert_(self.arr_attr[5][3] >= self.type.elsize,
repr((self.arr_attr[5][3], self.type.elsize)))
else:
assert_(self.arr_attr[5][3] == self.type.elsize,
repr((self.arr_attr[5][3], self.type.elsize)))
assert_(self.arr_equal(self.pyarr, self.arr))
if isinstance(self.obj, ndarray):
if typ.elsize == Type(obj.dtype).elsize:
if not intent.is_intent('copy') and self.arr_attr[1] <= 1:
> assert_(self.has_shared_memory())
E AssertionError
dims = [2]
intent = Intent(['in'])
obj = array([1, 2])
self = <numpy.f2py.tests.test_array_from_pyobj.Array object at 0x124a56250>
typ = <numpy.f2py.tests.test_array_from_pyobj.Type object at 0x124899fd0>
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py:272: AssertionError
__________________________________________________ TestSharedMemory.test_f_in_from_23casttype[LONGDOUBLE] ___________________________________________________
self = <numpy.f2py.tests.test_array_from_pyobj.TestSharedMemory object at 0x124b63910>
def test_f_in_from_23casttype(self):
for t in self.type.cast_types():
obj = array(self.num23seq, dtype=t.dtype, order='F')
a = self.array([len(self.num23seq), len(self.num23seq[0])],
intent.in_, obj)
if t.elsize == self.type.elsize:
> assert_(a.has_shared_memory(), repr(t.dtype))
E AssertionError: <class 'numpy.int64'>
a = <numpy.f2py.tests.test_array_from_pyobj.Array object at 0x124a56f70>
obj = array([[1, 2, 3],
[4, 5, 6]])
self = <numpy.f2py.tests.test_array_from_pyobj.TestSharedMemory object at 0x124b63910>
t = <numpy.f2py.tests.test_array_from_pyobj.Type object at 0x124899d30>
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py:391: AssertionError
__________________________________________________ TestSharedMemory.test_c_in_from_23casttype[LONGDOUBLE] ___________________________________________________
self = <numpy.f2py.tests.test_array_from_pyobj.TestSharedMemory object at 0x124a74610>
def test_c_in_from_23casttype(self):
for t in self.type.cast_types():
obj = array(self.num23seq, dtype=t.dtype)
a = self.array([len(self.num23seq), len(self.num23seq[0])],
intent.in_.c, obj)
if t.elsize == self.type.elsize:
> assert_(a.has_shared_memory(), repr(t.dtype))
E AssertionError: <class 'numpy.int64'>
a = <numpy.f2py.tests.test_array_from_pyobj.Array object at 0x124a746d0>
obj = array([[1, 2, 3],
[4, 5, 6]])
self = <numpy.f2py.tests.test_array_from_pyobj.TestSharedMemory object at 0x124a74610>
t = <numpy.f2py.tests.test_array_from_pyobj.Type object at 0x124899d30>
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py:401: AssertionError
_________________________________________ TestMaskedArrayInPlaceArithmetics.test_inplace_floor_division_scalar_type _________________________________________
self = <numpy.ma.tests.test_core.TestMaskedArrayInPlaceArithmetics object at 0x154daf310>
def test_inplace_floor_division_scalar_type(self):
# Test of inplace division
for t in self.othertypes:
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
(x, y, xm) = (_.astype(t) for _ in self.uint8data)
x = arange(10, dtype=t) * t(2)
xm = arange(10, dtype=t) * t(2)
xm[2] = masked
x //= t(2)
xm //= t(2)
assert_equal(x, y)
assert_equal(xm, y)
> assert_equal(len(w), 0, "Failed on type=%s." % t)
self = <numpy.ma.tests.test_core.TestMaskedArrayInPlaceArithmetics object at 0x154daf310>
t = <class 'numpy.complex64'>
w = [<warnings.WarningMessage object at 0x154daf670>, <warnings.WarningMessage object at 0x154daf6a0>, <warnings.WarningMessage object at 0x154daf6d0>, <warnings.WarningMessage object at 0x154daf700>]
x = masked_array(data=[0.+0.j, 1.+0.j, 2.+0.j, 3.+0.j, 4.+0.j, 5.+0.j, 6.+0.j,
7.+0.j, 8.+0.j, 9.+0.j],
mask=False,
fill_value=(1e+20+0j),
dtype=complex64)
xm = masked_array(data=[0j, (1+0j), --, (3+0j), (4+0j), (5+0j), (6+0j), (7+0j),
(8+0j), (9+0j)],
...alse, False, False, False,
False, False],
fill_value=(1e+20+0j),
dtype=complex64)
y = masked_array(data=[0.+0.j, 1.+0.j, 2.+0.j, 3.+0.j, 4.+0.j, 5.+0.j, 6.+0.j,
7.+0.j, 8.+0.j, 9.+0.j],
mask=False,
fill_value=(1e+20+0j),
dtype=complex64)
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/ma/tests/test_core.py:2848:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = 4, desired = 0, err_msg = "Failed on type=<class 'numpy.complex64'>."
def assert_equal(actual, desired, err_msg=''):
"""
Asserts that two items are equal.
"""
# Case #1: dictionary .....
if isinstance(desired, dict):
if not isinstance(actual, dict):
raise AssertionError(repr(type(actual)))
assert_equal(len(actual), len(desired), err_msg)
for k, i in desired.items():
if k not in actual:
raise AssertionError(f"{k} not in {actual}")
assert_equal(actual[k], desired[k], f'key={k!r}\n{err_msg}')
return
# Case #2: lists .....
if isinstance(desired, (list, tuple)) and isinstance(actual, (list, tuple)):
return _assert_equal_on_sequences(actual, desired, err_msg='')
if not (isinstance(actual, ndarray) or isinstance(desired, ndarray)):
msg = build_err_msg([actual, desired], err_msg,)
if not desired == actual:
> raise AssertionError(msg)
E AssertionError:
E Items are not equal: Failed on type=<class 'numpy.complex64'>.
E ACTUAL: 4
E DESIRED: 0
actual = 4
desired = 0
err_msg = "Failed on type=<class 'numpy.complex64'>."
msg = "\nItems are not equal: Failed on type=<class 'numpy.complex64'>.\n ACTUAL: 4\n DESIRED: 0"
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/ma/testutils.py:129: AssertionError
_________________________________________ TestMaskedArrayInPlaceArithmetics.test_inplace_floor_division_array_type __________________________________________
self = <numpy.ma.tests.test_core.TestMaskedArrayInPlaceArithmetics object at 0x154daf5b0>
def test_inplace_floor_division_array_type(self):
# Test of inplace division
for t in self.othertypes:
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
(x, y, xm) = (_.astype(t) for _ in self.uint8data)
m = xm.mask
a = arange(10, dtype=t)
a[-1] = masked
x //= a
xm //= a
assert_equal(x, y // a)
assert_equal(xm, y // a)
assert_equal(
xm.mask,
mask_or(mask_or(m, a.mask), (a == t(0)))
)
> assert_equal(len(w), 0, f'Failed on type={t}.')
a = masked_array(data=[0j, (1+0j), (2+0j), (3+0j), (4+0j), (5+0j), (6+0j),
(7+0j), (8+0j), --],
...alse, False, False, False,
False, True],
fill_value=(1e+20+0j),
dtype=complex64)
m = array([ True, False, True, False, False, False, False, False, False,
True])
self = <numpy.ma.tests.test_core.TestMaskedArrayInPlaceArithmetics object at 0x154daf5b0>
t = <class 'numpy.complex64'>
w = [<warnings.WarningMessage object at 0x154daf9d0>, <warnings.WarningMessage object at 0x154daf970>, <warnings.WarningMessage object at 0x154daf850>, <warnings.WarningMessage object at 0x154daf8e0>]
x = masked_array(data=[--, (1+0j), (1+0j), (1+0j), (1+0j), (1+0j), (1+0j),
(1+0j), (1+0j), --],
...alse, False, False, False,
False, True],
fill_value=(1e+20+0j),
dtype=complex64)
xm = masked_array(data=[--, (1+0j), --, (1+0j), (1+0j), (1+0j), (1+0j), (1+0j),
(1+0j), --],
...alse, False, False, False,
False, True],
fill_value=(1e+20+0j),
dtype=complex64)
y = masked_array(data=[0.+0.j, 1.+0.j, 2.+0.j, 3.+0.j, 4.+0.j, 5.+0.j, 6.+0.j,
7.+0.j, 8.+0.j, 9.+0.j],
mask=False,
fill_value=(1e+20+0j),
dtype=complex64)
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/ma/tests/test_core.py:2868:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = 4, desired = 0, err_msg = "Failed on type=<class 'numpy.complex64'>."
def assert_equal(actual, desired, err_msg=''):
"""
Asserts that two items are equal.
"""
# Case #1: dictionary .....
if isinstance(desired, dict):
if not isinstance(actual, dict):
raise AssertionError(repr(type(actual)))
assert_equal(len(actual), len(desired), err_msg)
for k, i in desired.items():
if k not in actual:
raise AssertionError(f"{k} not in {actual}")
assert_equal(actual[k], desired[k], f'key={k!r}\n{err_msg}')
return
# Case #2: lists .....
if isinstance(desired, (list, tuple)) and isinstance(actual, (list, tuple)):
return _assert_equal_on_sequences(actual, desired, err_msg='')
if not (isinstance(actual, ndarray) or isinstance(desired, ndarray)):
msg = build_err_msg([actual, desired], err_msg,)
if not desired == actual:
> raise AssertionError(msg)
E AssertionError:
E Items are not equal: Failed on type=<class 'numpy.complex64'>.
E ACTUAL: 4
E DESIRED: 0
actual = 4
desired = 0
err_msg = "Failed on type=<class 'numpy.complex64'>."
msg = "\nItems are not equal: Failed on type=<class 'numpy.complex64'>.\n ACTUAL: 4\n DESIRED: 0"
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/ma/testutils.py:129: AssertionError
===================================================================== warnings summary ======================================================================
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_scalarmath.py::TestBaseMath::test_blocked
/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_scalarmath.py:88: RuntimeWarning: divide by zero encountered in reciprocal
assert_almost_equal(np.reciprocal(inp2),
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py::TestDivision::test_floor_division_complex
/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py:286: RuntimeWarning: divide by zero encountered in floor_divide
y = np.floor_divide(x**2, x)
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py::TestPower::test_power_float
/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py:558: RuntimeWarning: divide by zero encountered in reciprocal
assert_almost_equal(x**(-1), [1., 0.5, 1./3])
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py:1006: RuntimeWarning: divide by zero encountered in reciprocal
y_true128 = myfunc(x_f128)
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py:1013: RuntimeWarning: divide by zero encountered in reciprocal
assert_array_max_ulp(myfunc(x_f64), np.float64(y_true128),
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py:1020: RuntimeWarning: divide by zero encountered in reciprocal
assert_equal(myfunc(x_f64[::jj]), y_true64[::jj])
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py:1011: RuntimeWarning: divide by zero encountered in reciprocal
assert_array_max_ulp(myfunc(x_f32), np.float32(y_true128),
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py:1017: RuntimeWarning: divide by zero encountered in reciprocal
y_true32 = myfunc(x_f32)
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py:1018: RuntimeWarning: divide by zero encountered in reciprocal
y_true64 = myfunc(x_f64)
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_umath.py:1021: RuntimeWarning: divide by zero encountered in reciprocal
assert_equal(myfunc(x_f32[::jj]), y_true32[::jj])
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/linalg/tests/test_linalg.py::TestNormDouble::test_axis
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/linalg/tests/test_linalg.py::TestNormSingle::test_axis
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/linalg/tests/test_linalg.py::TestNormInt64::test_axis
/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/linalg/linalg.py:2569: RuntimeWarning: divide by zero encountered in reciprocal
ret **= (1 / ord)
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/linalg/tests/test_linalg.py::TestNormDouble::test_axis
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/linalg/tests/test_linalg.py::TestNormSingle::test_axis
miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/linalg/tests/test_linalg.py::TestNormInt64::test_axis
/Users/ogrisel/miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/linalg/linalg.py:2567: RuntimeWarning: divide by zero encountered in reciprocal
absx **= ord
-- Docs: https://docs.pytest.org/en/stable/warnings.html
================================================================== short test summary info ==================================================================
FAILED miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/core/tests/test_ufunc.py::TestUfuncGenericLoops::test_unary_PyUFunc_O_O_method_full[reciprocal]
FAILED miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py::TestSharedMemory::test_in_from_2casttype[LONGDOUBLE]
FAILED miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py::TestSharedMemory::test_f_in_from_23casttype[LONGDOUBLE]
FAILED miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py::TestSharedMemory::test_c_in_from_23casttype[LONGDOUBLE]
FAILED miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/ma/tests/test_core.py::TestMaskedArrayInPlaceArithmetics::test_inplace_floor_division_scalar_type
FAILED miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/ma/tests/test_core.py::TestMaskedArrayInPlaceArithmetics::test_inplace_floor_division_array_type
6 failed, 12290 passed, 96 skipped, 1205 deselected, 19 xfailed, 3 xpassed, 16 warnings in 93.99s (0:01:33)
If you use the openblas build, tests work?
Running the numpy test on the same machine in an openblas env, I get:
10 failed, 11836 passed, 102 skipped, 1205 deselected, 19 xfailed, 3 xpassed, 24 warnings, 444 errors in 86.37s (0:01:26)
the log is even more verbose. Here is the full log:
https://gist.github.com/ogrisel/be1fd7f9d00f32f3c702a10a9886239d
The 10 failures are:
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/core/tests/test_ufunc.py::TestUfuncGenericLoops::test_unary_PyUFunc_O_O_method_full[reciprocal]
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/distutils/tests/test_system_info.py::TestSystemInfoReading::test_compile1
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/distutils/tests/test_system_info.py::TestSystemInfoReading::test_compile2
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/f2py/tests/test_compile_function.py::test_f2py_init_compile[extra_args0]
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/f2py/tests/test_compile_function.py::test_f2py_init_compile[--noopt --debug]
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/f2py/tests/test_compile_function.py::test_f2py_init_compile[]
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/f2py/tests/test_compile_function.py::test_compile_from_strings[program test_f2py\nend program test_f2py0]
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/f2py/tests/test_compile_function.py::test_compile_from_strings[program test_f2py\nend program test_f2py1]
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/ma/tests/test_core.py::TestMaskedArrayInPlaceArithmetics::test_inplace_floor_division_scalar_type
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/ma/tests/test_core.py::TestMaskedArrayInPlaceArithmetics::test_inplace_floor_division_array_type
So the tests that only fail in the Accelerate env are:
FAILED miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py::TestSharedMemory::test_in_from_2casttype[LONGDOUBLE]
FAILED miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py::TestSharedMemory::test_f_in_from_23casttype[LONGDOUBLE]
FAILED miniforge3/envs/numpy/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py::TestSharedMemory::test_c_in_from_23casttype[LONGDOUBLE]
Running the numpy test on the same machine in an openblas env, I get:
You probably need to install compilers
there too.
I did install the compilers in that env (prior to running the numpy tests):
% conda list compilers
# packages in environment at /Users/ogrisel/miniforge3/envs/sklearn-0241:
#
# Name Version Build Channel
compilers 1.1.3 hce30654_0 conda-forge
/Users/ogrisel/miniforge3/envs/sklearn-0241/include/python3.9/Python.h:25:10: fatal error: 'stdio.h' file not found
E #include <stdio.h>
above error is because the env is not activated. (If it is activated, then $SDKROOT
env variable should be set to the SDK dir)
You are right, something was off with this env. I deactivated everything and reactivated and now I get:
=========================== short test summary info ============================
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/core/tests/test_ufunc.py::TestUfuncGenericLoops::test_unary_PyUFunc_O_O_method_full[reciprocal]
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py::TestSharedMemory::test_in_from_2casttype[LONGDOUBLE]
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py::TestSharedMemory::test_f_in_from_23casttype[LONGDOUBLE]
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/f2py/tests/test_array_from_pyobj.py::TestSharedMemory::test_c_in_from_23casttype[LONGDOUBLE]
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/ma/tests/test_core.py::TestMaskedArrayInPlaceArithmetics::test_inplace_floor_division_scalar_type
FAILED miniforge3/envs/sklearn-0241/lib/python3.9/site-packages/numpy/ma/tests/test_core.py::TestMaskedArrayInPlaceArithmetics::test_inplace_floor_division_array_type
6 failed, 12284 passed, 102 skipped, 1205 deselected, 19 xfailed, 3 xpassed, 24 warnings in 87.73s (0:01:27)
which are the same failures as with the Accelerate BLAS + netlib LAPACK combo so probably unrelated to BLAS and LAPACK.
I updated the gist with the full log: https://gist.github.com/ogrisel/be1fd7f9d00f32f3c702a10a9886239d
I noticed that I had two nested conda env in the previous run (the sklearn-0241
env nested under my dev
env). Maybe that was the cause of the problem...
Or maybe I installed compilers
in sklearn-0241
after the creation and activation of sklearn-0241
without reactivating it. I cannot remember.
I get AssertionErrors from multiple important routines using this on my M1 mac. However from what I have been reading numpy and scipy blocked the accelerate backend due to numerical issues.
=============================== short test summary info ================================ FAILED core/tests/test_ufunc.py::TestUfuncGenericLoops::test_unary_PyUFunc_O_O_method_full[reciprocal] FAILED f2py/tests/test_array_from_pyobj.py::TestSharedMemory::test_in_from_2casttype[LONGDOUBLE] FAILED f2py/tests/test_array_from_pyobj.py::TestSharedMemory::test_f_in_from_23casttype[LONGDOUBLE] FAILED f2py/tests/test_array_from_pyobj.py::TestSharedMemory::test_c_in_from_23casttype[LONGDOUBLE] FAILED linalg/tests/test_linalg.py::TestSVDHermitian::test_herm_cases - AssertionErro... FAILED linalg/tests/test_linalg.py::TestPinvHermitian::test_herm_cases - AssertionErr... FAILED linalg/tests/test_linalg.py::TestEighCases::test_herm_cases - AssertionError: ... FAILED linalg/tests/test_linalg.py::TestCholesky::test_basic_property - numpy.linalg.... FAILED ma/tests/test_core.py::TestMaskedArrayInPlaceArithmetics::test_inplace_floor_division_scalar_type FAILED ma/tests/test_core.py::TestMaskedArrayInPlaceArithmetics::test_inplace_floor_division_array_type 10 failed, 12457 passed, 103 skipped, 1208 deselected, 19 xfailed, 3 xpassed, 16 warnings in 98.77s (0:01:38)
On my MacBook Air, I just installed the command line tools (when installing homebrew) and the SDK lives here: