[Numpy-discussion] Question about OpenBLAS affinity setting.

Charles R Harris charlesr.harris at gmail.com
Fri Aug 15 13:03:27 EDT 2014

Hi All,

Seeking some discussion about setting the OpenBLAS affinity. Currently this
is set when numeric.py is imported:

>     # disables openblas affinity setting of the main thread that limits
>     # python threads or processes to one core
>     if 'OPENBLAS_MAIN_FREE' not in os.environ:
>         os.environ['OPENBLAS_MAIN_FREE'] = '1'
>     if 'GOTOBLAS_MAIN_FREE' not in os.environ:
>         os.environ['GOTOBLAS_MAIN_FREE'] = '1'
>     from ._dotblas import dot, vdot, inner
> except ImportError:
> ...

Note that the affinity is set whether or not the import of _dotblas fails,
which it will if cblas was not found at buildtime. This all seems a bit
hinky to me. If we are always going to set the affinity, it should be in
the core/__init__.py file. If the setting is moved after the import, it
will still happen if, say, ATLAS cblas is present. It seems to me that
there should be a better, more transparent way to do this, especially as
I'm in the process of moving some of the cblas down into multiarray. One
option is to make this part of the multiarray module import, but without a
bit of work, that would still depend only on cblas being detected during
the build process rather than OpenBLAS. Also, is GotoBLAS still a viable


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140815/4b100067/attachment.html>

More information about the NumPy-Discussion mailing list