I want to know whether opencv3 and python3 have GPU mode? - python

I want to know whether opencv3 and python3 have GPU mode,I looked at this link and knew that there was no GPU mode when opencv2, but does opencv3 have GPU mode now?

You can manually compile the OpenCV 3 source with GPU support for Python 3. All steps are outlined in this blog post. To answer your question, follow all parts of Step 0 up to and including step 5 to install OpenCV 3 with GPU support for Python 3.
The major requirement is to have an NVIDIA graphics card with CUDA support and all required graphics drivers installed. These steps should work for any debian-like linux distro, I have tested on Ubuntu 16.04, 17.04 and Linux Mint 18.3 without problem.

As per the latest release 4.0.0-pre, GPU modules are not yet supported by OpenCV-python.
Remaining fields specify what modules are to be built. Since GPU modules are not yet supported by OpenCV-Python, you can completely
avoid it to save time (But if you work with them, keep it there).
Source: OpenCV Docs
Related Question

Related

My tensorflow doesn't detect my gpu and use my cpu (machine learning)

I try to train a machine learning model with my rtx380 10g and I use ubuntu 20.4 on my computer.
When i lunch my application, it says me :
2021-07-02 10:29:53.581609: I tensorflow/core/platform/profile_utils/cpu_utils.cc:114] CPU Frequency: 2496000000 Hz
after that, i tried to print len(my phisical_devices('Gpu')) but it gives me "0".
I installed Conda, but i'm not sure it's working. (Same for Cudnn)
To be honest, i'm quite lost now.
I had the same issue, did you install CUDA Toolkit, is it the right version based on your GPU?
Also did you do
pip install tensorflow-gpu
Try this thread: Tensorflow not running on GPU
it's probably a compatibility issue. Make sure your TF version is compatible with the Python, Cuda & Cudnn versions that are installed on ur PC and make sure that Microsoft Visual Studio is installed.
I'm currently using TF2.4, Python 3.8, Cuda 11.0 and Cudnn 8.0. Give this combination a try and see if it works.

GPU processing - cuDF install problem (O/S or hardware issue?)

