Issue 1:
System information (version)

OpenCV => 4.0.1 building from source

Operating System / Platform => macOS High Sierra, 10.13.3

Compiler =>

Detailed description

Trying to see any speedup possible for my simple Tensorflow network. I have build OpenCV with OpenCL target, however when I set the preferable target to OpenCL using

net.setPreferableTarget(cv::dnn::DNN_TARGET_OPENCL);

I see the following message:

"OpenCV(ocl4dnn): consider to specify kernel configuration cache directory

via OPENCV_OCL4DNN_CONFIG_PATH parameter.

OpenCL program build log: dnn/dummy

Status -43: CL_INVALID_BUILD_OPTIONS

-cl-no-subgroup-ifp -D AMD_DEVICE"

Also, numerically the prediction is different than what I get from running directly on CPU. Running the following code snippet produces the positive output which verifies OpenCL being available.

############## Code Snippet #################

if (!cv::ocl::haveOpenCL())

cout << "OpenCL is not available..." << endl;

else

cout << "OpenCL is AVAILABLE! :) " << endl; //this is the output

cv::ocl::setUseOpenCL(true);

cv::ocl::Context ctx = cv::ocl::Context::getDefault();

cout << ctx.ndevices() << " GPU devices are detected." << endl;

for (int i = 0; i < ctx.ndevices(); i++)

{

cv::ocl::Device device = ctx.device(i);

cout << "name: " << device.name() << endl;

cout << "available: " << device.available() << endl;

cout << "imageSupport: " << device.imageSupport() << endl;

cout << "OpenCL_C_Version: " << device.OpenCL_C_Version() << endl;

cout << endl;

} //this works & i can see my video card name & opencl version

cv::ocl::Device(ctx.device(0));

############### Output ######################

OpenCL is AVAILABLE! :)

1 GPU devices are detected.

name: AMD Radeon R9 M395X Compute Engine

available: 1

imageSupport: 1

OpenCL_C_Version: OpenCL C 1.2

Is this a bug in OpenCV or am I overlooking a step in building OpenCv with OpenCL. Looking for help and feedback!

Steps to reproduce

Issue 2:
Out of the box I'm having a link error.

System information (version)

OpenCV: 4.0.0-dev

Operating System / Platform: Windows 10 x64 enteprise

Compiler:

Visual Studio 2017 15.9.1

vcvars64.bat -vcvars_ver=14.16.27023

cmake 3.13.0rc3

cuda 10.0

Detailed description

opencv_cudev_main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) bool cv::__termination" (__imp

_?__termination@cv@@3_NA) referenced in function DllMain [I:\opencv-master\build\modules\cudev\opencv_cudev.vcxproj]

I:\opencv-master\build\bin\Release\opencv_cudev400.dll : fatal error LNK1120: 1 unresolved externals [I:\opencv-master

build\modules\cudev\opencv_cudev.vcxproj]

Steps to reproduce

$target = "Visual Studio 15 2017 Win64"; cmake -G $target -T v141, host=x64 -j8 -DBUILD_JAVA=0 -DWITH_MATLAB=0 -DBUILD_DOC=0 -DBUILD_PERF_TESTS=0 -DBUILD_TESTS=0 -DBUILD_opencv_world=0 -DOPENCV_ENABLE_NONFREE=1 -DBUILD_opencv-apps=0 -DENABLE_PYLINT=0 -DENABLE_CXX11=0 -DWITH_VTK=1 -DCUDA_SDK_ROOT_DIR="$env:CUDA_PATH" -DCUDA_ARCH_BIN="5.2" -DCUDA_VERBOSE_BUILD=0 -DBUILD_CUDA_STUBS=0 -DWITH_OPENCL=1 -DWITH_CUDA=1 -DMKL_WITH_OPENMP=0 -DMKL_WITH_TBB=0 -DOPENCV_EXTRA_MODULES_PATH="../opencv_contrib/modules"	-DINSTALL_CREATE_DISTRIB=1 -DCPACK_BINARY_ZIP=1 -DCPACK_SOURCE_ZIP=1 -DCMAKE_VERBOSE_MAKEFILE=0 ../opencv | Tee-Object -Variable RESULT