<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 4.0.1 building from source</li>
<li>Operating System / Platform =&gt; macOS High Sierra, 10.13.3</li>
<li>Compiler =&gt;</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">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</p>
<p dir="auto">net.setPreferableTarget(cv::dnn::DNN_TARGET_OPENCL);</p>
<p dir="auto">I see the following message:</p>
<p dir="auto">"OpenCV(ocl4dnn): consider to specify kernel configuration cache directory<br>
via OPENCV_OCL4DNN_CONFIG_PATH parameter.<br>
OpenCL program build log: dnn/dummy<br>
Status -43: CL_INVALID_BUILD_OPTIONS<br>
-cl-no-subgroup-ifp -D AMD_DEVICE"</p>
<p dir="auto">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.</p>
<p dir="auto">############## Code Snippet #################<br>
if (!cv::ocl::haveOpenCL())<br>
cout &lt;&lt; "OpenCL is not available..." &lt;&lt; endl;<br>
else<br>
cout &lt;&lt; "OpenCL is AVAILABLE! :) " &lt;&lt; endl; //this is the output<br>
cv::ocl::setUseOpenCL(true);<br>
cv::ocl::Context ctx = cv::ocl::Context::getDefault();<br>
cout &lt;&lt; ctx.ndevices() &lt;&lt; " GPU devices are detected." &lt;&lt; endl;<br>
for (int i = 0; i &lt; ctx.ndevices(); i++)<br>
{<br>
cv::ocl::Device device = ctx.device(i);<br>
cout &lt;&lt; "name:              " &lt;&lt; device.name() &lt;&lt; endl;<br>
cout &lt;&lt; "available:         " &lt;&lt; device.available() &lt;&lt; endl;<br>
cout &lt;&lt; "imageSupport:      " &lt;&lt; device.imageSupport() &lt;&lt; endl;<br>
cout &lt;&lt; "OpenCL_C_Version:  " &lt;&lt; device.OpenCL_C_Version() &lt;&lt; endl;<br>
cout &lt;&lt; endl;<br>
} //this works &amp; i can see my video card name &amp; opencl version<br>
cv::ocl::Device(ctx.device(0));</p>
<p dir="auto">############### Output ######################</p>
<p dir="auto">OpenCL is AVAILABLE! :)<br>
1 GPU devices are detected.<br>
name:              AMD Radeon R9 M395X Compute Engine<br>
available:         1<br>
imageSupport:      1<br>
OpenCL_C_Version:  OpenCL C 1.2</p>
<p dir="auto">Is this a bug in OpenCV or am I overlooking a step in building OpenCv with OpenCL. Looking for help and feedback!</p>
<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto">Out of the box I'm having a link error.</p>
<h5 dir="auto">System information (version)</h5>
<ul dir="auto">
<li>OpenCV: 4.0.0-dev</li>
<li>Operating System / Platform: Windows 10 x64 enteprise</li>
<li>Compiler:
<ul dir="auto">
<li>Visual Studio 2017 15.9.1</li>
<li>vcvars64.bat -vcvars_ver=14.16.27023</li>
<li>cmake 3.13.0rc3</li>
<li>cuda 10.0</li>
</ul>
</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">opencv_cudev_main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) bool cv::__termination" (__imp<br>
_?__termination@cv@@3_NA) referenced in function DllMain [I:\opencv-master\build\modules\cudev\opencv_cudev.vcxproj]<br>
I:\opencv-master\build\bin\Release\opencv_cudev400.dll : fatal error LNK1120: 1 unresolved externals [I:\opencv-master<br>
build\modules\cudev\opencv_cudev.vcxproj]</p>
<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto"><code class="notranslate">$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</code></p>