When to use CUDA_SAFE_CALL()

Is CUDA_SAFE_CALL() necessary for each code?

No and it’s not even recommended. This is purely for readability of the SDK examples. In your apps you are expected to code error handling per your individual requirements.

the CUDA_SAFE_CALL work like this (see cutil.h) :

  • Get the last error

  • if Last error !=CudaSuccess -> printf error and quit the application

So you don’t necessary need to use it.