I’m using Visual Studio Express 2005, using Build Project. My project was created using the CUDAWinApp template/wizard. It compiles OK and runs fine if I’m only doing memcpy stuff, once I try to launch the kernel and do the CUT_CHECK_ERROR it tells me kernel failed. The project was originally a “hello world” project with all code in “main”, and it ran ok (the kernal created the “hello world” string). I left the main routine in place and just added my code by adding other routines, later I removed all of the code from “main” in an attempt to eliminate variables with this problem but it did not change anything. I assume that with a DLL the main routine is not ever executed?? (never created a DLL before).
Here are my other details, I didn’t post them originally because I don’t even know if it’s valid to perform CUT_CHECK_ERROR immediately after kernel launch or not.
WinXP (new box, assume SP2, but it’s not in front of me so can’t say for sure)
GTX280 (drivers downloaded 2 weeks ago)
Java 1.6.0_10
Visual Studio Express 2005, C++ (downloaded 2 weeks ago)
Java loads C++ DLL
Calls native routines using JNI
All tests between Java and C++ code work properly, can xfer data, perform calcs, return results, results match the same code in Java
Java call to C++ routine to allocate memory on device works, that is to say CUDA_SAFE_CALL doesn’t spit out any errors
Subsequent Java call to C++ to launch kernel fails with the “invalid device function”
At this point I’ve eliminated almost all of the code in the kernel and in the routine that launches the kernel, this is what they look like (source is at home, keying from memory, but I eliminated everything but what is shown):
__global__ void testGPUKernel() {
__shared__ int a;
a=1;
}
extern "C" JNIEXPORT __declspec(dllexport) jint JNICALL Java_TestGPUCalls_testNtvGPUCalc(JNIEnv *, jobject) {
jint result;
result=0;
testGPUKernel<<<32,32>>>();
CUT_CHECK_ERROR("Kernel failed"); (****** DON'T REMEMBER EXACT LINE OF CODE HERE, BUT IT WAS COPIED FROM ONE OF SAMPLE PGMS *****)
return result;
}