Error in dowlaoding GpuMat to Mat

HI, I upload Mat to GpuMat and then change it by CUDA and the I download GpuMat to Mat. I do not have any problem with Mat up to size 1024x1024, but when my Mat is 2048x2048 I get a error after my CUDA code and in download GpuMat to Mat time!


OpenCV(3.4.1) Error: Gpu API call (unspecified launch failure) in cv::cuda::GpuMat::download, file C:/OpenCV 3.4.1/opencv-3.4.1/modules/core/src/cuda/, line 249

how can I solve it ?

Use standard CUDA debugging techniques.

Make sure you are not hitting a WDDM TDR.

Run your code with cuda-memcheck

Use a cuda debugger appropriate for your platform.

Even though this occurs in some OpenCV code, the “download GpuMat to Mat” is occurring after your own kernel call, and the error is indicative of a problem in your kernel call, not in the OpenCV code. You may simply be hitting a wddm tdr.

Thank you so much.

this is my code :

MyCUDAKernel << <grid, block >> > ();

The error is form, because when I remove it the error not appear

Well, you didn’t do anything I suggested.

I have problem by visual studio cuda memcheck. I will do your suggestion. Thank you dear.

I did not get how I check cuda-memcheck in visual studio. But I think if I use cudaMemAllockPitch and cudaMemCpy2D for copy my Mat in Device and Host my problem will solved !

I think using cudaMemCpy2D solved my problem.

how can I copy a Mat to a GpuMat by cudaMemCpy2D ?

Thank you.