All CUDA/JCuda function return an 'error code'. Either directly, as the return value, or in the 'errcode_ret' as the last function parameter. If you call
as some of the first lines in your main() method, then these error codes will be checked automatically, and in case of an error, the exception will be thrown. (You're probably already doing this, otherwise your program would just fail silently).
The main difficulty here is the statement that is made in the documentation of basically every CUDA function:
Note that this function may also return error codes from previous, asynchronous launches.
Due to the asynchronous nature of CUDA, you might, for example, call 3 methods (or launch 3 kernels), and see an error after the launch of the third one. But the error might actually have been caused by the first or second one - you never know.
Debugging CUDA is difficult. And debugging JCuda may be even more difficult. For CUDA, there is the CUDA-GDB debugger ( https://developer.nvidia.com/cuda-gdb ) but admittedly, I have not yet even tried to apply this to Java programs.
However, in nearly all cases that I have experienced so far, "unknown errors" have happened due to writes to invalid memory regions (that's why I LOVE Java programs that fail with an ArrayIndexOutOfBoundsException - you always know perfectly what's wrong ). If your kernel is not overly complex, maybe posting it here might help to find the error, but of course, this is not a promise..