In past SDK’s I found problems which were solved by using cudaSafeCall.
In v5.0, it seems cudaSafeCall has been removed. Does that mean it’s no longer needed?
In past SDK’s I found problems which were solved by using cudaSafeCall.
In v5.0, it seems cudaSafeCall has been removed. Does that mean it’s no longer needed?
It is good practice to always check the status of CUDA API calls. The wrapper macro cudaSafeCall() was one way of doing this with little textual overhead, which is what you would want in example code that tries to keep the reader focused on the feature(s) exercised in the example. The error handing that was provided by cudaSafeCall() is not at all what you would want in a real application.
If robust error handling is not what you need, you could always make your own wrapper, e.g.:
// Macro to catch CUDA errors in CUDA runtime calls
#define CUDA_SAFE_CALL(call)
do {
cudaError_t err = call;
if (cudaSuccess != err) {
fprintf (stderr, "Cuda error in file '%s' in line %i : %s.",
__FILE__, __LINE__, cudaGetErrorString(err) );
exit(EXIT_FAILURE);
}
} while (0)
.
Thanks
In my code I report any CUDA errors to a log and print it on application exit (logging example below):
...
cirtLogCuDrv(cuLaunchKernel(s_cuProgramsEntry[CIRT_PRIMARY], s_nW, s_nH, 1, s_nX, s_nY, s_nZ, shared, 0, prim_args, 0),__FUN__": cuLaunchKernel_PRIMARY", __FILE_LINE__);
...
MK
hello, i’m beginner with CUDA programmin ;
my code contains two files cuda.cu and hello.cpp i lunched the kernel from hello.cpp compiling gives
“Time Elapsed 00:00:01.46
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========”
but when i running i have this message :
"error C2059: syntax error : ’