I'm trying to run a dl4j model using GPU instead of CPU. The model runs perfectly well using CPU. So I decided to try CUDA to be able to to take advantage of the my GPU. I followed every step described in here and for the CUDA install I followed the instructions from NVIDIA to install CUDA Toolkit from here. The code compiles ok but I get an error:
Skipped [JCublasBackend] backend (unavailable): java.lang.UnsatisfiedLinkError: C:\Users\albertb\.javacpp\cache\cuda-10.2-7.6-1.5.3-windows-x86_64.jar\org\bytedeco\cuda\windows-x86_64\jnicudart.dll: Can't find dependent libraries
Exception in thread "main" java.lang.ExceptionInInitializerError
at TestCUDA.run(TestCUDA.java:12)
at TestCUDA.main(TestCUDA.java:7)
Caused by: java.lang.RuntimeException: org.nd4j.linalg.factory.Nd4jBackend$NoAvailableBackendException: Please ensure that you have an nd4j back-end on your classpath. Please see: https://deeplearning4j.konduit.ai/nd4j/backend
at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5094)
at org.nd4j.linalg.factory.Nd4j.<clinit>(Nd4j.java:270)
... 2 more
Caused by: org.nd4j.linalg.factory.Nd4jBackend$NoAvailableBackendException: Please ensure that you have an nd4j backend on your classpath. Please see: https://deeplearning4j.konduit.ai/nd4j/backend
at org.nd4j.linalg.factory.Nd4jBackend.load(Nd4jBackend.java:221)
at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5091)
... 3 more
My project was created using Maven on IntelliJ. All the dependencies are ok I guess otherwise the code would not compile. Some back-end dependency or library or install must be missing.
May be a version incompatibility is the problem.
The message Please ensure that you have an nd4j backend on your classpath
gives me some hint about some back-end jar that must be there. But Maven is supposed to take care of that... as far as I know.
I searched internet for some solution or example or tutorial.. anything !! There are all colones of the same instruction from the links above.
Some technical info:
- Windows 10
- Java 1.8 IntelliJ + Maven
- dl4j 1.0,0-beta7
- nd4j-cuda-10.2
- CUDA 11.1 - latest version today
I'll keep trying to solve the problem but I would appreciate any help. Thanks.
You likely have the wrong cuda version installed. The nd4j cuda version is specified in the artifact id like: nd4j-cuda-11.0/10.2.
If you want, you can use the redist artifacts from javacpp for this: https://search.maven.org/artifact/org.bytedeco/cuda-platform-redist/11.0-8.0-1.5.4/jar
This is the latest version for cuda 11. Nd4j just uses javacpp underneath for all of its native interop.