Error Running KernelLauncherSample

Hi all,

I know you see a lot of these questions, but I haven’t got a clue how to proceed :frowning: I have a CUDA enabled macbook pro and am able to run the CUDA example programs and compile *.cu programs with nvcc and run them.

I wanted to experiment with JCuda.

I am running 64 bit os x 10.7.4

I downloaded

http://www.jcuda.de/downloads/JCuda-All-0.4.1-bin-apple-x86_64.zip
http://www.jcuda.de/utilities/jcudaUtils-0.0.4.jar

I then try to run

KernelLauncherSample from an IntelliJ project - I have

jcuda-0.4.1.jar
jcudaUtils-0.0.4.jar
libJCudaDriver-apple-x86_64.dylib
libJCudaRuntime-apple-x86_64.dylib

in a libs folder which is a dependancy folder in the IntelliJ project

When I run the class I get the following error

Error while loading native library „JCudaDriver-apple-x86_64“ with base name „JCudaDriver“
Operating system name: Mac OS X
Architecture : x86_64
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/libJCudaDriver-apple-x86_64.jnilib‘
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:151)
at jcuda.LibUtils.loadLibrary(LibUtils.java:83)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:206)
at KernelLauncherSample.main(KernelLauncherSample.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: no JCudaDriver-apple-x86_64 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at jcuda.LibUtils.loadLibrary(LibUtils.java:94)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:206)
at KernelLauncherSample.main(KernelLauncherSample.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

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:206)
at KernelLauncherSample.main(KernelLauncherSample.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Process finished with exit code 1

I notice that the JCuda archive only contained dylib files and not jnilib files. Is this an issue - If not where do I put the dylib files?

I am sorry but I don’t have a clue about this.

Conrad

I have also tried adding the directory where the ‚dylib‘ files are stored to LD_LIBRARY_PATH, but this doean’t seem to work either :confused:

Hello

Which version of the CUDA Toolkit do you have installed? Note that the most recent version from NVIDIA is 4.2, but I have not yet updated JCuda accordingly. The latest JCuda version is for the toolkit 4.1.

(I hope that I’ll be able to do the update to 4.2 between 9th and 13th July (although CUDA 5.0 is already in the pipeline… :wink: ). Usually, the MacOS binaries are available shortly after the source code has been updated.)

Concerning the question whether it’s dylib jnilib: I did a lot of websearch and asked MacOS users and contributors, and to my knowledge, JNI libraries once had to be called ‚jnilib‘, but since MacOS X, they may also have the usual ‚dylib‘ extension. So this should not be an issue.

bye
Marco

Thank you for your response.

I am using 4.2 - so I guess that’s the issue.

I will stay with native C until you updates.

Thanks for all your hard work.