-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
ENH: add support for ILP64 OpenBLAS (without symbol suffix) #15069
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
|
cf64ab2
to
761e690
Compare
Ok, I think this is now converged, ready for review. |
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 tested this locally on a machine with 128 GB phys mem and it did work after an initial failure, and I needed to change something in the feature branch so I will at least note that in my review---whether you think it warrants an additional comment is up to you I guess:
- Install 64-bit OpenBLAS with no symbol adjustment using
spack
with gcc compiler:spack install openblas@0.3.7+ilp64 %gcc@7.4.0
- Adjust
site.cfg
to point to that particular OpenBLAS:
[openblas_ilp64]
libraries = openblas64
library_dirs = /home/tyler/github_projects/spack/opt/spack/linux-ubuntu18.04-skylake_avx512/gcc-7.4.0/openblas-0.3.7-arju45l32hlynt7mpqlnwmcgthh2fm5u/lib
include_dirs = /home/tyler/github_projects/spack/opt/spack/linux-ubuntu18.04-skylake_avx512/gcc-7.4.0/openblas-0.3.7-arju45l32hlynt7mpqlnwmcgthh2fm5u/include
runtime_library_dirs = /home/tyler/github_projects/spack/opt/spack/linux-ubuntu18.04-skylake_avx512/gcc-7.4.0/openblas-0.3.7-arju45l32hlynt7mpqlnwmcgthh2fm5u/lib
symbol_prefix =
symbol_suffix =
-
Run the test for 64-bit integer support:
NPY_USE_BLAS_ILP64=1 NPY_BLAS_ILP64_ORDER=openblas_ilp64 NPY_LAPACK_ILP64_ORDER=openblas_ilp64 python runtests.py --mode=full -t "numpy/linalg/tests/test_linalg.py::test_blas64_dot" -- -rsx
-
Fails with
libraries openblas64 not found in ['/home/tyler/github_projects/spack/opt/spack/linux-ubuntu18.04-skylake_avx512/gcc-7.4.0/openblas-0.3.7-arju45l32hlynt7mpqlnwmcgthh2fm5u/lib']
-
Inspect contents of that path and see these files:
cmake libopenblas.a libopenblas_haswell-r0.3.7.a libopenblas_haswell-r0.3.7.so libopenblas.so libopenblas.so.0 pkgconfig
-
Modify
site.cfg
to look foropenblas
shared library without the64
suffix (I'm talking about the library name, not the symbols). -
Success:
Building, see build.log...
Build OK
NumPy version 1.19.0.dev0+761e690
NumPy relaxed strides checking option: True
. [100%]
1 passed in 17.16s
Oh, one more comment here---I realized that the CI doesn't currently have access to ILP64 OpenBLAS (until we merge your upstream PR on The test invocation was:
|
Quite hard to see how that could be connected to the changes here --- since this is not touching f2py at all, and that f2py test is not using lapack. It also doesn't repro here. |
Generalize the ILP64 BLAS/LAPACK symbol name handling to deal with arbitrary prefix/suffix. The build-time behavior is changed so that HAVE_BLAS_ILP64 and BLAS_SYMBOL_SUFFIX/PREFIX defines are added to compile options as appropriate. Mainly to make autodetection of BLAS/LAPACK easier for downstream numpy.distutils users, add get_info aliases 'blas_ilp64_opt', 'blas_ilp64_plain_opt', and 'blas64__opt' for any/no/""&"64_" prefix&suffix, and the same for lapack. (Due to the way system_info works, each also gets a separate class.) In addition to openblas64_ which has a fixed suffix, add the (by default suffixless) openblas_ilp64, which correspond to the most likely cases to be present.
Revise the BLAS name mangling to support the general scheme.
Changing these to support ILP64 blas was missed in numpygh-15012
The |
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.
Ok, the 64-bit test is passing on two different machines for me now (one WSL, the other native Linux) with this feature branch.
The full test suite is now also okay for me on both machines (including the one previously complaining about f2py
) with the ILP64 OpenBLAS linked in.
I think the 1.18 release note now needs a tweak to mention support for non-suffixed 64-bit OpenBLAS. |
doc/source/user/building.rst
Outdated
|
||
The order in which they are preferred is determined by | ||
``NPY_BLAS_ILP64_ORDER`` and ``NPY_LAPACK_ILP64_ORDER`` environment | ||
variables, similarly as above. |
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.
nit: maybe "similarly as above" -> "which is openblas64_,openblas_ilp64
by default"
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.
Fixed. (also the release note).
tests are failing because pip cannot find |
Thanks Pauli. |
if (stride <= INT_MAX) { | ||
#else | ||
if (stride <= NPY_MAX_INT64) { | ||
#endif | ||
return stride; |
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.
xref gh-17111, the return type here is int
, but we're comparing against the bounds for int64
Generalize the ILP64 BLAS/LAPACK symbol name handling to deal with
arbitrary prefix/suffix.
The build-time behavior is changed so that HAVE_BLAS_ILP64 and
BLAS_SYMBOL_SUFFIX/PREFIX defines are added to compile options
as appropriate.
Mainly to make autodetection of BLAS/LAPACK easier for downstream
numpy.distutils users, add get_info aliases 'blas_ilp64_opt',
'blas_ilp64_plain_opt', and 'blas64__opt' for any/no/""&"64_"
prefix&suffix, and the same for lapack. (Due to the way system_info
works, each also gets a separate class.)
In addition to openblas64_ which has a fixed suffix, add the (by default
suffixless) openblas_ilp64, which correspond to the two most likely cases to
be present.
Moreover: add ilp64 blas support to
*_dot, *_vdot, *_matmul
, whichwere missed in the previous pass (sorry...)
Similar thing could be easily done for other BLAS libraries in
system_info.py
. Users can also setCFLAGS="-DHAVE_BLAS_ILP64"
to turn the 64-bit ABI on for any BLAS/LAPACK (however, I'd not advertise
that as the "public" way to turn this stuff on).