-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: Xerbla doesn't get linked in 1.10-devel. #5383
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
This fixes #5362:
A different fix is needed for earlier versions of numpy. Probably adding
|
@opoplawski Heads up. Note that current Fedora 21 numpy is also broken in this regard. |
@@ -431,6 +431,7 @@ def pre_build(context): | |||
bld(target="multiarray_templates", source=multiarray_templates) | |||
if ENABLE_SEPARATE_COMPILATION: | |||
sources = [ | |||
pjoin('src', 'multiarray', 'python_xerbla.c), |
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.
typo, needs a '
at the end of python_xerbla.c
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, thanks.
@@ -1152,6 +1152,8 @@ def test_xerbla_override(): | |||
# and may, or may not, abort the process depending on the LAPACK package. | |||
from nose import SkipTest | |||
|
|||
XERBLA_OK = 255 |
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.
is this a valid return code?
aren't those limited to 127 on some systems?
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 don't know, it's valid on Linux, and windows returns 16 bit values. It can be anything that is not common.
strange this isn't seen in debian which also has atlas 3.10 and automatic tests of numpy against netlib, openblas and atlas (http://ci.debian.net/packages/p/python-numpy/) |
@juliantaylor Are you sure ATLAS 3.10 is getting linked? It isn't found by default and I didn't see the problem until I set up site.cfg to work correctly for that version. #5364 allows automatic detection. If someone would explain to me how a dynamic library can link to various different external functions of the same name in a safe way you will make me very happy :) |
yes but only the blas part, debian uses runtime interchangeable blas so numpy is linked against libblas.so.3 and which is just a symlink to the real library which can be any compatible one. |
I've been using a site config with
ATLAS also provides the needed lapack routines. Where does lapack come from on debian? |
normal netlib lapack, but atlas and its xerbla is loaded first |
Note that the xerbla test never fails, it just gets skipped. The verbose output needs to be checked for xerbla to see what happened. Either that or use |
also your example works fine in debian/ubuntu, even when manually linking against atlas |
the output of
on fedora might be interesting |
Fedora Numpy (1.8.2) shows
Which is a problem, the lapack_lite functions are linked against our xerbla. Numpy devel without this patch shows
|
why is it looking up the xerbla_ symbol when loading multiarray? |
I expect because |
but dotblas is not calling xerbla_ so it should not be binding it. |
Could it also be related to the compiler version? Using gcc version 4.9.2 here. Maybe I should fire up fedora 20 and see if this is a long standing problem. |
no the compiler should not directly be related to it, but the flags you are using to compile are, though only the linker flags prefixed with -Wl, |
I only see Yes, that should do it. Numpy won't link to system atlas by default, so site.cfg needs to be set up. |
why won't it pick up system atlas? didn't you add support for 3.10 recently? |
It hasn't been merged yet... Was thinking of doing that today. |
ok it seems the debian atlas is split into a fortran library that provides xerbla (libf77blas) and the regular library |
or this change, should work just as well. |
@@ -0,0 +1,51 @@ | |||
#include "Python.h" |
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.
can't you use the same file as from lapack?
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.
What do you mean?
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 meant linalg, this file is now twice in numpy, once in multiarray and once in numpy/linalg
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.
If you mean the same python_xerbla
source, it is inconveniently located in numpy/linalg/lapack_lite/python_xerbla.c`.
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.
is that a problem for reusing it?
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.
it doesn't use f2c.h
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.
That's because I removed the include for this version.
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.
weird I guess numpy.distutils automatically adds the include path then
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.
Your version is cleaner, so if it works it is preferable. We can give it a try and see if there are any problems.
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 think onefile compilation will not work
If the debian atlas 3.10 is split, that may cause problems for the automatic detection of 3.10, it doesn't look for split files as 3.10 doesn't normally do that. Does debian make it look like earlier versions of atlas? |
debian currently doesn't seem to offer a threaded atlas, only libatlas, that is covered by the old atlas detection logic multiarray is linked against libcblas, so no xerbla_ is pulled in, lapack_lite is linked against libf77blas so it picks up the xerbla_ but overrides it correctly. |
Oh, that's not a bad solution. Fedora seems a bit quicker to make incompatible changes. One improvement here might be to make the xerbla inclusion depend on |
Do you know if there is a problem with threaded atlas? Fedora Numpy is linked with the single threaded version. |
not that I know of, though in the past atlas had the problem that you had to define the threads at compile time and its not a runtime option like in openblas, so distributions had to pick the safe single threaded option. |
This is still broken for single file builds, I forgot to include it :( Will fix. |
Add our python_xerbla to the multiarray sources. That function is needed for all modules that link to the ATLAS 3.10 libraries, which are now all located in two files, libsatlas and libtatlas. Also make the test for xerbla linkage work better. If xerbla is not linked the test will be skipped with a message. Closes numpy#5362.
Fixed single file builds, made compilation of |
looks good, should make this fragile mechanism a bit more robust. |
I'll push a differenct fix for 1.9.x. |
OK, putting this in. Thanks for the review, Julian, I learned things :) |
BUG: Xerbla doesn't get linked in 1.10-devel.
Add our python_xerbla to the multiarray sources. That function is
needed for all modules that link to the ATLAS 3.10 libraries, which
are now all located in two files, libsatlas and libtatlas.
Also make the test for xerbla linkage work better. If xerbla is not
linked the test will be skipped with a message.
Closes #5362.