0PricingLogin
CUDA Academy · Lesson

cudaGetLastError After Launch

Catching invalid launch configurations.

Catching the Silent Launch

Since a kernel launch returns nothing, you need a helper to ask the GPU what just happened. That helper is cudaGetLastError. 🔎

What It Returns

cudaGetLastError hands back the most recent error code recorded by the runtime, or cudaSuccess if everything is fine so far.

myKernel<<<g, b>>>(d);
cudaError_t e = cudaGetLastError();

All lessons in this course

  1. Return Codes vs Async Errors
  2. cudaGetLastError After Launch
  3. A Reusable CUDA_CHECK Macro
  4. Decoding cudaGetErrorString
← Back to CUDA Academy