Turn off CUDA in OpenCV installation? - macos

I am trying to install OpenCV on Mac OSX. I had previously installed CUDA 5.0 but no longer have an NVIDIA GPU and thought I had uninstalled the CUDA drivers. However when I run cmake on the OpenCV source it says it detects CUDA and configures the installation to use it, which then causes the installation to crash due to said lack of GPU or nvcc. How do I turn off this option in the configuration? How can I completely scrub any last trace of CUDA from my system, so that it's not erroneously detected?

Basicly you have only to be sure that the flag WITH_CUDA is deselected. While autoconfiguration during cmake process, OpenCV search for CUDA on the system, for example through references in the environment variables.
To disable CUDA support, add following commandline option:
cmake -DWITH_CUDA:BOOL="0"
Alternatively if you uses a gui for cmake, just search for the WITH_CUDA option and deselect it or set it to OFF

Related

Compile OpenCV 3.4 and Cuda 9.2 with MS VS15 2017

I need to do fast image processing so I decide to go for OpenCV with CUDA support. Now I'm trying to build OpenCV as dll to use it in my project, but I am not even able to generate the VS project since CMake keeps giving me this error:
CMakeError. I am on Windows 10, CMake 3.11 with VS 15 2017 x64 generator, OpenCV 3.4 (the last release).
I have installed CUDA 9.2, 9.1 and 8.0 and set CUDA_HOME environment variable as the CUDA toolkit directory. Nothing seems to work.
Then I try to set the CUDA_SDK_ROOT_DIR through the CMake GUI, but the CUDA toolkit directory seems to be not the right one and I'm not able to find the CUDA sample directory anywhere.
I have googled a lot, but I found nothing that had been able to help me. Did someone face this very same issue? How can I solve it?
PS: I have successfully created the dll with TBB and IPP (without CUDA) and it is still not fast enough, so I really need to use Cuda.
I have solved using Cuda 9.1 and VS 15.45. To install CUDA in a correct way you need to use custom installation and delete the VS integration, since it seems to have some problems. Once installation is complete, CMake should detect it.
This is a guide that could help.

gcc can't find cuda_runtime.h even though path is provided with -I flag (cygwin) [duplicate]

I'm trying to build a simple application with CUDA and I've been trying for hours on end and I just can't make it work on windows. nvcc absolutely refuses to compile without Visual Studio's compiler which doesn't support things I need. I tried building using nvcc with clang but It just asks me to use Visual Studio's compiler. I've also tried using clang directly since it now supports CUDA but I receive this error:
clang++.exe: error: Unsupported CUDA gpu architecture: compute_52
This makes no sense to me because I have the CUDA toolkit version 7.5 and my graphics card is a GTX 970 (two of them). I have googled this extensively and everywhere I come across the error the person always has is their CUDA toolkit is < 7.5. I'm on the brink of tears right now trying to get something as simple as VLA to work on this CUDA application and I just can't achieve it...
The CUDA windows toolchain requires the Visual Studio C++ compiler. You cannot use anything else on that platform. If the VS compiler doesn't support the language features you need within CUDA host code, you have no choice but to change platforms, or your expectations.
You can still potentially compile non-CUDA host code using another compiler and then link that code using NVCC and the VS toolchain.
Try to use clang-cl, --cubin=clang-cl.exe
It may be worth to work on a Linux VM or WSL2 within windows. As per the CUDA docs.
To compile new CUDA applications, a CUDA Toolkit for Linux x86 is
needed. CUDA Toolkit support for WSL is still in preview stage as
developer tools such as profilers are not available yet. However, CUDA
application development is fully supported in the WSL2 environment, as
a result, users should be able to compile new CUDA Linux applications
with the latest CUDA Toolkit for x86 Linux.
https://docs.nvidia.com/cuda/wsl-user-guide/index.html#:~:text=However%2C%20CUDA%20application%20development%20is,becomes%20available%20within%20WSL%202.

Setting up QtCreator cross compiler for ARM on Windows

I need to develop Qt and command line software for the BeagleBone Black and Raspberry Pi-2. Ideally I wish to use QtCreator as I am accustomed to it, but in any case I need to use QtDesigner for GUI work.
I have spent days trawling through articles, going around in circles and getting nowhere.
The Raspberry Pi-2 has Raspbian/Jessie installed together with Qt 5.2.3. I can design, compile and run Qt desktop applications on this. Of course compilation is slow and not really usable for development work.
To try and keep matters simple, I downloaded qt-opensource-windows-x86-android-5.3.2.exe and installed that on my Windows 7 (64-bit) system. My belief is that this Qt install is the same version as the Qt on the Pi-2 and already contains the ARM7 library files required for cross-compiling. All that should be needed is a cross-compiler for Windows/ARM?
Windows/QtCreator complained in Tools > Options > Qt Versions about the Qt 5.3 for Android armv7 stating "No compiler can produce code for this Qt version...".
For a Windows/ARM cross-compiler I downloaded and installed Yagarto (yagarto-bu-2.23.1_gcc-4.7.2-c-c++_nl-1.20.0_gdb-7.5.1_eabi_20121222.exe). I figured I then just need to set the QtCreator compiler path in Tools > Options > Compilers and then things would start working. This is not the case.
Clearly I am missing something important and have managed to become confused by the number of not-quite-relevant articles I have read.
Is Yagarto the cross-compiler I need in this situation?
How do I define the compiler in QtCreator and get rid of the error?
Is there an easier way to set-up this stuff?
Thank you.
Details:
QtCreator 3.2.1 (Qt 5.3.2)
Windows 7 64-bit service pack 1
Edit:
I have just tried again using the GCC ARM Embedded ToolChain and GNU Make for Windows. The result is the same in that I cannot seem to configure the settings for QtCreator ARM7 and make it happy.

