ggventurini / python-deltasigma

A port of the MATLAB Delta Sigma Toolbox based on free software and very little sleep

Home Page:python-deltasigma.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to Use BLAS Implementation on macOS Catalina

stefano-tronci opened this issue · comments

Hi!

I am working on a little project where I will need to run many simulations with simulateDSM and it would be very beneficial for me to minimise execution time. Unfortunately I am stuck with the slowest implementation:

>>> import deltasigma as ds
/usr/local/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /usr/local/lib/python3.8/site-packages/deltasigma/_simulateDSM_cblas.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
/usr/local/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /usr/local/lib/python3.8/site-packages/deltasigma/_simulateDSM_scipy_blas.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
>>> ds.simulation_backends
{'CBLAS': False, 'Scipy_BLAS': False, 'CPython': True}

Environment Information

I am on macOS Catalina 10.15.6 (19G2021) and running python3:

$ uname -a
Darwin MacBook-Pro-10.local 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64
$ python3
Python 3.8.5 (default, Jul 21 2020, 10:48:26)
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin

I installed openblas and lapack as follows:

brew install openblas lapack

While I installed deltasigma as follows:

pip3 install deltasigma

In order to prevent warnings due to headers not being found upon importing deltasigma in python I made the following symlinks:

sudo ln -s /usr/local/Cellar/openblas/0.3.10_1/include/cblas.h /usr/local/include/cblas.h
sudo ln -s /usr/local/Cellar/openblas/0.3.10_1/include/openblas_config.h /usr/local/include/openblas_config.h

Unfortunately I cannot get deltasigma to use BLAS:

>>> ds.simulation_backends
{'CBLAS': False, 'Scipy_BLAS': False, 'CPython': True}

Any idea?

For me the following export worked:

export BLAS_H=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers/cblas.h