Issue 1:
System information (version)

OpenCV => latest pull from git ... 3.1.0-1483-g73a8fa8

Operating System / Platform => Ubuntu Linux 16.04, Kernel 4.7.5

Compiler => ?

In which part do you get the Issue

the cmake bit works (I think, no errors but ... I don't know enough about it)

make

Detailed description

Similar error to #6500 . I don't think it's a duplicate because it's using CUDA 8 and not 7.5

Also I tried all the fixes mentioned in that one, but still have the same problem :(

[ 2%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o

In file included from /home/brian/opencv/opencv/modules/core/include/opencv2/core.hpp:3195:0,

from /home/brian/opencv/opencv/modules/core/include/opencv2/core/cuda.hpp:51,

from /home/brian/opencv/opencv/modules/core/src/cuda/gpu_mat.cu:51:

/home/brian/anaconda2/include/opencv2/core/operations.hpp:72:0: warning: "CV_XADD" redefined

#define CV_XADD sync_fetch_and_add

...

then a whole heap of

/home/brian/anaconda2/include/opencv2/core/mat.hpp(__xxx): error: identifier xxx is undefined

...

Error limit reached.

100 errors detected in the compilation of "/tmp/tmpxft_00003ea1_00000000-11_gpu_mat.compute_37.cpp1.ii".

Compilation terminated.

CMake Error at cuda_compile_generated_gpu_mat.cu.o.cmake:266 (message):

Error generating file

/home/brian/opencv/opencv/build/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_gpu_mat.cu.o

modules/core/CMakeFiles/opencv_core.dir/build.make:402: recipe for target 'modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o' failed

make[2]: *** [modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o] Error 1

CMakeFiles/Makefile2:2086: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed

make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2

Makefile:160: recipe for target 'all' failed

make: *** [all] Error 2

Steps to reproduce

as per: https://blog.kickview.com/building-a-digits-dev-machine-on-ubuntu-16-04/

but without the python env

git clone https://github.com/opencv/opencv.git

git clone https://github.com/opencv/opencv_contrib.git

cd opencv && mkdir build && cd build

--install dependencies

cmake

-D CMAKE_BUILD_TYPE=RELEASE

-D CMAKE_INSTALL_PREFIX=/usr/local

-D WITH_CUDA=ON

-D CUDA_ARCH_BIN="5.2"

-D CUDA_ARCH_PTX="5.2"

-D CUDA_GENERATION=Kepler

-D ENABLE_FAST_MATH=1

-D CUDA_FAST_MATH=1

-D WITH_CUBLAS=1

-D INSTALL_PYTHON_EXAMPLES=ON

-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules

-D BUILD_EXAMPLES=ON ..

also added in the -D_FORCE_INLINES in opencv/cmake/OpencvDetectCuda.cmake

Issue 2:
System information (version)

OpenCV => recent 3.4 branch

Operating System / Platform => Win10 64bit

Compiler => Visual Studio 2015

CUDA => 10.0

GPU => GTX 1060

related #9529

relaetd #5915

Detailed description

I confirmed some sporadic test failures in "PyrLKOpticalFlow.Mat"

I looked in the kernel, and realized there is a race condition. Synchronization was inside the #if so in some condition, race happens.

opencv/modules/video/src/opencl/pyrlk.cl

Lines 198 to 210
in
0101fa7

if (tid < 32)

{

smem1[tid] += smem1[tid + 32];

#if WAVE_SIZE < 32

}

barrier(CLK_LOCAL_MEM_FENCE);

if (tid < 16)

{

#endif

smem1[tid] += smem1[tid + 16];

#if WAVE_SIZE <16

}

barrier(CLK_LOCAL_MEM_FENCE);

Now, I faced similar situation in #11409

I'm not sure where this WAVE_SIZE came from, but I removed it and modified the reduction part in more simple way.

And during the investigation, I think there is also something wrong during the upload.

Let me send my patch later.

Steps to reproduce

Run opencv_test_video on above configuration