Feb 12
21
CUDA – Get Error From Kernel Call
Leave a comment »
When a kernel encounters an error it does not notify the runtime of any errors. One has to explicitly query the last error that occurred, if any.
Below is an example of how to do this.
// call the kernel SomeKernel<<<n,m>>>(); // wait for the kernel to finish executing before continuing cudaThreadSynchronize(); // check for error cudaError_t error = cudaGetLastError(); string lastError = cudaGetErrorString(error);Tweet