My aim to to explore GPU acceleration for tabular data with 10,000 to 10M+ records. I am most familiar with Pandas, so cuDF seems like a good place to start.
I'm finding mixed results re: whether cuDF will run on my system (Windows 7 Pro 64-bit, i7-6820HQ, 32GB RAM, NVidia Quadro M2000M 4GB). There is also an onboard graphics card.
per the gitHub page (https://github.com/rapidsai/cudf):
CUDA/GPU Requirements
CUDA 10.0+ (YES - I have v10.1.120)
NVIDIA driver 410.48+ (YES - I have 432.06)
Pascal architecture or better (NO - Maxwell)
I have heard that Pascal architecture is preferred/optimal as opposed to a requirement, but maybe that was for older versions of cuDF? Just this morning I heard it will run on Win 64, though performance benefits may also be reduced. Nonetheless, I'm interested in giving it a shot.
When I install from the conda prompt (python 3.6 env) using the recommended command for my CUDA version:
conda install -c rapidsai -c nvidia -c numba -c conda-forge cudf=0.13
python=3.6 cudatoolkit=10.1
I get:
Collecting package metadata (repodata.json): done Solving environment:
failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from
current channels:
cudf=0.13
Current channels:
https://conda.anaconda.org/rapidsai/win-64
https://conda.anaconda.org/rapidsai/noarch
https://conda.anaconda.org/nvidia/win-64
https://conda.anaconda.org/nvidia/noarch
https://conda.anaconda.org/numba/win-64
https://conda.anaconda.org/numba/noarch
https://conda.anaconda.org/conda-forge/win
https://conda.anaconda.org/conda-forge/noa
https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-6
https://repo.anaconda.com/pkgs/msys2/noarc
To search for alternate channels that may provide the conda package
you're looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
When I go to anaconda.org and search for cuDF (or RAPIDS), all I find are Linux installs.
I attended an Anaconda-sponsored webinar earlier today where the speaker said it'll run in Win-64, though this older post suggest maybe I need to build from source:
Package not found error while installing CuSpatial or CuDf library
I'm not ready to attempt a build from source. Am I just wasting my time? Recommendations appreciated (for either resolving cuDF with my system or alternative packages).
cuDF maintainer here.
Currently, cuDF nor any other RAPIDS libraries are supported in a native Windows environment. There's an issue tracking Windows support here: https://github.com/rapidsai/cudf/issues/28.
In general, native Windows support is not a priority for us, especially given the push towards GPU support in WSL2 that is currently in open beta.
Apparently there are some news regarding this. Here one can find the guide for using NVIDIA CUDA on Windows Subsystem for Linux.
Getting started with running CUDA on WSL requires you to complete
these steps in order:
1. Installing the latest builds from the Microsoft Windows Insider Program
2. Installing the NVIDIA preview driver for WSL 2
3. Installing WSL 2
Important note regarding the installation of the latest builds from the Microsoft Windows Insider Program
Ensure that you install Build version 20145 or higher.
You can check your build version number by running winver via the Windows Run command. (Source)
Hopefully next year a version of Windows that meets the Build version 20145 or higher requirement will be released and then one doesn't need to run an "Insider Program" build.
Source for Windows 10 release information.
Here one will be able to follow all the updates regarding the Support for Windows.

Difference between installation libraries of Tensorflow GPU vs CPU

Recently, I wanted to move my Python libraries to a pendrive to keep all the libraries constant while switching between my workstation and laptop. (Also so that if I update one, it's updated on other also.)
For this, I have installed a tensorflow-gpu version on my pendrive (my laptop doesn't have a GPU). Everything works fine without a problem on both PC (it detects and uses my GPU without a problem) and laptop (it automatically uses my CPU).
That's where my question lies. What is the difference between a
tensorflow-gpu
AND just
tensorflow
? (Because when no GPU is found, tensorflow-gpu automatically uses the CPU version.)
Does the difference lie only in the GPU support? Then why at all have a non GPU version of tensorflow?
Also, is it alright to proceed like this? Or should I create virtual environments to keep separate installations for CPU and GPU?
The closest answer I can find is
How to develop for tensor flow with gpu without a gpu.
But it only specifies that it's completely okay to use tensorflow-gpu on a CPU platform, but it still does not answer my first question. Also, the answer might be outdated as tensorflow keeps releasing new updates.
I had installed the tensorflow-gpu version on my workstation with GTX 1070 (Thus a successful install).
Also I understand the difference is that pip install tensorflow-gpu will require CUDA enabled device to install, but my question is more towards the usage of the libraries because I am not getting any problems when using the tensorflow-gpu version on my laptop (with no GPU) and all my scripts run without any error.
(Also removed pip install from above to avoid confusion)
Also, isn't running tensorflow-gpu on a system with no GPU the same as setting CUDA_VISIBLE_DEVICES=-1?
One thing to Note: CUDA can be installed even if you don't have a GPU in your system.
For packages tensorflow and tensorflow-gpu I hope this clears the confusion. yes/no means "Will the package work out of the box when executing import tensorflow as tf"? Here are the differences:
| Support for TensorFlow libraries | tensorflow | tensorflow-gpu |
| for hardware type: | tf | tf-gpu |
|----------------------------------|------------|-----------------|
| cpu-only | yes | no (~tf-like) |
| gpu with cuda+cudnn installed | yes | yes |
| gpu without cuda+cudnn installed | yes | no (~tf-like) |
Edit: Confirmed the no answers on a cpu-only system and the gpu without cuda+cudnn installed (by removing CUDA+CuDNN env variables).
~tf-like means even though the library is tensorflow-gpu, it would behave like tensorflow library.
Just a quick (unnecessary?) note... from TensorFlow2.0 onwards these are not separated, and you simply install tensorflow (as this includes GPU support if you have an appropriate card/CUDA installed).
tensorflow-gpu requires cuda/cudnn. tensorflow does not. pip doesn't install cuda for you (conda does), so pip install tensorflow-gpu won't work out of the box on most systems without a nvidia gpu.

How to check whether computer capable to run tensorflow gpu and how to install tensorflow gpu version

First, I am not sure my computer(macbook pro) is capable of running tensor flow on GPU. I have checked system/hardware/Graphics-Display settings. You can find below related infos.
Graphics: Intel Iris Pro 1536 MB
So, Is it possible to run tensor flow on GPU with this computer graphics capabilities?
Second question, I am using conda environment to install tensor flow. On tensorflow installation page I could only find pip package for cpu. How could I install tensor gpu package? tensorflow installarion page
https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.3.0-py3-none-any.whl
The newest version of tensorflow does not have gpu support for mac os, as seen here.
I havent found any way to run my application (which uses tensorflow) with gpu support in my Mac. It has an "Intel Iris Ghaphics 6100" graphic card.
In this report (Can I run Cuda or opencl on intel iris?) says that only NVDIA ghaphic cards have CUDA supports, then likely I wont be able to do ..
But I have installed tensorflow-gpu without problems following this ways:
https://wangpei.ink/2019/03/29/Install-TensorFlow-GPU-by-Anaconda(conda-install-tensorflow-gpu)/

how to deal with `GCC` in tensorflow installation with gpu?

I am installing tensorflow with Gpu support. There is an installation guide in the tensorflow web site which explain more about CUDA Toolkit. In this guide system requirement is described. A row in table 1 dedicate to GCC version and other ones is Kernel and etc. I know my ubuntu 16.4 LTS is based on kernel 4.4 but the GCC version dose not match with the table. My gcc is 5.4.0 and the table said that gcc-5.3.1 needed.
My OS is Ubuntu 16.4 LTS xenial xerus and i have a Geforce GTX 1080 in my system.
There is two question.
1- What should i do? Do i need to downgrade it or gcc-5.4.0 work as well?
2- If it is necessary to downgrade , could anyone explain how ?
3- Why gcc-5.4.0 compiler does not exist in /usr/bin ? how should refer to it ?
gcc-5.4 may work, but as it's not a supported configuration it's hard to say for sure. It may be worth giving it a try to see if you hit problems if you're reluctant to switch.
If you do want to switch, I like to use the update-alternatives approach to manage different versions of gcc on Ubuntu, as described here:
https://codeyarns.com/2015/02/26/how-to-switch-gcc-version-using-update-alternatives/

Categories