Skip to content

Commit 9d1c0f5

Browse files
authored
Merge pull request #3383 from cudawarped:mirror_22633
Reset cuda runtime error code to cudasuccess on runtime failure.
2 parents 0792588 + 0af5f73 commit 9d1c0f5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/cudev/include/opencv2/cudev/common.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ using namespace cv::cuda;
6969

7070
__host__ __forceinline__ void checkCudaError(cudaError_t err, const char* file, const int line, const char* func)
7171
{
72-
if (cudaSuccess != err)
72+
if (cudaSuccess != err) {
73+
cudaGetLastError(); // reset the last stored error to cudaSuccess
7374
cv::error(cv::Error::GpuApiCallError, cudaGetErrorString(err), func, file, line);
75+
}
7476
}
7577

7678
#define CV_CUDEV_SAFE_CALL(expr) cv::cudev::checkCudaError((expr), __FILE__, __LINE__, CV_Func)

0 commit comments

Comments
 (0)