-
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
[MKL-DNN] How to tell javacpp to compile and use mkl-dnn with system-provided MKL? #629
Comments
That's an issue with MKL-DNN, it wants to use it's own version of MKL. If you've got everything installed on your system like you need it though, do like it's being done for MKL due to its licensing, that is,
Then it's going to load MKL-DNN and MKL from your system files like any other native application! |
Supercool! I'll try that as soon as #628 is resolved. |
Though, since it looks like you'll need to remove |
@saudet Thanks! After a lot of thinkering, I made it work as I expected. I'm fine with maintaining my own fork, but it would be, of course, better if we can make somehing like this available in javacpp-presets. For reference, here's what I did:
|
It should be possible to modify everything so that we can have it build
using files from the system using an option. The mklml presets can also be
redirected to the files of the full MKL installation for simplicity.
|
I think the way to go about this would be with an extension, like we have |
Actually, this is more about MKL on the system than about MKL-DNN, so I think it would make more sense to have an |
That describes my use case exactly! |
Actually, we can do even better, we can link with MKL at runtime, just like the wrappers for OpenBLAS are already doing. I've implemented this in the last commit, so try to run your application after setting the system properties as per the added documentation here: https://github.com/bytedeco/javacpp-presets/tree/master/mkl-dnn#documentation |
Thank you so much! Can I expect this to show in the SNAPSHOT build soon, or I'll have to build from source if I wanted to test this in the next few days? |
Yes, it will be in the snapshots sometime tomorrow. |
Another clarification: since the problem was not mklml itself, but it trying to load the second instance of iomp5, with this setup, that should or should not be an issue? If mkl_rt and iomp5 have already been loaded by another java code external to javacpp, javacpp will recognize that they are present and not try to load them redundantly? |
As long as they are loading the same files from the system, there shouldn't be any problems, yes. |
Fantastic! Thank you. |
BTW, the new license actually permits redistributing the full version of MKL itself, see commit 03c5fdf, so it is now being bundled! Enjoy |
Hi,
Javacpp's mkl-dnn works well for me, but I have the following problem:
In my project, I have a code that loads and calls system-wide MKL (via
mkl_rt
), which in turn loadslibiomp.so
. Javacpp's mkl-dnn buildsmkldnn
to use a custommklml
build that it packs itself. That's all right. However, the problem arises when both MKL distributions try to loadlibiomp.so
- MKL itself check whether that happens and kills the process with the message that it doesn't allow two instances of libiomp to be loaded at the same time (there is a workaround to tell it to ignore this, but it is out of the question because it slows MKL many times).I'm trying to build a custom build of javacpp/mkldnn that will configure mkldnn to use MKL provided by the system. I've successfully built mkldnn to do that, but the thinkering that I've tried in javacpp lead me to no success - later I figured out that I can't even build javacpp/mkldnn without changes (#628).
Anyway, how should I approach this?
The text was updated successfully, but these errors were encountered: