The compilation of the gpu module fails for CUDA compute capability (CC) 1.0 due to the use of atomicXXX
functions, which are only available from CC >= 1.1.
According to OpenCV documentation compilation should succeed and functions that require CC > 1.0 should throw exceptions (Compilation for Different NVIDIA* Platforms).
However, some of the kernels in the module test for CC to prevent compilation of code that uses unavailable atomic functions, but others don't, which results in compilation errors, e.g.:
OpenCV-2.4.8/opencv/sources/modules/gpu/src/cuda/bf_radius_match.cu(104): error : identifier "atomicInc" is undefined
or
OpenCV-2.4.8/opencv/sources/modules/gpu/src/cuda/hist.cu(94): error : the global scope has no "atomicAdd"
Compile information:
VisualStudio2010 (msvc v10.0), OpenCV 2.4.8, Quadro FX 4600 (CC 1.0 only),
CUDA 5.5 (nvcc v5.5.0 with flags -gencode;arch=compute_10,code=sm_10;-gencode;arch=compute_10,code=compute_10)
Now to my questions:
- As a newbie to GPU programming, did I miss something?
- Is OpenCV still intended to support CC 1.0? If not is the documentation out-of-date?
- If I would like to fix the compilation issues, is there a policy to handle the unavailability of CUDA functions, e.g. simply remove functionality from the function body as in cv::gpu::device::fast::calcKeypoints(..) [fast.cu line 223 ff.]?
Could anyone hint me to the mechanisms of exception throwing that are mentioned in the documentation of the GPU module for CC 1.0? I was not able to discover any throwing of exceptions from browsing the CUDA code.
For completeness, here are the affected sources in modules/gpu/src/cuda/, which use calls to atomic functions without testing and thus fail to compile for CC 1.0:
- bf_radius_match.cu
- canny.cu
- ccomponetns.cu
- clahe.cu
- hist.cu
- hough.cu
- lbp.cu
- matrix_reductions.cu
As an example on testing for CC, the following sources succeed to compile by disabling the use of atomic functions:
- fast.cu
- fgd_bgfg.cu
- gftt.cu