It seems your drivers are not initialized, but checking the cuda return code is always bad practice, you should avoid this. Here is a simple + Macro function that you can use for cuda calls (quoted from Cuda as an example):
static void HandleError( cudaError_t err, const char *file, int line ) { if (err != cudaSuccess) { printf( "%s in %s at line %d\n", cudaGetErrorString( err ), file, line ); exit( EXIT_FAILURE ); } } #define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ ))
Now start calling your functions as follows:
HANDLE_ERROR(cudaMemcpy(...));
source share