1

I am trying to setup mavenized JCUDA for a project that I am working on and am running into issues with telling java where to locate the library files.

Setting up and getting maven to build the .jar and .dll files has worked fine, I can see the correctly named .dll files in project\target\lib and I am setting my native library location to this folder.

The error I get when trying to run one of the programs from JCUDA JCublasSample.java (www.jcuda.org/samples/JCublasSample.java) is:

Creating input data... Performing Sgemm with Java... Performing Sgemm with JCublas...

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load the native library.

Error while loading native library "JCublas-windows-x86_64" with base name "JCublas" Operating system name: Windows 7 Architecture : amd64 Architecture bit size: 64

Stack trace from the attempt to load the library as a resource: java.lang.NullPointerException: No resource found with name '/lib/JCublas-windows-x86_64.dll'

at jcuda.LibUtils.loadLibraryResource(LibUtils.java:149) at jcuda.LibUtils.loadLibrary(LibUtils.java:83) at jcuda.jcublas.JCublas.initialize(JCublas.java:93) at jcuda.jcublas.JCublas.(JCublas.java:81) at JCublasSample.sgemmJCublas(JCublasSample.java:64) at JCublasSample.testSgemm(JCublasSample.java:49) at JCublasSample.main(JCublasSample.java:25)

Stack trace from the attempt to load the library as a file: java.lang.UnsatisfiedLinkError: C:\Users\kristoffer.bernhem\git\SMlocalizer\target\lib\JCublas-windows-x86_64.dll: Can't find dependent libraries

at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1122) at jcuda.LibUtils.loadLibrary(LibUtils.java:94) at jcuda.jcublas.JCublas.initialize(JCublas.java:93) at jcuda.jcublas.JCublas.(JCublas.java:81) at JCublasSample.sgemmJCublas(JCublasSample.java:64) at JCublasSample.testSgemm(JCublasSample.java:49) at JCublasSample.main(JCublasSample.java:25) at jcuda.LibUtils.loadLibrary(LibUtils.java:128) at jcuda.jcublas.JCublas.initialize(JCublas.java:93) at jcuda.jcublas.JCublas.(JCublas.java:81) at JCublasSample.sgemmJCublas(JCublasSample.java:64) at JCublasSample.testSgemm(JCublasSample.java:49) at JCublasSample.main(JCublasSample.java:25)

As explained by Guenther, the problem lies in supporting .dll files that are lacking. How would I go about sorting this error out?

This is being run in windows 7 (64bit) and run with JDK1.8.0_91.

Talvarion
  • 11
  • 1
  • 5
  • It can find the `JCublas-windows-x86_64.dll` but this dll requires other dlls to work properly and one of those dlls is missing. – Guenther Sep 14 '16 at 07:23
  • Thank you. Updated the question to reflect your answer. – Talvarion Sep 14 '16 at 14:00
  • You could download the zip file and compare the dlls in the zip file with the ones maven downloaded into the target/lib folder. You could also manually add the target/lib folder to the windows PATH. To see which DLLs are required for a certain DLL, you can use one of the tools described here http://stackoverflow.com/questions/7378959/how-to-check-for-dll-dependency – Guenther Sep 15 '16 at 05:36
  • Thank you for the suggestion with the tool for `.dll` call mapping. Turns out my NVIDIA CUDA 7.5 (run 8.0 usually for other languages so the problem had not popped up previously) installation had a damaged file. Appriciate the quick response, thank you! – Talvarion Sep 15 '16 at 07:36
  • So is this problem solved now? In general, when you compile the libraries on your own, and have multiple CUDA versions installed, you have to make sure that CMake picks up the right CUDA SDK version. You can also check the dependencies of the generated DLL, either with "Dependency Walker", or with `dumpbin /DEPENDENTS JCublas-xyz.dll`. – Marco13 Sep 17 '16 at 01:47

0 Answers0