JCudaDriverCubinSample Error - CUDA_ERROR_INVALID_SOURCE

I’ve new to CUDA/JCUDA and trying to get this sample up and running.

Running on a 64bit Ubuntu machine.

What I did:

created a project in eclipse, add the 0.3.2 jcuda libraries to the project and compiled and packaged into a executable jar file.
placed the .so files in a ./lib folder

when executing the sample (JCudaDriverCubinSample.jar) the cuban file is properly generated however i get the following error:

Exception in thread “main” java.lang.reflect.InvocationTargetException
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:616)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56)
Caused by: jcuda.CudaException: CUDA_ERROR_INVALID_SOURCE
at jcuda.driver.JCudaDriver.checkResult(JCudaDriver.java:170)
at jcuda.driver.JCudaDriver.cuModuleLoad(JCudaDriver.java:1400)
at com.sample.test.JCudaDriverCubinSample.main(JCudaDriverCubinSample.java:43)
… 5 more

The only change made to the source file was added this line to help with troubleshooting:
JCudaDriver.setExceptionsEnabled(true);

Any help/direction would be much appreciated.

Nick.

Hello

When compiling a CUBIN file, you also have to specify the target hardware, namely the “Compute Capability”. At the moment, there is still a line


String command =
    "nvcc " + modelString + " **-arch sm_11** -cubin "+
    cuFile.getPath()+" -o "+cubinFileName;

in this sample, but this has to be adjusted. For example, if your card as Compute Capability 2.1, it has to be
-arch sm_21
instead.

The example will be updated soon, and possibly converted to use PTX files, where this problem should not occur any more (it has recently been reported several times, but I did not yet have the chance to do this update)

bye

thanks Marco, that worked !

Also thrilled to see such a prompt response to my post, looking forward to diving into this stuff in greater detail.

thanks again,
Nick.