Ubuntu 10.04 Eclipse Galileo Library Problem

hello,

i am working with ubuntu 10.04 64 bit and eclipse. i installed the CUDA toolkit 3.2RC and the respective driver (both 64 bit).

the command
$ java -version yields
java version “1.6.0_18”
OpenJDK Runtime Environment (IcedTea6 1.8.2) (6b18-1.8.2-4ubuntu2)
OpenJDK 64-Bit Server VM (build 16.0-b13, mixed mode)

the NVIDIA samples are compiling and running just fine and the deviceQuery outputs:

./deviceQuery Starting…

CUDA Device Query (Runtime API) version (CUDART static linking)

There is 1 device supporting CUDA

Device 0: “GeForce 9800 GT”
CUDA Driver Version: 3.20
CUDA Runtime Version: 3.20
CUDA Capability Major/Minor version number: 1.1
Total amount of global memory: 536150016 bytes
Multiprocessors x Cores/MP = Cores: 14 (MP) x 8 (Cores/MP) = 112 (Cores)
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 16384 bytes
Total number of registers available per block: 8192
Warp size: 32
Maximum number of threads per block: 512
Maximum sizes of each dimension of a block: 512 x 512 x 64
Maximum sizes of each dimension of a grid: 65535 x 65535 x 1
Maximum memory pitch: 2147483647 bytes
Texture alignment: 256 bytes
Clock rate: 1.50 GHz
Concurrent copy and execution: Yes
Run time limit on kernels: Yes
Integrated: No
Support host page-locked memory mapping: Yes
Compute mode: Default (multiple host threads can use this device simultaneously)
Concurrent kernel execution: No
Device has ECC support enabled: No
Device is using TCC driver mode: No

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 3.20, CUDA Runtime Version = 3.20, NumDevs = 1, Device = GeForce 9800 GT

PASSED

Press to Quit…

so cuda is running fine. unfortunately, the execution of the Minimalbesipiel

[LEFT][FONT=Courier New]import jcuda.;
import jcuda.runtime.
;
public class JCudaRuntimeTest
{
public static void main(String args[])
{
Pointer pointer = new Pointer();
JCuda.cudaMalloc(pointer, 4);
System.out.println("Pointer: "+pointer);
JCuda.cudaFree(pointer);
}
}
[/FONT]
[/LEFT]

delivers

Error while loading native library with base name “JCudaRuntime”
Operating system name: Linux
Architecture : amd64
Architecture bit size: 64
Exception in thread “main” java.lang.UnsatisfiedLinkError: Could not load native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:79)
at jcuda.runtime.JCuda.assertInit(JCuda.java:225)
at jcuda.runtime.JCuda.cudaMalloc(JCuda.java:1775)
at testi.main(testi.java:9)

when i try to run it with eclipse. in a command line i get the same result.

$ javac -cp “.:jcuda-0.3.2RC.jar” Minimalbeispiel.java does not throw any errors

but

$ java -cp “.:jcuda-0.3.2RC.jar” Minimalbeispiel does give

Error while loading native library with base name “JCudaRuntime”
Operating system name: Linux
Architecture : amd64
Architecture bit size: 64
Exception in thread “main” java.lang.UnsatisfiedLinkError: Could not load native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:79)
at jcuda.runtime.JCuda.assertInit(JCuda.java:225)
at jcuda.runtime.JCuda.cudaMalloc(JCuda.java:1775)
at testi.main(testi.java:9)

i followed the suggestions of putting the .so and .jar files in the root directory of the project but this didn’t help.
maybe i still get something wrong.

hope someone can help.
cheers

Hello

Recently there have been two updates of CUDA:
CUDA 3.2 RC (build 7) and
CUDA 3.2 RC2 (build 12)

The libraries that are currently available on the website have been built for CUDA 3.2 RC (build 7). (Although I did not build the Linux 64 bit libraries, I can ask the contributor who provided them to verify this, but they should be for build 7).

You may want to have a look at the libraries in your CUDA Toolkit directory, to see whether they have names like
cudart64_32_7.so
or
cudart64_32_12.so
But if you downloaded the Toolkit in the last few days, you most likely got the RC2 build 12.

I’m not sure if pre-built binaries for the current, intermediate CUDA version (RC2, build 12) will be uploaded - maybe I’ll wait for the final version. If want to try compiling the libraries on your own: Some makefiles are included (which might require minor adjustments for the paths on your system), and it should be possible to generate the required makefiles using the CMake makefiles that are contained in the source code distribution.

If you have the RC (build 7), this should actually match the provided binaries. If this is the case, the problem must lie somewhere else.

bye
Marco

hello, and thanks for the reply.
in my /usr/local/cuda/lib64 folder i have libcudart.so.3.2.12. i just reinstalled the cuda toolkit because i thought i could get rid of the “library problem” (before i had build 9).

additionally, i compiled the source files from jcuda.org but still get the same problems.

