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.