Skip to content

Instantly share code, notes, and snippets.

@isuruf
Last active September 24, 2024 22:12
Show Gist options
  • Save isuruf/aaead06e2b1d801a20910bc44a9ffcdf to your computer and use it in GitHub Desktop.
Save isuruf/aaead06e2b1d801a20910bc44a9ffcdf to your computer and use it in GitHub Desktop.
Use conda-forge lapack with acelerate as blas backend
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()"
@kirksw
Copy link

kirksw commented May 3, 2021

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment