0

I've followed about every tutorial I could find, but somehow I can't seem to get Nd4j to work with a Cuda backend. I think I'm missing a library, but I can't figure out which one or where to download it.

The error I'm getting is:

18:23:23.872 [main] WARN  org.nd4j.linalg.factory.Nd4jBackend - Skipped [JCublasBackend] backend (unavailable): java.lang.UnsatisfiedLinkError: no cudart in java.library.path
18:23:23.958 [main] INFO  org.nd4j.linalg.factory.Nd4jBackend - Loaded [CpuBackend] backend

I'm using Nd4j and I have (amongst a whole bunch of others) the following jars on my class path:

nd4j-native-1.0.0-beta3.jar
nd4j-native-api-1.0.0-beta3.jar
cuda-10.0-7.3-1.4.3.jar
nd4j-cuda-10.0-1.0.0-beta3.jar. 

Cuda 10.0 is successfully installed:

C:\Users\username>nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:04_Central_Daylight_Time_2018
Cuda compilation tools, release 10.0, V10.0.130

I tried to point Java to the Cuda bin directory like so:

-Djava.library.path="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin"

but that makes no difference. Furthermore, I've tried the mvn command on the pom.xml's inside nd4j-cuda-10.0-platform-1.0.0-beta3.jar and cuda-platform-10.0-7.3-1.4.3.jar, which results in a download of a lot of jars, but none of them appear to contain the dll I'm missing.

When searching around I found other users talking about jars like 'cuda-10.0-7.3-1.4.3-windows-x86_64.jar' that should contain a jnicudart.dll, but I can't find such a jar anywhere. What am I missing here?

--UPDATE-- I've updated everything to beta5, and found a cuda jar containing the missing jnicudart.dll, but I still get the same error. I have used Dependencies to check what's wrong, and this is the result: enter image description here

It says the checksum of the NVidia cudart64_100.dll is incorrect. Would this be related to NVidia Cuda10 not supporting my Geforce GT 730 because it is a Fermi architecture? Or is the cuda installation corrupt or something?

hinsbergen
  • 147
  • 2
  • 11
  • Something else is missing. Try to use the Dependencies to tool to find out what: https://github.com/bytedeco/javacpp-presets/wiki/Debugging-UnsatisfiedLinkError-on-Windows – Samuel Audet Nov 22 '19 at 02:20
  • I tried this, but could't get it to work either: try { Loader.load(org.bytedeco.cuda.global.cudart.class); } catch (UnsatisfiedLinkError e) { try { String path = Loader.cacheResource(org.bytedeco.cuda.global.cudart.class, "windows-x86_64/jnicudart.dll").getPath(); new ProcessBuilder("D:\\Dependencies_x64_Release\\DependenciesGui.exe", path).start().waitFor(); } catch (IOException e1) { e1.printStackTrace(); } catch (InterruptedException e1) { e1.printStackTrace(); } } this throws a nullpointer on getPath()...?? – hinsbergen Nov 22 '19 at 09:15
  • That probably means the JAR containing that file isn't in the class path. Make sure it is. – Samuel Audet Nov 22 '19 at 09:20
  • I would like to, but I can't find a jar that contains 'jnicudart.dll'. I found the file 'cuda-10.0-7.3-1.4.3-windows-x86_64.jar' here: https://repo1.maven.org/maven2/org/bytedeco/cuda/10.0-7.4-1.5/, that contains jnicuda.dll, jnicublas.dll, jnicudnn.dll and more, but no 'jnicudart.dll'. I even tried renaming jnicuda.dll to jnicudart.dll, but I get other errors then (not surprisingly) – hinsbergen Nov 22 '19 at 09:53
  • OK, made some progress, it appears that I had the wrong jar version. cuda-10.0-7.4-1.5-windows-x86_64.jar does contain the jnicudart.dllm and I can get DependenciesGui to run now. Still errors however, trying to figure out what's wrong using Dependencies – hinsbergen Nov 22 '19 at 11:07
  • Please use Maven. Don't try to add JAR files manually to the class path. – Samuel Audet Nov 26 '19 at 06:08
  • I am working in an OSGi environment, which results in about a million problems when trying to embed nd4j / dl4j in it. I had to add the jars manually therefore, but as it says in the answer, I finally managed. In the end I bought a new GPU and have everything running now under OSGi / cuda 10.1 / nd4j beta5. – hinsbergen Nov 27 '19 at 08:01

2 Answers2

1
  1. please update your nd4j/dl4j version to 1.0.0-beta5
  2. please tell me, what’s your GPU model name and nvidia driver version? i.e. show nvidia-smi output.
raver119
  • 336
  • 1
  • 5
  • The GPU is an NVIDIA GeForce GT 730. It is listed here: https://developer.nvidia.com/cuda-gpus as suitable for Cuda. The driver version is 388.13. I will try updating to beta5. – hinsbergen Nov 21 '19 at 20:10
  • 1
    Some variants of GT 730 are Fermi devices which would be consistent with your 388.xx driver version. If you have a Fermi device it will not work with CUDA 10. And in any event 388.xx driver is not correct for CUDA 10. Having said all that, I dont think any of that explains the cudart issue. That may be a path issue. – Robert Crovella Nov 21 '19 at 22:29
  • Yes, it's probably just unsupported GPU. I.e. GeForce GT 730 DDR3,128bit is Fermi arch GPU, and they are not supported by CUDA anymore. – raver119 Nov 22 '19 at 05:21
  • OK, that's bad news. Would an older version of Cuda work? – hinsbergen Nov 22 '19 at 08:53
1

OK I figured it out; had to install Cuda8.0 and revert all Nd4j to beta2, and add the correct cuda-8.9-6.0-1.4.1-windows-x86_64.jar to my classpath. Furthermore, I had to restart my IDE for the windows PATH environment to be updated so that the CUDA 8 bin directory was in it. And then I found out that

CUDA backend requires compute capatibility of 3.0 and above to run

and my retro card was only 2.1, so all was for nothing :/

Will have to purchase a new GPU I guess...

hinsbergen
  • 147
  • 2
  • 11