Skip to content

BUG: Accelerate detection fails on at least one machine #15946

@mattip

Description

@mattip

Copied from this comment in gh-15759:

I don't get an error on import. The code added in _mac_os_check() in __init__.py in doesn't crash when I run it

However, the system in question (Mac OS 10.12.6 (Sierra)) does fail one of the tests:

>>> import numpy as np
>>> from numpy.lib.tests.test_polynomial import TestPolynomial
>>> tst = TestPolynomial()
>>> tst.test_polyfit()
python3(18846,0x7fffa26593c0) malloc: *** mach_vm_map(size=18446744073373515776) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
init_dgelsd failed init
<stdin>:1: RankWarning: Polyfit may be poorly conditioned
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/warren/py381/lib/python3.8/site-packages/numpy-1.19.0.dev0+42228fc-py3.8-macosx-10.12-x86_64.egg/numpy/lib/tests/test_polynomial.py", line 171, in test_polyfit
    assert_allclose(mean.std(), 0.5, atol=0.01)
  File "/Users/warren/py381/lib/python3.8/site-packages/numpy-1.19.0.dev0+42228fc-py3.8-macosx-10.12-x86_64.egg/numpy/testing/_private/utils.py", line 1527, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/Users/warren/py381/lib/python3.8/site-packages/numpy-1.19.0.dev0+42228fc-py3.8-macosx-10.12-x86_64.egg/numpy/testing/_private/utils.py", line 840, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0.01

Mismatched elements: 1 / 1 (100%)
Max absolute difference: 0.5
Max relative difference: 1.
 x: array(0.)
 y: array(0.5)
>>> np.__version__  # Current master branch
'1.19.0.dev0+42228fc'

The test at import is meant to catch the warning emitted during that test. @WarrenWeckesser which of the allocations in that test triggers the warning? @vrakesh could you verify the warning is generated on your machine as well and adapt the test in _mac_os_check accordingly to catch more cases?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions