How to install openCV 3.1 with full cuda toolkit support? - opencv

I am installing openCV 3.1 following this guide. However after running CMake I see the following output
NVIDIA CUDA
Use CUFFT: YES
Use CUBLAS: NO
USE NVCUVID: NO
NVIDIA GPU arch: 20 21 30 35
NVIDIA PTX archs: 30
Use fast math: NO
I see that CUBLAS, NVCUVID and fastmath is set to NO. But I have installed cuda toolkit 7.5, so I don't understand why is it still NO, and how can I make so to install with full gpu support?
I am using Ubuntu 16.04, OpenCV 3.1

The guide that you mentioned using does not appear to have a flag related to or set to turn on the fast math feature. As far as I am aware you need to specify this during the cuda toolkit build or it will not be included in the build.
For example if you are using NVCC you must use the --use_fast_math flag; as is indicated here. So it is likely that the CMAKE scripting doesn't have that flag set anywhere either.

Related

Troubleshoot DPC++ targeting GPU with and without CUDA

I followed the instructions at the below website to test DPC++ on my computer.
https://github.com/intel/llvm/blob/sycl/sycl/doc/GetStartedGuide.md#build-dpc-toolchain
$ ./simple-sycle-app.exe
The results are correct!
I then modified line 23 to target my gpu
// Creating SYCL queue
sycl::queue Queue( sycl::gpu_selector{} );
[18:49]ec2-user$ ./simple-sycl-app-gpu.exe
terminate called after throwing an instance of 'cl::sycl::runtime_error' what(): No device of requested type available. -1 (PI_ERROR_DEVICE_NOT_FOUND) Aborted (core dumped)
did i need to build my dpc environment with CUDA enabled to access my K80 Nvidia GPU? I didn't enable it because CUDA support is apparently still experimental. I thought the whole point of using DPC++ was for me not to need to use CUDA. Should i be able to use my Nvidia gpu with just an nvidia driver and not CUDA?
You need to build llvm compiler with CUDA support. Brief instruction is to
install CUDA development kit, e.g. from here
Build and install Intel's llvm compiler from sources: https://github.com/intel/llvm passing --cuda param to configure command (see instructions on project's README)
use compiler according to this instruction, e.g. like this:
export DPCPP_HOME=~/sycl_workspace
export PATH=$DPCPP_HOME/llvm/build/bin:$PATH
export LD_LIBRARY_PATH=$DPCPP_HOME/llvm/build/lib:$LD_LIBRARY_PATH
clang++ -fsycl -fsycl-targets=nvptx64-nvidia-cuda \
simple-sycl-app.cpp -o simple-sycl-app-cuda.exe

Using GPU in OpenCV

If I want to use my computer's GPU with OpenCV, is it necessary that I build OpenCV from source with CUDA enabled? Or can I install OpenCV with CUDA support via apt-get? I noticed the following 2 packages in apt-get:
libopencv-gpu-dev - development files for libopencv-gpu2.4v5
libopencv-gpu2.4v5 - computer vision GPU library
But I am not sure if these will work with OpenCV3 or if they are only compatible with OpenCV2. I know that the gpu module in Opencv2 was split up into multiple CUDA modules in OpenCV3.
Yes it is necessary that you build opencv from the source with CUDA option enabled. The apt-get packages won't work with OpenCV3 and above versions. I suggest you install the CUDA Toolkit first and then attempt installation of OpenCV or the GPU functions won't work.

CUDA driver version is insufficient for CUDA runtime version - OpenCV - GPU Toolkit

I am trying to run the CUDA GPU Toolkit 7.5 built with OpenCV 3.1.0 .
My graphic card is : Nvidia Quadro FX 5800 . Driver version : 341.92 (Latest available version for the same)
Nvidia classifies my Graphics card in the legacy category with the 1.3 compute capability.
I keep getting the error in the title. and can understand the driver mismatch.
I updated to the latest driver for the graphics card.
My question is what version of the GPU toolkit should i build opencv with ? that would also be compatible with VS 2013 C++ env. I tried building it with CUDA toolkit 6.0 and its not compatible with VS 2013.
Sticky situation any advice would be appreciated.
This was fixed by building OpenCV with 1.3 compute capability. Dont let Cmake choose it automatically. CUDA_ARCH_PTX was set to 1.3 ->(which is the compute capability of my legacy graphics card).

opencv error: no GPU support

I have install Cuda 6.5 and opencv 2.4.9 with visual studio 2010, when I run gpu, I get error
Opencv Error: No GPU support(the library is compiled without PGU support) in the row_nogpu, file C:/builds/2_4_Packslave-win32-vc10-shared/opencv/modules/gpu/src/precomp.hpp line 135
I get this error, is any one can help what do I have to do?
Thanks
I believe, you have to actually build the libraries with CUDA support. I Imagine This Guide will be useful.
This can be caused because of following.
Use the flag WITH_CUDA=ON during cmake
You are trying to load the libraries which are compiled without GPU support, after you install opencv make sure you change the libraries path to that of GPU supported once.

Does OpenCV for Mac use the Accelerate framework?

The Accelerate framework is a Mac-specific framework that provides things like image convolutions and LAPACK, supposedly optimized to be as fast as possible on Macs. My question: Does OpenCV take advantage of this? Specifically, does the function "filter2D" use Accelerate?
It does not use the Accelerate framework, but it looks like it has been speeded up using the CUDA stuff in 2.2
The relevant files in OpenCV2.2 ...
/modules/gpu/include/opencv2/gpu/gpu.hpp
/modules/gpu/src/filtering.cpp
and
modules/imgproc/src/filter.cpp
for the non-gpu stuff
Not a mac expert but AFAIK openCV uses IPP (if installed) TBB (build option) and NVidia-CUDA (build option)
If you use the MacPorts version, you can specify the options
$ port variants opencv
opencv has the variants:
debug: Enable debug binaries
python26: Add Python 2.6 bindings
* conflicts with python27
python27: Add Python 2.7 bindings
* conflicts with python26
tbb: Use Intel TBB
universal: Build for multiple architectures
I have used
sudo port install py26-numpy
sudo port install opencv +python26 +tbb
with success. Concerning the Accelerate.framework specifically, this blog entry says "# Add Accelerate.framework which is used internally from OpenCV library.", but I have no clue as to know if it is the case here.

Resources