Throwing error "No Error"


Found the answer. In my code, I had a semi-colon after the if-conditional, which made the following block execute regardless of the truth value.

I’m new.

I’m following the tutorial over at Dr. Dobbs that can be found here:

When it comes to this block, the “if” conditional is getting executed:

[codebox]void checkCUDAError(const char *msg)


cudaError_t err = cudaGetLastError();

if( cudaSuccess != err) 


    fprintf(stderr, "Cuda error: %s: %s.\n", msg, 

                              cudaGetErrorString( err) );




When I run the program, the output is:

“Cuda error: kernel invocation: no error.”

What kind of error is “no error”? Why is it not equal to cudaSuccess?