I am a beginner with JCuda programming. Unfortunately, when I try to run the main class within JCudaVectorAddTest extracted from Jcuda samples, the following problem arises.I use Windows 10, Netbeans 8.1, CUDA 9.0 and Jcuda 0.9.2.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error while loading native library "JCudaDriver-0.9.2-windows-x86_64"
Operating system name: Windows 8.1
Architecture : amd64
Architecture bit size: 64
---(start of nested stack traces)---
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: no JCudaDriver-0.9.2-windows-x86_64 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at jcuda.LibUtils.loadLibrary(LibUtils.java:143)
at jcuda.driver.JCudaDriver.<clinit>(JCudaDriver.java:296)
at JCudaVectorAdd.JCudaVectorAddTest.main(JCudaVectorAddTest.java:49)
Stack trace from the attempt to load the library as a resource:
java.lang.UnsatisfiedLinkError: C:\Users\Computer Shop\AppData\Local\Temp\JCudaDriver-0.9.2-windows-x86_64.dll: The specified procedure could not be found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:260)
at jcuda.LibUtils.loadLibrary(LibUtils.java:158)
at jcuda.driver.JCudaDriver.<clinit>(JCudaDriver.java:296)
at JCudaVectorAdd.JCudaVectorAddTest.main(JCudaVectorAddTest.java:49)
---(end of nested stack traces)---
at jcuda.LibUtils.loadLibrary(LibUtils.java:193)
at jcuda.driver.JCudaDriver.<clinit>(JCudaDriver.java:296)
at JCudaVectorAdd.JCudaVectorAddTest.main(JCudaVectorAddTest.java:49)
C:\Users\Computer Shop\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
May anyone help me to solve the problem on the environment mentioned before?
The relevant part of the error message is „The specified procedure could not be found“. This basically means that JCuda tried to find a certain function in CUDA, and did not find it. And you said:
This explains the error: There is a function in JCuda 0.9.2 which corresponds to a function in CUDA 9.2, and this function did not yet exist in CUDA 9.0.
The possible solutions are
update CUDA from 9.0 to 9.2
or use JCuda 0.9.0 instead
The latter is probably simpler for a first test. In the best case, you just have to change the version number for JCuda in your Maven POM from 0.9.2 to 0.9.0.
Based on the version of cuda, I select the version of Jcuda from http://www.jcuda.org/downloads/downloads.html#JCuda to be Version 0.9.0d. These libraries have been compiled for CUDA 9.0.176 .
I attach all jars inside the package in the project but the same problem occurs.
Error while loading native library „JCudaDriver-windows-x86_64“ with base name „JCudaDriver“
Operating system name: Windows 8.1
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/JCudaDriver-windows-x86_64.dll‘
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:151)
at jcuda.LibUtils.loadLibrary(LibUtils.java:83)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:225)
at JCudaVectorAdd.JCudaVectorAddTest.main(JCudaVectorAddTest.java:49)
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: no JCudaDriver-windows-x86_64 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
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.driver.JCudaDriver.(JCudaDriver.java:225)
at JCudaVectorAdd.JCudaVectorAddTest.main(JCudaVectorAddTest.java:49)
Exception in thread „main“ java.lang.UnsatisfiedLinkError: Could not load the native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:129)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:225)
at JCudaVectorAdd.JCudaVectorAddTest.main(JCudaVectorAddTest.java:49)
C:\Users\Computer Shop\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
How to solve this? I am amazed, the versions of cuda and Jcuda are compatible as you recommended earlier.
That’s the point where I can only say „It should work (but I’m not sure why it doesn’t work)“. The error message says
No resource found with name ‚/lib/JCudaDriver-windows-x86_64.dll‘
but I had a look at the JAR files of the version that you downloaded, and the required file is definitely there.
Are you sure that you also added the jcuda-natives-0.9.0d-windows-x86_64.jar (with the natives part) to your classpath?
In order to narrow down the possible reasons for the error, you could do the „Basic Test“ as it is described on jcuda.org - Tutorial (updated the version numbers here for the version that you are using) :