-
-
Notifications
You must be signed in to change notification settings - Fork 22
Non-deterministic Libblastrampoline issue (?) when using SpecialFunctions, MKL
#845
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
Comments
using SpecialFunctions, MKL
cc @staticfloat |
@pablosanjose Does this still happen for you? If so:
I can't reproduce this on |
I'm getting the non-deterministic behaviour on mac, in exactly the same way as reported. It does not happen without MKL or if I load MKL before SpecialFunctions. I have MKL 0.4.0 and SpecialFunctions 1.4.2, and julia 28e30a3953 I also get the same exact incorrect answers for the first two evaluations, but then different ones (and then they all repeat) |
Hi, yes, still happening here, with latest nightly from the julialang webpage on macOS, and using your exact Manifest, @staticfloat. I also tried on Windows, and there the issue does not arise. My versioninfo:
|
I'm updating openspecfun_jll and SpecialFunctions to address JuliaPackaging/BinaryBuilderBase.jl#92. This is just a hunch and needed to be done anyways - but I haven't done any debugging to ascertain this might be the issue. |
Doesn't help. Because that only comes into effect with strings in Fortran. |
I tracked the root cause of this down to this issue: JuliaPackaging/BinaryBuilder.jl#700 (comment) Essentially, there is a conflict between |
Could you possibly use LBT to pick between libiomp and libgomp, or will everything freak out? |
Is loading MKL first a good and reliable solution? Is that something we should document in the MKL.jl README? |
This issue has nothing to do with LBT; it is purely an incompatibility between libiomp (which is a dependency of MKL) and libgomp (which is a dependency of
We could.... but as said in the comment I linked to, this only works because most software isn't using |
Documenting the fundamental incompatibility may still be a good idea, since it pops up every now and then |
Could have |
Are we causing mac to use different RTLD_LOCAL flags from the default dyld behavior? It seems that 2-level linking should prevent either library from seeing the other is loaded |
The default flags in JLL packages are |
I don't know if it is related to this issue, but FWIW I keep seeing non-deterministic (wrong) behavior using MKL on 1.7rc1, regardless of whether SpecialFunctions is loaded. Everything works fine with OpenBLAS... I know this is not very useful, sorry, the issue is difficult to isolate. |
MKL has a @staticfloat Would this be a straightforward issue of just using |
I only see the issue on mac, but there is no such Given how grave the issue is, would it be wiser not to provide MKL on mac at all? Can someone also try this out on Windows? |
@pabloferz If I do |
No, I get the same as before |
Hmm, that fixed it for me. What about https://github.com/JuliaLinearAlgebra/MKL.jl/pull/99/files |
Ah! It does seem that your PR fixes this! Care to explain why/how? |
Sequential MKL fixes the issue with threading discussed above in #845 We do need to only do this for MKL on mac to the best of my knowledge. |
Uhm, I see. But this has severe performance implications. With this patch we loose multithreaded matmul, for example, even if we don't use SpecialFunctions. I don't think that's an acceptable tradeoff. |
This is not in our control, unfortunately. Maybe there are other ways to fix this. Note that this is only a mac issue, and it is important for the default behaviour to be correct. |
The solution is to always load MKL before everything else if you end up using fortran libraries. It is now documented in https://github.com/JuliaLinearAlgebra/MKL.jl#usage I have also emailed Intel if there are better ways for libgomp and Intel OMP to co-exist. |
The problem with #845 is not happening for me with 1.8.2 but is with 1.9. I'm loading everything in the same order. |
I've hit an issue on v1.7 (not in 1.6 or below) which I suspect has to do with the new libblastrampoline mechanism. The issue arises when
using
both SpecialFunctions.jl and MKL.jl, in that order. The symptom of the issue is the followingA\B
not giving correct or even deterministic results in the following minimal example.The correct result is
24.772054506344052
The issue disappears if I remove either of the
using
lines, or if I load MKL before SpecialFunctions. Quite strange!I haven't been able to make a more minimal example of the issue yet, so I'm not sure where the problem lies (perhaps it is not even in Base, I'm not sure).
The text was updated successfully, but these errors were encountered: