0
$\begingroup$

I am trying to make tensorflow work with gpu support.

First I have tensorflow-gpu installed: enter image description here

However, there is no gpu available. When I run the nvidia-smi and nvcc --version in terminal, I get:

enter image description here

So, my driver and cuda toolkit are available. Can anybody explain why is the gpu not available to tensorflow?

Edit: my tensorflow version is 2.8.0 and my python version is 3.7.3

$\endgroup$

2 Answers 2

1
$\begingroup$

The nvidia-smi is not likely to show any usage of the GPU until you actually load something into it in your notebook. There are many reasons why the gpu is not detected in keras. The easiest solution I think is to follow the installation steps carefully from scratch: https://www.tensorflow.org/install/pip

$\endgroup$
1
  • $\begingroup$ Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. $\endgroup$
    – Community Bot
    Commented Jun 14, 2022 at 1:43
0
$\begingroup$

Maybe late for OP but I had the same issue (same code on console gives a GPU but nothing on jupyter), here is what I did:

  • check that your python is the same for jupyter and on console: !which python (jupyter) must be the same as which python (console)
  • check GPU compatibility with tensorflow, you need to install cuda and cudnn (apparently you got this: in my case I installed cudnn with pip install --user nvidia-cudnn-cu11, check this version with nvcc --version)
  • uninstall jupyter and reinstall it (if you installed tensorflow with sudo do the same with jupyter and then open it with sudo jupyter notebook, I personally use pip install -user jupyter; in case you have problems removing jupyter install pip install pip-autoremove (sudo or --user flag you chose but be consistent, you can also create a new python venv, which is recommended)

I didn't installed tensorflow-gpu and the GPU was detected. For more information:

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.