-
-
Notifications
You must be signed in to change notification settings - Fork 11k
BLD: Allow users to specify BLAS and LAPACK library link order #13132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I would be happy to create a test, but it seems extremely build specific and probably difficult in a testing environment? Do you have a CI just for testing Also, sorry I created a commit with |
Does it? We can also do |
Yeah, it's not really testable on CI. If it passes our existing CI (which uses OpenBLAS and
There's a few things in
No worries. It is ENH anyway arguably, it's a distutils enhancement. |
The two CI failures are the same - Building with |
Actually, checking that any of |
Only if MKL is not installed.
Agreed, it is probably more meant as a developer thing. And it would also be way easier to have system installed BLAS/LAPACK versions and letting users control this without complicated mixtures of This PR tries to streamline this in a unified way. A second benefit is that the |
I'll have another look during next week! Thanks for both your comments! |
Prior to this enhancement compiling numpy would forcefully check BLAS/LAPACK libraries in the following order: BLAS: - mkl - blis - openblas - atlas - accelerate - NetLIB BLAS - LAPACK - mkl - openblas - atlas - accelerate - NetLIB LAPACK This is problematic if a user want to build using, say, OpenBLAS but MKL is installed. Even populating the site.cfg correspondingly one would get a successfull build, but using MKL, if present. The same applies to OpenBLAS vs. ATLAS etc. Especially for developers this may be desirable to check performance with various BLAS/LAPACK libraries. This fixes the above issues by enabling users to forcefully set the order of loads via environment variables: $> export NUMPY_BLAS_ORDER=openblas,mkl,atlas $> python setup.py config ... would first try OpenBLAS (if existing), then MKL, and finally ATLAS. In this case the build would fail if neither of OpenBLAS, MKL or ATLAS is present. I.e. this can also be easierly used to test whether a linking would work. This is because specifying a single library forces only one library check and has no fall-back procedure (as requested by the user!). The same applies to: NUMPY_LAPACK_ORDER=openblas,mkl,atlas This has meant that the blas_opt_info and lapack_opt_info classes in system_info.py has *completely* changed. Effectively there is only ONE change: A fall-back of LAPACK was previously using get_info('blas') to get the BLAS library to correctly link LAPACK. However, this may be undesirable when the user has OpenBLAS/BLIS/ATLAS in a BLAS only installation but wants to use the NetLIB LAPACK. Hence now lapack_opt_info uses get_info('blas_opt') which does change the fall-back routine slightly. But perhaps for an easier build? Signed-off-by: Nick Papior <[email protected]>
Also added a test to travis (apparently ATLAS=None... is not tested on circleCI). Signed-off-by: Nick Papior <[email protected]>
When a user requests NPY_BLAS/LAPACK_ORDER they can omit Netlib BLAS/LAPACK. In that case there will not be raised anything. This commit fixes this issue so that there will always be issues raised if the user hasn't requested the basic libraries. Signed-off-by: Nick Papior <[email protected]>
@rgommers regarding the Also do you prefer |
I see |
@charris oh yeah, there it was! 👍 I will fix the bug (in my code ;) )! |
Signed-off-by: Nick Papior <[email protected]>
I don't have strong feelings on that one either way. However, does it make sense for it to be a single value given that we already have |
Yes and no, if people want the control its main usage will probably be single value uses. Only in special cases can I see that users want to use it multi-value. You'll also note I have amended the build documentation a bit which I think clarifies its use. |
I think this is ready, I think it is fine to keep the names as is. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to do some testing, but want to submit my comments already.
Signed-off-by: Nick Papior <[email protected]>
Signed-off-by: Nick Papior <[email protected]>
Signed-off-by: Nick Papior <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the __doc__ or ''
fix, nice and compact.
This all looks good. With distutils
it's always hard to be really sure, but let's merge it and see how it does. Nice improvement overall.
* master: (25 commits) BUG: fix unravel_index when dimension is greater than 'intp' MANT: refactor unravel_index for code repetition (numpy#13446) BLD, TST: implicit func errors DOC: document existance of linalg backends BLD: streamlined library names in site.cfg sections (numpy#13157) MAINT: fixed typo 'wtihout' from numpy/core/shape_base.py BUG: fixing bugs in AVX exp/log while handling special value floats (numpy#13415) update sequence Add analysis check BUG: blindly add TypeError to accepted exceptions MAINT: fixed several PYTHONOPTIMIZE=2 failures BUG: fixed PYTHONOPTIMIZE run MAINT: fixed typo 'Mismacth' from numpy.core.setup_common.py MAINT: fixed last issues and questions according to numpy#13132 MAINT: improve efficiency of pad by avoiding use of apply_along_axis DOC: dimension sizes are non-negative, not positive BUILD, BUG: fix from review, fix bug in git_version MAINT: mention 'make dist' in error messsage BUILD: allow version-check to pass if GITVER is Unknown (sdist build) BUILD: fail documentation build if numpy version does not match ...
Prior to this enhancement compiling numpy would forcefully check BLAS/LAPACK
libraries in the following order:
BLAS:
LAPACK:
This is problematic if a user want to build using, say, OpenBLAS but MKL is installed.
Even populating the site.cfg correspondingly one would get a successful build, but
using MKL, if present.
The same applies to OpenBLAS vs. ATLAS etc.
Especially for developers this may be desirable to check performance with various
BLAS/LAPACK libraries.
This fixes the above issues by enabling users to forcefully set the order of loads
via environment variables:
$> export NUMPY_BLAS_ORDER=openblas,mkl,atlas
$> python setup.py config ...
would first try OpenBLAS (if existing), then MKL, and finally ATLAS.
In this case the build would fail if neither of OpenBLAS, MKL or ATLAS is present.
I.e. this can also be easierly used to test whether a linking would work. This
is because specifying a single library forces only one library check and has
no fall-back procedure (as requested by the user!).
The same applies to:
NUMPY_LAPACK_ORDER=openblas,mkl,atlas
This has meant that the
blas_opt_info
andlapack_opt_info
classes insystem_info.py
has completely changed.Effectively there is only ONE change:
A fall-back of LAPACK was previously using
get_info('blas')
to getthe BLAS library to correctly link LAPACK. However, this may be undesirable
when the user has OpenBLAS/BLIS/ATLAS in a BLAS only installation but wants
to use the NetLIB LAPACK. Hence now
lapack_opt_info
usesget_info('blas_opt')
which does change the fall-back routine slightly. But perhaps for an easier build?