I’m new to JCUDA. I’m trying to configure the development enviroment but despite my efforts I’m getting this error when trying to run the toy example:
JCuda.cudaMalloc(pointer, 4);
System.out.println("Pointer: "+pointer);
JCuda.cudaFree(pointer);```
Can someone help me to figure out what is happening?
Exception in thread “main” java.lang.UnsatisfiedLinkError: Could not load the native library.
Error while loading native library “JCudaRuntime-windows-x86_64” with base name “JCudaRuntime”
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.UnsatisfiedLinkError: C:\Users\Ricardo\AppData\Local\Temp\JCudaRuntime-windows-x86_649184899135937542293.dll: Can’t find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1814)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1083)
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:171)
at jcuda.LibUtils.loadLibrary(LibUtils.java:83)
at jcuda.runtime.JCuda.initialize(JCuda.java:340)
at jcuda.runtime.JCuda.(JCuda.java:327)
at JCudaRuntimeTest.main(JCudaRuntimeTest.java:11)
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: D:\Programming\JCuda-All-0.6.5-bin-windows-x86_64\JCudaRuntime-windows-x86_64.dll: Can’t find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at jcuda.LibUtils.loadLibrary(LibUtils.java:94)
at jcuda.runtime.JCuda.initialize(JCuda.java:340)
at jcuda.runtime.JCuda.(JCuda.java:327)
at JCudaRuntimeTest.main(JCudaRuntimeTest.java:11)
at jcuda.LibUtils.loadLibrary(LibUtils.java:126)
at jcuda.runtime.JCuda.initialize(JCuda.java:340)
at jcuda.runtime.JCuda.<clinit>(JCuda.java:327)
at JCudaRuntimeTest.main(JCudaRuntimeTest.java:11)
Unfortunately, I already knew about that post and after following every instructions the error keeps happening. So, if you have something useful I would appreciate.
So far I installed the CUDA toolkit 6.5 and I’m using the 0.6.5 JCUDA version. I have a GFORCE GT 325M with the drivers installed.
I got this error in the first place:
java.lang.NullPointerException: No resource found with name '/lib/JCudaRuntime-windows-x86_64.dll'
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:149)
at jcuda.LibUtils.loadLibrary(LibUtils.java:83)
at jcuda.runtime.JCuda.initialize(JCuda.java:340)
at jcuda.runtime.JCuda.<clinit>(JCuda.java:327)
at JCUDAHello.main(JCUDAHello.java:10)
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\bin\JCudaRuntime-windows-x86_64.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at jcuda.LibUtils.loadLibrary(LibUtils.java:94)
at jcuda.runtime.JCuda.initialize(JCuda.java:340)
at jcuda.runtime.JCuda.<clinit>(JCuda.java:327)
at JCUDAHello.main(JCUDAHello.java:10)
at jcuda.LibUtils.loadLibrary(LibUtils.java:126)
at jcuda.runtime.JCuda.initialize(JCuda.java:340)
at jcuda.runtime.JCuda.<clinit>(JCuda.java:327)
at JCUDAHello.main(JCUDAHello.java:10)
My project have the folders src and bin. It seems that it expects dll files in the project folder /bin/lib/. Then, I put the DLL files in a lib folder project/bin/lib/ and then i got the error that originally a place here. Can you help me? I cannot see what i’m doing wrong…
In any case, the JCuda DLL should actually not have this dependency, and I wonder how this slipped in. I’ll have to re-check the compiler settings of the VS files that are emitted by CMake, I guess one has to manually select some “Don’t link against some cr*ppy MS DLLs”-flag there :rolleyes:
Sorry for the inconveniences. If it still does not work, I’ll try to provide a version without these dependencies ASAP, but first have to figure out and test how they can be omitted.
OK, a small update here: I checked this again, and indeed, CMake generated Visual Studio Project files where some compiler flags caused a runtime dependency to some of the Microsoft Redistributables.
The Binaries (for Windows 32 and 64 bit) have been updated, so this dependency should no longer exist, and the CMake scripts have been extended to overwrite the respective flags, so that this will (hopefully) not happen again in future versions.
It’s hard to “test” it in the sense that I never had this problem (because with Visual Studio, and with many other programs, the respective DLLs are installed by default), but I can try to run a test in the next days to verfiy that the DLLs that are used do no longer refer to the VS DLLs.
Umm… I seem to be experiencing the same problem as the guy who started this thread, I have the same error code, the same normal code, the newest version (as of 12/2/2015) of JCuda and yes I have read and followed the FAQ thread on this and it didn’t help. Could someone help me? (sorry for forum error, I am new to this)
Check that all DLL functions referred in your Java code are correctly defined and exported and export the same datatypes as those your Java code is expecting. This won’t stop the DLL loading, but it may well mess up the next stage - resolving link addresses or making functions that should work, fail in unexpected ways. Place the DLL in the current directory, in one of the directories listed in the PATH environment variable, or, best of all, in the native library search path, set using the system property java.library.path:
Thanks @antoniosarco - this is basically the information that is detailed in the JCuda FAQ . Fortunately, this now is mainly relevant for those who manually download the DLLs and JARs to set everything up locally. Starting with JCuda 0.8.0, the native libraries are contained in JAR (Maven Artifacts) and loaded from there. Since then, the number of bug reports related to UnsatisfiedLinkError have greatly decreased