when making the *.so files i got

/JCuda-All-0.3.2RC-src$ make
[ 10%] Building CXX object CommonJNI/CMakeFiles/CommonJNI.dir/src/JNIUtils.cpp.o
[ 20%] Building CXX object CommonJNI/CMakeFiles/CommonJNI.dir/src/Logger.cpp.o
[ 30%] Building CXX object CommonJNI/CMakeFiles/CommonJNI.dir/src/PointerUtils.cpp.o
/home/rp/JForex/JCuda/JCuda-All-0.3.2RC-src/CommonJNI/src/PointerUtils.cpp: In function ‘PointerData* initPointerData(JNIEnv*, _jobject*)’:
/JCuda-All-0.3.2RC-src/CommonJNI/src/PointerUtils.cpp:147: warning: NULL used in arithmetic
/JCuda-All-0.3.2RC-src/CommonJNI/src/PointerUtils.cpp: In function ‘bool releasePointerData(JNIEnv*, PointerData*&, jint)’:
/JCuda-All-0.3.2RC-src/CommonJNI/src/PointerUtils.cpp:365: warning: deleting ‘void*’ is undefined
Linking CXX static library …/lib/libCommonJNI.a
[ 30%] Built target CommonJNI
[ 40%] Building CXX object JCudaDriverJNI/CMakeFiles/JCudaDriver-linux-x86_64.dir/src/JCudaDriver.cpp.o
Linking CXX shared library …/lib/libJCudaDriver-linux-x86_64.so
[ 40%] Built target JCudaDriver-linux-x86_64
[ 50%] Building CXX object JCudaRuntimeJNI/CMakeFiles/JCudaRuntime-linux-x86_64.dir/src/JCudaRuntime.cpp.o
Linking CXX shared library …/lib/libJCudaRuntime-linux-x86_64.so
[ 50%] Built target JCudaRuntime-linux-x86_64
[ 60%] Building CXX object JCublasJNI/CMakeFiles/JCublas-linux-x86_64.dir/src/JCublas.cpp.o
Linking CXX shared library …/lib/libJCublas-linux-x86_64.so
[ 60%] Built target JCublas-linux-x86_64
[ 70%] Building CXX object JCufftJNI/CMakeFiles/JCufft-linux-x86_64.dir/src/JCufft.cpp.o
Linking CXX shared library …/lib/libJCufft-linux-x86_64.so
[ 70%] Built target JCufft-linux-x86_64
[ 80%] Building CXX object JCurandJNI/CMakeFiles/JCurand-linux-x86_64.dir/src/JCurand.cpp.o
Linking CXX shared library …/lib/libJCurand-linux-x86_64.so
[ 80%] Built target JCurand-linux-x86_64
[ 90%] Building CXX object JCusparseJNI/CMakeFiles/JCusparse-linux-x86_64.dir/src/JCusparse.cpp.o
Linking CXX shared library …/lib/libJCusparse-linux-x86_64.so
[ 90%] Built target JCusparse-linux-x86_64
[100%] Building CXX object JCudppJNI/CMakeFiles/JCudpp-linux-x86_64.dir/src/JCudpp.cpp.o
Linking CXX shared library …/lib/libJCudpp-linux-x86_64.so
[100%] Built target JCudpp-linux-x86_64


are those warnings something to worry about?

any other ideas?

i just tried to compile the Minimalbeispiel with the -verbose flag and found that i get and most likely got
.
.
.
[Loaded java.lang.IllegalArgumentException from /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar]
[Loaded jcuda.runtime.JCuda from file:/home/rp/JForex/JCuda/JCuda-All-0.3.2RC-src/lib/jcuda-0.3.2RC.jar]
[Loaded jcuda.CudaException from file:/home/rp/JForex/JCuda/JCuda-All-0.3.2RC-src/lib/jcuda-0.3.2RC.jar]
[Loaded jcuda.LibUtils from file:/home/rp/JForex/JCuda/JCuda-All-0.3.2RC-src/lib/jcuda-0.3.2RC.jar]
[Loaded java.lang.UnsatisfiedLinkError from /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar]
[Loaded java.lang.AssertionError from /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar]
[Loaded java.lang.Enum from /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar]
[Loaded jcuda.LibUtils$OSType from file:/home/rp/JForex/JCuda/JCuda-All-0.3.2RC-src/lib/jcuda-0.3.2RC.jar]
[Loaded jcuda.LibUtils$ARCHType from file:/home/rp/JForex/JCuda/JCuda-All-0.3.2RC-src/lib/jcuda-0.3.2RC.jar]
Error while loading native library with base name “JCudaRuntime”
Operating system name: Linux
Architecture : amd64
Architecture bit size: 64
Exception in thread “main” java.lang.UnsatisfiedLinkError: Could not load native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:79)
at jcuda.runtime.JCuda.assertInit(JCuda.java:225)
at jcuda.runtime.JCuda.cudaMalloc(JCuda.java:1775)
at testi.main(testi.java:9)
[Loaded java.util.ArrayList$Itr from /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar]
[Loaded java.util.IdentityHashMap$KeySet from /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar]
[Loaded java.util.IdentityHashMap$IdentityHashMapIterator from /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar]
[Loaded java.util.IdentityHashMap$KeyIterator from /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar]
.
.
.
so the same error that i get/got when i try to start the program. i just do not understand why i get an error in “LibUtils.java, JCuda.java” when those two are classes in the jcuda-0.3.2RC.jar and not .java files.