Opencv 3: cudarithm.hpp not installed on linux when building without cuda

I have a question regarding the CUDA modules in OpenCV 3. Formerly in OpenCV 2 there was the opencv_gpu module and there was always a opencv2/gpu/gpu.hpp file in the include folder. It would be moved there during install whether OpenCV was built with CUDA or without. In the latter case however, CUDA functions would not be usable later in the code, which could be checked by invoking cv::gpu::getCudaEnabledDeviceCount() which would then always return 0. This way a program that used CUDA could be compiled with versions of OpenCV that were built with CUDA, as well as with ones built without CUDA.
In Opencv 3.0 the CUDA functions have been moved to the modules cudaarithm, cudaimgproc, cudafilters, cudawarping and so on. They are only available if you add the opencv contrib repository.
Now, I was creating a program that uses cuda. Then I realized, that when building and installing OpenCV without CUDA, meaining the machine does not support CUDA and the NVIDIA cuda toolkit is not installed, the header files for the CUDA modules are not copied into the include folder when installing. This way the program doesn't compile. How do you compile a program using the OpenCV CUDA modules with a build that was built without CUDA in OpenCV 3?
Previous Version OpenCV upto 2.3 default build was with CUDA from that onwards if you want to run Opencv with cuda support you have build OpenCV from source with CUDA Check This Guide.
You must have a CUDA enabled GPU to run Opencv with CUDA. NVIDIA CUDA enabled GPU List
Ok, at least for OpenCV 3.1 it appears not to be a problem. The cuda modules have also been moved back to the main repository.
It is necessary to have a version of OpenCV compiled with CUDA. That can be done also on a machine without an Nvidia GPU. The Nvidia CUDA toolkit has to be installed (just ignore the warning message about the GPU). The graphics driver, however, is not required. This way compiling OpenCV with CUDA should not be a problem also on a machine that is not CUDA-enabled.
In your project you can then just include the cudaarithm etc. modules and perform the check if any CUDA devices are available at runtime, just like before.

CUDA installation on Windows

I installed CUDA Toolkit 3.2, CUDA SDK and MS Visual Studio 2008 (not necessarily in this order) on my Windows 7 that does not have an nvidia graphics card.
But when I try running my CUDA code, the CUDA keywords are'nt identified.
I am a beginner. Pls tell me what I am doing wrong here.
Thanks
Are you building using nvcc? If not, Visual C++ will choke on the CUDA-specific syntax.
You should be able to build the SDK samples with your setup, but you won't be able to run since you do not have a CUDA capable GPU. Emulation is no longer supported, so you have a couple of options available:
gpuocelot
PGI CUDA x86
Check out this stackoverflow post for details of syntax highlighting and more in VS2008.
Incidentally, if you installed the Toolkit before VS2008 then the rules files will not have been copied to the VS directories (clearly, since they didn't exist). You can find them and instructions in the CUDA Toolkit in the extras directory.
You if are trying to execute cuda programs on non gpu machines, I would suggest you to try mCUDA. It doesn't need GPU or Graphics card for CUDA execution.
The installation of CUDA development tools on a system running the appropriate version
 Verify the system has a CUDA‐enabled GPU and a supported version of OS.
Many [NVIDIA products today contain CUDA‐enabled GPUs][1]. These include:
 NVIDIA GeForce® 8, 9, 200, and 400 series GPUs
 NVIDIA Tesla™ computing solutions
 Many of the NVIDIA Quadro® products
 Verify the NVIDIA driver and the CUDA software.
 Update the NVIDIA driver.
 Install the CUDA software.
 Verify the the CUDA software linking With VS2008/VS2010
For that you can check my Blog Also http://hemprasad.wordpress.com/2012/10/12/cuda-installation-on-vs-2010/
Test your installation by compiling and running one of the sample programs in the
CUDA software to validate that the hardware and software are running correctly and
communicating with each other.
If you don't have a NVIDIA card, you can still use the emulator but you need to install the SDK and the toolkit. Try to fix your problem by adding in your Visual Studio project settings the include and library path of CUDA.
CUDA is only supported on machines with nVidia video cards. That is likely an issue.
Furthermore, you need to install drivers (dev or otherwise) that is new enough to support the CUDA Toolkit version.
Third, what do you mean by the keywords aren't identified? Do you mean there's no syntax highlighting in your IDE? If so, try [this][1]http://codereflect.com/2008/09/04/how-to-enable-syntax-highlighting-for-cuda-files-in-visual-studio-2005/

Resources