You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is painful for machines which don't have MKL installed. The MKL version bound against is the one using Intel's OpenMP, which is even less likely to be available on a machine (plus it's MKL-ML, not regular MKL nor MKL DNN - now DNNL).
We should make the build system a little more configurable, or at least set the default build to be something that works everywhere (even if the performance is worse).
I keep running into this when testing things on different machines here, none of which have MKL, and I have to get approvals for new inbound libraries.
System information
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux
TensorFlow installed from (source or binary): source
Sorry for the delay. GitHub notifications don't seem to work by default here for some reason.
MKL gets downloaded automatically by the Bazel build. I'm not sure I understand what the issue is. @Craigacp What's the exact error message that you're getting?
We can obviously add flags and stuff, that's fine.
Is libmklml supposed to be packaged and distributed in our native artifacts?
After running mvn package, I see the following in my target repository:
$ ls target/native/org/tensorflow/internal/c_api/macosx-x86_64/lib
libiomp5.dylib libjnitensorflow.dylib libmklml.dylib libtensorflow.2.dylib
But when listing the content of my native jar (macosx-x86_64 in my case), libiomp5 and libmklml have been discarded:
$ jar tvf target/tensorflow-core-api-0.1.0-SNAPSHOT-macosx-x86_64.jar
99 Sun Dec 01 21:30:42 EST 2019 META-INF/MANIFEST.MF
0 Sun Dec 01 21:30:42 EST 2019 META-INF/
0 Sun Dec 01 21:30:42 EST 2019 org/
0 Sun Dec 01 21:30:42 EST 2019 org/tensorflow/
0 Sun Dec 01 21:30:42 EST 2019 org/tensorflow/internal/
0 Sun Dec 01 21:30:42 EST 2019 org/tensorflow/internal/c_api/
0 Sun Dec 01 21:30:24 EST 2019 org/tensorflow/internal/c_api/macosx-x86_64/
0 Sun Dec 01 21:30:42 EST 2019 META-INF/maven/
0 Sun Dec 01 21:30:42 EST 2019 META-INF/maven/org.tensorflow/
0 Sun Dec 01 21:30:42 EST 2019 META-INF/maven/org.tensorflow/tensorflow-core-api/
702664 Sun Dec 01 21:30:22 EST 2019 org/tensorflow/internal/c_api/macosx-x86_64/libjnitensorflow.dylib
218643976 Sun Dec 01 21:30:26 EST 2019 org/tensorflow/internal/c_api/macosx-x86_64/libtensorflow.2.dylib
12792 Sun Dec 01 21:07:20 EST 2019 META-INF/maven/org.tensorflow/tensorflow-core-api/pom.xml
108 Wed Nov 06 22:59:04 EST 2019 META-INF/maven/org.tensorflow/tensorflow-core-api/pom.properties
In addition, FWIW, I have this warning on my side when compiling:
[INFO] Copying /Users/klessard/Documents/Projects/MachineLearning/Sources/tensorflow-java/tensorflow-core/tensorflow-core-api/bazel-tensorflow-core-api/external/mkl_darwin/lib/libiomp5.dylib
[INFO] Copying /Users/klessard/Documents/Projects/MachineLearning/Sources/tensorflow-java/tensorflow-core/tensorflow-core-api/bazel-tensorflow-core-api/external/mkl_darwin/lib/libmklml.dylib
[WARNING] Could not find library mklml_intel
If I build our repo, I get this message as well when running a program:
Caused by: java.lang.UnsatisfiedLinkError: /Users/klessard/.javacpp/cache/sample-suite-1.0-SNAPSHOT-jar-with-dependencies.jar/org/tensorflow/internal/c_api/macosx-x86_64/libjnitensorflow.dylib: dlopen(/Users/klessard/.javacpp/cache/sample-suite-1.0-SNAPSHOT-jar-with-dependencies.jar/org/tensorflow/internal/c_api/macosx-x86_64/libjnitensorflow.dylib, 1): Library not loaded: @rpath/libmklml.dylib
Referenced from: /Users/klessard/.javacpp/cache/sample-suite-1.0-SNAPSHOT-jar-with-dependencies.jar/org/tensorflow/internal/c_api/macosx-x86_64/./libtensorflow.2.dylib
Reason: image not found
at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2617)
at java.base/java.lang.Runtime.load0(Runtime.java:767)
at java.base/java.lang.System.load(System.java:1831)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1457)
Should/could we distribute libmklml ourself? If not, can we easily turn the --config=mkl off at compile time (maybe using a maven profile)?
Like I said, it is already distributed with the org.bytedeco artifact. This looks like some loading issue on Mac. Including it in the artifact for TensorFlow is going to end up with the same error. I'll look into that later, but like I said, this isn't something that Intel is maintaining anymore anyway, so let's not worry about it. I'll create a patch to disable this config by default, and include it in an extension for JavaCPP instead that the user needs to enable explicitly.
I do get this issue on Linux, it requires me to have MKL & Intel's OpenMP installed on the library path. After NeurIPS I can clean up a machine and try again to get the exact error message.
Ah, I think I understand what the issue is. You guys are probably adding dependencies on tensorflow-core instead of tensorflow-core-platform. The former won't add a dependency on MKLML, that's intentional, for users that know they have it on their system. Casual users should use tensorflow-core-platform which will get everything needed. But that's going to move to tensorflow-core-platform-mkl and such.
Hi, I would like also explore the Tensorflow Java JNI lib with MLK DNN, can I know which Tensorflow version already have MLK-DNN built in? @saudet , can I know which release have your change? Thanks
Thanks @karllessard , I have gone through the readme, and found out current 0.1.0 SNAPSHOT mapped to Tensorflow version 2.2.0. 0.1.0-SNAPSHOT | 2.2.0, if we need to stick to an old version, let's see 1.13.1, can we still manage to use these? is these dependency backward compatible with old tensorflow version?
Thanks, it seems starts with 1.15.x tensorflow version, somehow we need to have 1.13.1 version, so this javacpp-presets can not support backward compatible TF version, right?
Thanks, dose those dependency already including like openmp driver? or do we need to check our platform(based on windows) whether they have such support?
Activity
karllessard commentedon Nov 25, 2019
@saudet, any suggestion for this?
saudet commentedon Nov 29, 2019
Sorry for the delay. GitHub notifications don't seem to work by default here for some reason.
MKL gets downloaded automatically by the Bazel build. I'm not sure I understand what the issue is. @Craigacp What's the exact error message that you're getting?
We can obviously add flags and stuff, that's fine.
karllessard commentedon Dec 2, 2019
Is
libmklmlsupposed to be packaged and distributed in our native artifacts?After running
mvn package, I see the following in my target repository:But when listing the content of my native jar (macosx-x86_64 in my case),
libiomp5andlibmklmlhave been discarded:$ jar tvf target/tensorflow-core-api-0.1.0-SNAPSHOT-macosx-x86_64.jar 99 Sun Dec 01 21:30:42 EST 2019 META-INF/MANIFEST.MF 0 Sun Dec 01 21:30:42 EST 2019 META-INF/ 0 Sun Dec 01 21:30:42 EST 2019 org/ 0 Sun Dec 01 21:30:42 EST 2019 org/tensorflow/ 0 Sun Dec 01 21:30:42 EST 2019 org/tensorflow/internal/ 0 Sun Dec 01 21:30:42 EST 2019 org/tensorflow/internal/c_api/ 0 Sun Dec 01 21:30:24 EST 2019 org/tensorflow/internal/c_api/macosx-x86_64/ 0 Sun Dec 01 21:30:42 EST 2019 META-INF/maven/ 0 Sun Dec 01 21:30:42 EST 2019 META-INF/maven/org.tensorflow/ 0 Sun Dec 01 21:30:42 EST 2019 META-INF/maven/org.tensorflow/tensorflow-core-api/ 702664 Sun Dec 01 21:30:22 EST 2019 org/tensorflow/internal/c_api/macosx-x86_64/libjnitensorflow.dylib 218643976 Sun Dec 01 21:30:26 EST 2019 org/tensorflow/internal/c_api/macosx-x86_64/libtensorflow.2.dylib 12792 Sun Dec 01 21:07:20 EST 2019 META-INF/maven/org.tensorflow/tensorflow-core-api/pom.xml 108 Wed Nov 06 22:59:04 EST 2019 META-INF/maven/org.tensorflow/tensorflow-core-api/pom.propertiesIn addition, FWIW, I have this warning on my side when compiling:
saudet commentedon Dec 2, 2019
It gets extracted from the org.bytedeco package, but this is going away with newer versions of MKL-DNN/DNNL, so we don't need to worry about that.
karllessard commentedon Dec 8, 2019
Any progress on this issue?
If I build our repo, I get this message as well when running a program:
Should/could we distribute
libmklmlourself? If not, can we easily turn the--config=mkloff at compile time (maybe using a maven profile)?saudet commentedon Dec 8, 2019
Like I said, it is already distributed with the org.bytedeco artifact. This looks like some loading issue on Mac. Including it in the artifact for TensorFlow is going to end up with the same error. I'll look into that later, but like I said, this isn't something that Intel is maintaining anymore anyway, so let's not worry about it. I'll create a patch to disable this config by default, and include it in an extension for JavaCPP instead that the user needs to enable explicitly.
Craigacp commentedon Dec 8, 2019
I do get this issue on Linux, it requires me to have MKL & Intel's OpenMP installed on the library path. After NeurIPS I can clean up a machine and try again to get the exact error message.
saudet commentedon Dec 9, 2019
Ah, I think I understand what the issue is. You guys are probably adding dependencies on
tensorflow-coreinstead oftensorflow-core-platform. The former won't add a dependency on MKLML, that's intentional, for users that know they have it on their system. Casual users should usetensorflow-core-platformwhich will get everything needed. But that's going to move totensorflow-core-platform-mkland such.zhangruiskyline commentedon May 26, 2020
Hi, I would like also explore the Tensorflow Java JNI lib with MLK DNN, can I know which Tensorflow version already have MLK-DNN built in? @saudet , can I know which release have your change? Thanks
saudet commentedon May 27, 2020
Add a dependency on
tensorflow-core-platform-mkl, that will pull in those binaries.zhangruiskyline commentedon May 27, 2020
Thanks @saudet
we already have
tensorflowandlibtensorflow_jniin our POM.xml, should we just addtensorflow-core-platform-mklor replace some other dependency?Also we have tensorflow version 1.13.1, is it compatible with
tensorflow-core-platform-mkl?Thanks
saudet commentedon May 27, 2020
No, it's not compatible. You'll need to replace all that.
zhangruiskyline commentedon May 27, 2020
Thanks @saudet , can I have a rough idea how to replace all? do I need to have all dependency in https://github.com/tensorflow/java/tree/master/tensorflow-core/tensorflow-core-platform-mkl? or how can I work out some solution? new to Java TF so would like to have some advice. Thanks
saudet commentedon May 27, 2020
Try the examples at https://github.com/tensorflow/java-models/
zhangruiskyline commentedon May 27, 2020
Thanks , is it some private build? I checked the https://mvnrepository.com/artifact/org.tensorflow and can not find tensorflow-core-platform-mkl
also I can see in POM
which tensorflow version dose this
0.1.0-SNAPSHOThas?Thanks
karllessard commentedon May 27, 2020
Hi @zhangruiskyline , please take a look at the README page of this repository, it explains how to fetch these artifacts (only available as snapshots for now): https://github.com/tensorflow/java
zhangruiskyline commentedon May 27, 2020
Thanks @karllessard , I have gone through the readme, and found out current 0.1.0 SNAPSHOT mapped to Tensorflow version 2.2.0.
0.1.0-SNAPSHOT | 2.2.0, if we need to stick to an old version, let's see 1.13.1, can we still manage to use these? is these dependency backward compatible with old tensorflow version?saudet commentedon May 28, 2020
We can use builds from here for that:
https://github.com/bytedeco/javacpp-presets/tree/master/tensorflow#introduction
zhangruiskyline commentedon May 28, 2020
Thanks, it seems starts with 1.15.x tensorflow version, somehow we need to have 1.13.1 version, so this javacpp-presets can not support backward compatible TF version, right?
saudet commentedon May 28, 2020
There are old versions yes: https://github.com/bytedeco/javacpp-presets/tree/1.5/tensorflow
zhangruiskyline commentedon May 28, 2020
Thanks, dose those dependency already including like openmp driver? or do we need to check our platform(based on windows) whether they have such support?
saudet commentedon May 28, 2020
zhangruiskyline commentedon May 29, 2020
Thanks @saudet
I am checking two of the mvn repo:
https://mvnrepository.com/artifact/org.bytedeco/mkl-dnn-platform/0.18.1-1.5
https://mvnrepository.com/artifact/org.bytedeco/tensorflow/1.13.1-1.5
So I think I can just replace my current pom dependency:
with is new one below, or do I still miss sth?
Merge pull request tensorflow#4 from tensorflow/master