cheers

Hello

The warnings are not critical, although I’ll have a look at this and see how they can be avoided.

So the compilation of the .SO libraries seems to work fine? No error messages as far as I can see.
And when you are using these .SO files that you just created on your own system, you still receive the „UnsatisfiedLinkError“? That’s stange :confused: Are you sure that you replaced the libraries in your „Minimalbeispiel“-directory with the new ones?

BTW, the JAR file also contains the .java files, so it may be possible that the file name and line number may be associated with the respective file (otherwise, it would probably only print „unknown source“

hi,
i was able to get rid of the error messages

[ 30%] Building CXX object CommonJNI/CMakeFiles/CommonJNI.dir/src/PointerUtils.cpp.o
/home/rp/JForex/JCuda/JCuda-All-0.3.2RC-src/CommonJNI/src/PointerUtils.cpp: In function ‘PointerData* initPointerData(JNIEnv*, _jobject*)’:
/JCuda-All-0.3.2RC-src/CommonJNI/src/PointerUtils.cpp:147: warning: NULL used in arithmetic
/JCuda-All-0.3.2RC-src/CommonJNI/src/PointerUtils.cpp: In function ‘bool releasePointerData(JNIEnv*, PointerData*&, jint)’:
/JCuda-All-0.3.2RC-src/CommonJNI/src/PointerUtils.cpp:365: warning: deleting ‘void*’ is undefined
Linking CXX static library …/lib/libCommonJNI.a

but unfortunately that did not change the “UnsatisfiedLinkError”.
can you tell me what the difference in the libcudart.so.3.2.7 and libcudart.so.3.2.12 is and why this produces an error? when building it should just link to the libcudart.so.3.X.X i have in my /usr/local/cuda/lib64/, correct?

btw, yeah, i am sure to put the self-build .so files into the “Minimalbeispiel directory”.
cheers

The libcudart.so.3.2.7 and libcudart.so.3.2.12 are the two different versions of the CUDA Runtime Library, namely the one for CUDA 3.2 RC, build 7, and CUDA 3.2 RC2, build 12, respectively. And it’s right, you should link to the one that is in your CUDA Toolkit directory.

I think you have created the makefiles using CMake? You may also want to try compiling it with the makefiles that have been included in the source code archive. The individual makefiles (called ‘Makefile’ in each sub-project) may require an adjustment of the path to your Java JDK directory.

I’ll ask the contributor who provided the CMake files and the last Linux binaries, maybe he has an idea what might be wrong there. Sorry for the inconveniences.

Hi,

When you add the jcuda external jars to your project, could you kindly check to see if their native library location is set to the directory where the corresponding *.so files are?

To do this in eclipse, go to “Properties”->“Java Build Path” -> “Libraries” and then click on the “+” icon next to the jcuda jars like jcuda-0.3.2RC.jar and select the “Native Lib. Location” and press the “Edit” button and then choose the external folder where libJCublas-linux-x86_64.so is on your system. Do the same with all the jcuda jars.

I hope this helps
Kashif

hey kashif,
it works! thanks a bunch. the suggestion worked.
cheers

[QUOTE=Marco13]The libcudart.so.3.2.7 and libcudart.so.3.2.12 are the two different versions of the CUDA Runtime Library, namely the one for CUDA 3.2 RC, build 7, and CUDA 3.2 RC2, build 12, respectively. And it’s right, you should link to the one that is in your CUDA Toolkit directory.

I think you have created the makefiles using CMake? You may also want to try compiling it with the makefiles that have been included in the source code archive. The individual makefiles (called ‘Makefile’ in each sub-project) may require an adjustment of the path to your Java JDK directory.

I’ll ask the contributor who provided the CMake files and the last Linux binaries, maybe he has an idea what might be wrong there. Sorry for the inconveniences.[/QUOTE]

Marco where can i download the lib*-linux-x86_64.so files i’m in the same situation i think the problem is about those so files.

BR

The “*” might be important here. Which version of the Toolkit do you have installed? Note that NVIDIA has Released the final version of CUDA 3.2 recently, and JCuda has been updated accordingly. At the moment, there are only the Win32 binaries of JCuda 0.3.2, but I will try to upload other binaries as soon as possible (and ask Kashif for the latest 64bit Linux binaries).

The Linux64 binaries for CUDA 3.2 are now available on the website. You may want to give it another try.