- OpenCV => 3.4
- Operating System / Platform => windows 10
- Compiler => VS2019
- GPU => 3090
- CUDA version => 11.4
- Driver version => 472.12
- CUDA Capability => 8.6
Detailed description
I have no problem building Opencv 3.4 with CUDA, only the option I change is “WITH_NVCUVID” → off and CUDA_ARCH_BIN = 8.6.
Then, ALL_BUILD and INSTALL are all successful with on single error.
The strange thing is when I wrote a simple test code to call cv::cuda::resize.
int CudaDevice;
FILE* outfp1;
outfp1 = fopen("GPU.txt", "w");
if (cv::cuda::getCudaEnabledDeviceCount() == 0)
fprintf(outfp1, "NO CUDA\n");
else
{
fprintf(outfp1, "CUDA = %d\n", cv::cuda::getCudaEnabledDeviceCount());
CudaDevice = cv::cuda::getDevice();
cv::cuda::setDevice(CudaDevice);
}
fclose(outfp1);
cv::Mat inImage = cv::imread("test.jpg");
cv::Mat outImage;
cv::cuda::GpuMat gpuInImage;
cv::cuda::GpuMat gpuOutImage;
//resize
gpuInImage.upload(inImage);
cv::cuda::resize(gpuInImage, gpuOutImage, cv::Size(), 0.5, 0.5, cv::INTER_LINEAR);
gpuOutImage.download(outImage);
imwrite("output_gpu.jpg", outImage);
I can get a cuda device, and the index is 0.
It came out a error said “OpenCV Error: Gpu API call (no kernel image is available for execution on the device) in cv::cuda::device::call_resize_linear_glob”
It came from cudaSafeCall( cudaGetLastError() ), and I don’t no what I miss the procedure. Can anyone give me some instructions?