Error handling

Hi,

I’ve read that cutil is not the best way to error handling. If it is correct what are the best functions to error handling?

Thanks

What cutil does for error handling is fine, if you want an assert style error handler. That isn’t why people (including NVIDIA employees) say don’t use cutil. They say not to use it because it is only intended as a set of helper functions for the examples in the SDK. It isn’t intended for use in “real” code - it isn’t documented, thoroughly tested, or supported by NVIDIA and there is no guarantee that what you find in cutil today will be in the cutil with the next CUDA release, or that it will work the same way, etc.

If you want an example of a simple error handler for your CUBLAS code, you can find something that will give you some ideas in the code I posted in your previous thread on CUBLAS gemm.

Ok, but I want to see now errors in other code in CUDA, not CUBLAS.

Thanks a lot.

You can use the same basic idea for CUDA runtime API error checking as well. Just replace the cublas status type with cudaError_t and check for cudaSuccess instead of CUBLAS_STATUS_SUCCESS. There is a helper function in the runtime API called cudaGetErrorString() which you can use to parse error codes into English error message strings.