-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
ABI conflicts due to 64-bit libopenblas.so #4923
Comments
Or is the problem worse than that? If I In that case, we might have to hack OpenBLAS to rename its exported functions (e.g. |
@xianyi, is there a way to tell OpenBLAS to add a prefix or suffix (e.g. |
See also numpy/numpy#3916 |
Wouldn't it make more sense to put the |
The ideal solution would be to have a separate 64-bit ABI and build both 32 and 64 bit versions in the same library. |
@ViralBShah that is actually the best solution here. That would be wonderful! |
@StefanKarpinski, note that there is a Fortran |
Currently we use the fortran abi only. |
I wonder if we can somehow make matplotlib use its own blas. While we may be able to do all sorts of gymnastics with openblas, it will be difficult to do the same with vendor provided BLAS. |
The other alternative would be to recompile our own numpy, but that makes installing PyCall much more of pain. |
@ViralBShah, does MKL provide the 64-bit ABI? |
Not to mention that the amount of stuff we compile ourselves is getting slightly ridiculous. But it's hard to avoid. |
I believe MKL does have a 64-bit ABI - but not 100% sure. @andreasnoackjensen ? |
I thought about recompiling numpy, but that is even more inconvenient. |
I am not sure what exactly ABI mean, but MKL has 32 bit integers in the *lp64 libraries and 64 bit integers in the *ilp64 libraries. The symbols have the same names. |
It's easy to add a prefix or suffix for 64-bit (ilp64) ABI. However, I am not sure OpenBLAS can support lp64 and ilp64 in one binary. For MKL, you need link the application with different interface layer library, e.g. libmkl_intel_lp64.so or libmkl_intel_ilp64.so. |
I think adding a prefix or suffix to the |
@xianyi, is there any hope of progress on this? |
Would naming the 64-bit version something like |
@ViralBShah, I'm not sure, but I doubt it. If you load two shared libraries which export the same symbol (e.g. |
The easier thing then for now would be to just use the 32-bit version of openblas with IJulia, if that works. |
Nassty 32-bit limits, we hates them forever! Anyway, it's not just IJulia, since PyCall and Numpy can be used anywhere. And 32-bit vector size limits cause their own problems. |
+1, we ran into a very similar issue here too: jump-dev/Ipopt.jl#1 (comment)
Any library linking to any LP64 shared library Blas/Lapack/etc can run into name shadowing and segfaults or other incorrect behavior when Since #5291 was merged there are now a handful of calls to cblas functions, otherwise I was going to suggest we could try co-opting OpenBlas' mechanism for handling trailing underscores as a potential way of attempting this. |
We could always just patch the openblas source with a global s/cblas/jl_cblas/ substitution. |
Isn't this mostly a visibility issue? Can we restrict openblas's symbols to not be visible to dlopen'ed shared libraries? |
@mlubin, you're right that this would be the simplest option, if we can do it on all the relevant platforms. Is there a magic linker flag for this (analogous to |
Looks like if you want to avoid patching you need to use a linker script. |
Yeah, weird idea... It's also true that searching for e.g. |
And people using ILP64 BLAS libraries from Fortran have to worry about compiler-dependent name mangling. Anyway, I've got step 2 from #4923 (comment) mostly done, I think I'll post a WIP PR soon so people can look at it. |
Since there is no technical reason to prefer one suffix over another as far as I can see, any little thing tips the scales, so I would go with the SUN64 convention. |
A good read on usage of versioned elf shared libs: http://www.akkadia.org/drepper/dsohowto.pdf On Sun, Oct 19, 2014 at 10:56 AM, Steven G. Johnson <
Those who don't understand recursion are doomed to repeat it |
Footnote here - for a similar setup on Linux, apparently http://list.coin-or.org/pipermail/ipopt/2015-January/003931.html |
Does anyone have contacts at Intel who they can bug about offering a similar renamed-symbol option for MKL? I'm tired of people having crashes when using numpy or PyPlot from Julia MKL builds. |
I do. Not sure how much it will help. |
At least they should be made aware of it — it's a huge flaw in their current offerings because it makes MKL non-composable. |
Also, maybe MKL builds of Julia should default to using the 32-bit interface. The number of people who need the 64-bit interface is probably dwarfed by the number of people who will be bitten by library conflicts if they link other code that uses BLAS. |
That is a good idea. |
Julia compiles OpenBLAS to
libopenblas.so
. This may be a problem for calling libraries that link to a systemlibopenblas.so
, because the runtime linker may substitute Julia's version instead. The problem is that Julia's version is compiled with a 64-bit interface, which is not the default, and so if an external library calls it expecting a 32-bit interface, a crash may result.We encountered what appears to have been this problem n @alanedelman's machine (julia.mit.edu). He recently started experiencing crashes in
PyPlot.plot
that, with the help of valgrind, I tracked down to apparently:Apparently, Matplotlib is calling OpenBLAS (via NumPy:
_dotblas.c
is a NumPy file) with the 32-bit interface, but is getting linked at runtime into Julia's openblas library, which is compiled with a 64-bit interface. Recompiling Julia and openblas withUSE_BLAS64=0
worked around the problem, but it would be better to avoid the conflict.Can we just rename our
libopenblas.so
file to avoid any possible conflict in the runtime linker?The text was updated successfully, but these errors were encountered: