Create OpenCV with CUDA Support

I use CMake to create a visual studio 2013 solution. Then they need to build it, but we get the following error:

Creating Object Modules NVCC (Device) /core/CMakeFiles/cuda_compile.dir/src/cuda/Debug/cuda_compile_generated_gpu_mat.cu.obj

nvcc fatal: Unsupported gpu architecture 'compute_11'

Try version 2.10 and 3.0 with cuda 6.5 and 7.0. CUDA_ARCH_BIN installed in: 1.1 1.2 1.3 2.0 2.1 (2.0) 3.0 3.5

+18
opencv cuda
Jan 18 '15 at 13:50
source share
8 answers

Another variant. Ubuntu 14.04, GTX Titan X, opencv-2.4.10

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_TIFF=ON -D BUILD_EXAMPLES=ON -D CUDA_GENERATION=Auto -D BUILD_NEW_PYTHON_SUPPORT=ON .. 

I also applied the patch, but I'm not sure if this turned out to be necessary. I tried with and without CUDA_GENERATION=Maxwell , but Maxwell was not detected. I have not tried CUDA_GENERATION=Auto before the patch, so I do not know for sure.

+17
Apr 23 '15 at 5:10
source share

When using cmake to perform configurations, set the CUDA_GENERATION option to your GPU configuration parameter . I ran into the same error and tried to solve this problem.

+10
Feb 23 '15 at 8:13
source share

In response to Yun's answer (I can’t leave a comment), this worked for me and shows a possible value for CUDA_GENERATION :

 cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D CUDA_GENERATION=Kepler .. 

(Ubuntu 12.04 and 14.04, GTX Titan and OpenCV 2.4.11 and 3.0.0.)

+10
Mar 24 '15 at 16:43
source share

Thank,

 cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D CUDA_GENERATION=Kepler .. 

Let me install opencv-2.4.9.

If you want to know more details, check out this link.

+4
Apr 01 '15 at 11:01
source share

You must use cmake to set these entries CUDA_ARCH_BIN = 3.2 and CUDA_ARCH_PTX = 3.2

Hope this helps.

Hello

+2
Jun 30 '15 at 16:31
source share

This is because your gpu type is incompatible.

You must explicitly define CUDA_GENERATION.

In my side, I could find 3 types of CUDA_GENERATION; Auto, Kepler, Fermi.

When I set CUDA_GENERATION as Kepler, compute_11 is changed to compute_30 and will succeed.

+2
02 Sep '15 at 5:55
source share

You can use CUDA_GENERATION to specify the appropriate generation codename for your GPU architecture.

Here is the corresponding opencv cmake code that parses the value of CUDA_GENERATION :

  set(__cuda_arch_ptx "") if(CUDA_GENERATION STREQUAL "Fermi") set(__cuda_arch_bin "2.0") elseif(CUDA_GENERATION STREQUAL "Kepler") set(__cuda_arch_bin "3.0 3.5 3.7") elseif(CUDA_GENERATION STREQUAL "Maxwell") set(__cuda_arch_bin "5.0 5.2") elseif(CUDA_GENERATION STREQUAL "Pascal") set(__cuda_arch_bin "6.0 6.1") elseif(CUDA_GENERATION STREQUAL "Volta") set(__cuda_arch_bin "7.0") elseif(CUDA_GENERATION STREQUAL "Auto") execute_process( COMMAND "${CUDA_NVCC_EXECUTABLE}" ${CUDA_NVCC_FLAGS} "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run" WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/" RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT _nvcc_res EQUAL 0) message(STATUS "Automatic detection of CUDA generation failed. Going to build for all known architectures.") else() set(__cuda_arch_bin "${_nvcc_out}") string(REPLACE "2.1" "2.1(2.0)" __cuda_arch_bin "${__cuda_arch_bin}") endif() endif() 

And on the CUDA wikipedia page there is a table with a good ratio for comparing your video card with the correct microarchitecture name (sorry, it is too large to play here):

https://en.wikipedia.org/wiki/CUDA#GPUs_supported

For example, my mid-term 2012 Macbook Pro has an antique GeForce GT 650M, which in the wikipedia table points to Kepler's microarchitecture. Therefore, I use this on my cmake command line:

cmake -D CUDA_GENERATION="Kepler" ...

and the opencv script converts it to "3.0 3.5 3.7" when it displays the configuration summary and passes the corresponding nvcc flags.

In my case, before setting this correctly, I was getting errors in compute_70 that were not supported. Apparently, there is still an open problem in opencv tracker today (2017-10-07) that automatic detection does not work properly.

+1
Oct 08 '17 at 3:27
source share

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_TIFF=ON -D BUILD_EXAMPLES=ON -D CUDA_GENERATION=Kepler -D BUILD_NEW_PYTHON_SUPPORT=ON ..

worked for me for OpenCV 2.4.11

0
Feb 03 '16 at 3:05
source share



All Articles