-
Notifications
You must be signed in to change notification settings - Fork 744
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
DNNL's libiomp.dylib clashes with system's MKL #907
Comments
libiomp.dylib isn't getting bundled. Where did you see that? |
A typo: it's libomp.dylib in .m2/repository/org/bytedeco/dnnl/1.5-1.5.3 But everything else stands: when I remove it, the problem disappears. |
It's a dependency of libdnnl.1.dylib. It won't be able to load without it. |
Update: the linux binary bundles libgomp.so, while Windows doesn't bundle anything. Regarding it being dependency of libdnnl, do you have idea why it isn't a problem on linux, while it is a problem on mac? |
Not loading it will result in DNNL not loading. It won't work. |
Interestingly, 1.3-1.5.3 does not bundle it. |
The proper solution is probably to build DNNL without OpenMP, using TBB instead. |
Now it's 3AM here, so not now, but otherwise yes. Can you point me to the proper place to change that? |
Also, did you see my message about openmp not being bundled in 1.3 and earlier versions? Was it introduced in DNNL upstream, or it's a javacpp-specific change? |
In the cppbuild.sh script: https://github.com/bytedeco/javacpp-presets/blob/master/dnnl/cppbuild.sh |
It's also possible to build without OpenMP or TBB, that's what it does on Mac by default. |
Now I'm confused. It's building it without OMP and TBB, yet, the lib is bundled? |
You can check old versions of the cppbuild.sh in the repository as well. It's not something that changes only upstream, no. |
No, it's building with OpenMP. That's why it's bundling the library, otherwise it wouldn't be able to load. |
You might be OK without OpenMP or TBB, but some users actually use DNNL for performance reasons, so I don't think it would be a good idea to just disable OpenMP. I think using TBB would be satisfactory, so let's please do that. |
Now I see that this change was made recently: If I understood correctly, previously it did not bundle OpenMP, and there were performance issues (on mac or on all systems)? I definitely care about performance, too. In my experience, previous builds on Linux were equally performant as the latest (might be different on mac). At least we identified when this issue appeared, and you gave me valuable pointer about TBB. Will try to make it work in a few days, and will report here (or cry for help :) |
Ok, I've made the switch. Please give it a try with 1.5.1-1.5.4-SNAPSHOT. Thanks! |
Hi @saudet It works better now. I still have some issue on macOS, but that is probably DNNL, instead of javacpp. I've looked at the recent changes, and -liomp switch is still there, and the only change seems to be DNNL 1.5 -> 1.5.1 Can you be more specific about what switch you are referring to, so I can investigate further? Thank you! |
Just the switch from OpenMP to TBB. There's no more OpenMP or |
I was expecting that, but looking at this:
I must be looking at the wrong place? |
Hm, something is off here. On Linux, 1.5.1-1.5.4-SNAPSHOT became almost twice as slow in my examples as 1.5-1.5.4-SNAPSHOT. Did you make the switch to TBB on macOS only, or on all systems (Linux and Windows were not affected by the OpenMP loading issue previously). |
Yes, you are, see commit 083ec08.
It's possible that TBB is slower. Please ask upstream about this, and figure out what you'd like to do. |
I know what I'd like. I was happy with OpenMP on Linux, I am happy with TBB on macOS :) Is it possible to keep OpenMP on Linux and Windows, and only fix the macOS conflict by using TBB on macOS? |
Why? You're saying it's not working for you on Mac anyway, so if you're happy with OpenMP everywhere, we'll switch back to that! Please make up your mind or I will make it up for you. |
I guess I didn't explain this well. The TBB switch fixed the OpenMP loading issue on macOS. |
Of course, it doesn't use OpenMP anymore. In any case, I'll leave it at TBB for now, and when you figure out how you want it exactly over the next few days/weeks, we'll repatch that accordingly. Sounds good? |
Sure! Thanks! |
I propose to make the change as minimal as possible, and just fix the macOS issue with minimal changes, without changing what worked well before (Linux and Windows). My suggestion is to:
This way, DNNL will work well on Linux and Windows, and the issue will be resolved on macOS.
|
You're saying the build doesn't work for you on Mac anyway, so please get that working first, and we'll see after that. |
…name as MKL to prevent conflicts (issue #907)
It turns out that |
@saudet I can confirm that it works on Linux and on macOS (albeit strangely it clashes on mac when I run my JVM from emacs, but I can live with that constraint; when I start JVM from terminal, it loads the libs without complaints). Thank you so much. As far as I'm concerned, this issue can be closed. |
Workaround included in version 1.5.4. Thanks for reporting and for testing this! |
Hi,
This is literary the same issue as the previously resolved #629, but on macOS.
Namely, on my Linux box everything works well, according to the solution from #629. However, on my macOS laptop, the duplicate libiomp issue arises because javacpp's dnnl jar bundles libiomp.dylib and tries to load it, but my system's MKL have already loaded it.
Interestingly, the same setup on Linux has no issues.
I have set up jvm options, and they work on Linux, but seem to be ignored on macOS?
"-Dorg.bytedeco.javacpp.mklml.load=mkl_rt"
"-Dorg.bytedeco.javacpp.pathsfirst=true"
Another hint: when I go into my local maven ropository's javacpp dnnl jar, and butcher it by deleting libiomp.dylib and repackaging it again, this issue disappears.
Any ideas how to approach this?
The text was updated successfully, but these errors were encountered: