3
votes

I am trying to run a JCuda example in Debian Linux (32bit). Since there is no binaries available on JCuda website for Linux x86, I've compliled the libraries. Now I'm trying yo run the DeviceQuery example but I get the following errors:

Error while loading native library "JCudaDriver-linux-x86" with base name "JCudaDriver"
Operating system name: Linux
Architecture         : i386
Architecture bit size: 32
Stack trace from the attempt to load the library as a resource:
java.lang.NullPointerException: No resource found with name '/lib/libJCudaDriver-linux-x86.so'
    at jcuda.LibUtils.loadLibraryResource(LibUtils.java:144)
    at jcuda.LibUtils.loadLibrary(LibUtils.java:80)
    at jcuda.driver.JCudaDriver.(JCudaDriver.java:192)
    at jcudatest.JCudaTest.main(JCudaTest.java:29)
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so: /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so: undefined symbol: Pointer_buffer
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1732)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1028)
    at jcuda.LibUtils.loadLibrary(LibUtils.java:90)
    at jcuda.driver.JCudaDriver.(JCudaDriver.java:192)
    at jcudatest.JCudaTest.main(JCudaTest.java:29)

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load the native library
    at jcuda.LibUtils.loadLibrary(LibUtils.java:122)
    at jcuda.driver.JCudaDriver.(JCudaDriver.java:192)
    at jcudatest.JCudaTest.main(JCudaTest.java:29)
Java Result: 1

I belive the error here is related to that undefined symbol Pointer_buffer, since I created symbolic links on /lib and this folder is on PATH variables (I can see it resolving the symboling link to /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so like it was supposed).
Everything is working with Cuda as well, since I can compile and run Cuda examples. Cuda version is 4.0.17 and JCuda 0.4.0-beta1 (from JCuda website I can see Version 0.4.0-beta1. These libraries have been compiled for CUDA 4.0 (build 17) so I think I don't have any incompatibility here as well).
I am setting up my project on Netbeans, and I've included the source files present on JcudaJava folder. Do I need to include the cpp and hpp file from JCudaDriverJNI and JCudaRuntimeJNI folders (I never worked with JNI before, don't really know what I need to include).

Thanks in advance,
Rui

1

1 Answers

0
votes

An "undefined symbol" means that a definition for the symbol (variable, function) was not found. JCuda defines Pointer_buffer in CommonJNI/PointerUtils.cpp so there must have been some problem including PointerUtils.o in the .so. Were there any errors when you compiled?