Ask Your Question

Revision history [back]

OpenCV CUDA backend

Hey all!
I have a question: can I use OpenCV 4.2.0 with CUDA backend on device with 5.0 capability? It's support? Or only 5.3 and more supported?
Now after compile and run code I have an error:

OpenCV Error: Gpu API call (invalid device function)

When I try to set CUDA_ARCH_BIN=5.0 in CMake options, its doesnt compile with error:

CUDA backend for DNN module requires CC 5.3 or higher. Please remove unsupported architectures from CUDA_ARCH_BIN option

When I try to set CUDA_ARCH_BIN="5.3 6.0 6.1 7.0 7.5" and CUDA_GENERATION=Auto in CMake options, its doesnt compile with the same error.

My current options:

 cmake -D CMAKE_BUILD_TYPE=RELEASE 
-D CMAKE_INSTALL_PREFIX=/usr/local 
-D OPENCV_EXTRA_MODULES_PATH=~/opencv-4.2.0/opencv_contrib/modules 
-D OPENCV_ENABLE_NONFREE=ON 
-D BUILD_NEW_PYTHON_SUPPORT=ON 
-D INSTALL_PYTHON_EXAMPLES=ON 
-D OPENCV_FORCE_PYTHON_LIBS=ON 
-D PYTHON3_EXECUTABLE=~/anaconda3/envs/yolo-gpu/bin/python
-D PYTHON3_LIBRARY=~/anaconda3/envs/yolo-gpu/lib/libpython3.6m.so
-D PYTHON3_INCLUDE_DIRS=~/anaconda3/envs/yolo-gpu/include
-D PYTHON3_NUMPY_INCLUDE_DIRS=~/anaconda3/envs/yolo-gpu/lib/python3.6/site-packages/numpy 
-D WITH_CUDA=ON 
-D BUILD_opencv_cudacodec=OFF 
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.0 
-D CUDA_ARCH_BIN=5.3 -D CUDA_ARCH_PTX=5.3 
-D BUILD_EXAMPLES=ON ..

Its compile but doesnt work.
What can I do?
CUDA 10.0, CUDNN 7.6, GeForce 940M with 5.0 compute capability.

click to hide/show revision 2
retagged

updated 2020-04-28 10:26:58 -0600

berak gravatar image

OpenCV CUDA backend

Hey all!
I have a question: can I use OpenCV 4.2.0 with CUDA backend on device with 5.0 capability? It's support? Or only 5.3 and more supported?
Now after compile and run code I have an error:

OpenCV Error: Gpu API call (invalid device function)

When I try to set CUDA_ARCH_BIN=5.0 in CMake options, its doesnt compile with error:

CUDA backend for DNN module requires CC 5.3 or higher. Please remove unsupported architectures from CUDA_ARCH_BIN option

When I try to set CUDA_ARCH_BIN="5.3 6.0 6.1 7.0 7.5" and CUDA_GENERATION=Auto in CMake options, its doesnt compile with the same error.

My current options:

 cmake -D CMAKE_BUILD_TYPE=RELEASE 
-D CMAKE_INSTALL_PREFIX=/usr/local 
-D OPENCV_EXTRA_MODULES_PATH=~/opencv-4.2.0/opencv_contrib/modules 
-D OPENCV_ENABLE_NONFREE=ON 
-D BUILD_NEW_PYTHON_SUPPORT=ON 
-D INSTALL_PYTHON_EXAMPLES=ON 
-D OPENCV_FORCE_PYTHON_LIBS=ON 
-D PYTHON3_EXECUTABLE=~/anaconda3/envs/yolo-gpu/bin/python
-D PYTHON3_LIBRARY=~/anaconda3/envs/yolo-gpu/lib/libpython3.6m.so
-D PYTHON3_INCLUDE_DIRS=~/anaconda3/envs/yolo-gpu/include
-D PYTHON3_NUMPY_INCLUDE_DIRS=~/anaconda3/envs/yolo-gpu/lib/python3.6/site-packages/numpy 
-D WITH_CUDA=ON 
-D BUILD_opencv_cudacodec=OFF 
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.0 
-D CUDA_ARCH_BIN=5.3 -D CUDA_ARCH_PTX=5.3 
-D BUILD_EXAMPLES=ON ..

Its compile but doesnt work.
What can I do?
CUDA 10.0, CUDNN 7.6, GeForce 940M with 5.0 compute capability.