OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Tensorflow GPU support not working on ubuntu

  • Thread starter Thread starter Felix N
  • Start date Start date
F

Felix N

Guest
I am trying to run keras on my GPU.

My setup:

  • NVIDIA Geforce RTX 3070
  • Ubuntu 22.04
  • Python: 3.10

I installed the nvdidia driver via sudo ubuntu-drivers install. Under Software&Updates/Additional Drivers it says that it uses nvidia-driver535. So it has a driver.

I then installed cuda toolkit via sudo apt-get install nvidia-cuda-dev nvidia-cuda-toolkit. I also installed cuDNN via sudo apt install nvidia-cudnn and tensorflow pip install tensorflow which also already includes keras.

But when listing physical devices via the actual tensorflow library it does only list the CPU.

Code:
print(tf.config.list_physical_devices())
[PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU')]

The following is printed when importing tensorflow:

Code:
2024-06-26 23:15:15.129300: I external/local_tsl/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.
2024-06-26 23:15:15.131933: I external/local_tsl/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.
2024-06-26 23:15:15.170793: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-06-26 23:15:15.699070: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
2024-06-26 23:15:16.077326: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:998] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355
2024-06-26 23:15:16.081814: W tensorflow/core/common_runtime/gpu/gpu_device.cc:2251] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...

Seems like the cuda drivers are not found as well as "TensorRT" being missing.

This is a fresh ubuntu install, I did not install any other python packages yet.

What can I do to make this work?
<p>I am trying to run keras on my GPU.</p>
<p>My setup:</p>
<ul>
<li>NVIDIA Geforce RTX 3070</li>
<li>Ubuntu 22.04</li>
<li>Python: 3.10</li>
</ul>
<p>I installed the nvdidia driver via <code>sudo ubuntu-drivers install</code>. Under Software&Updates/Additional Drivers it says that it uses nvidia-driver535. So it has a driver.</p>
<p>I then installed cuda toolkit via <code>sudo apt-get install nvidia-cuda-dev nvidia-cuda-toolkit</code>. I also installed cuDNN via <code>sudo apt install nvidia-cudnn</code> and tensorflow <code>pip install tensorflow</code> which also already includes keras.</p>
<p>But when listing physical devices via the actual tensorflow library it does only list the CPU.</p>
<pre><code>print(tf.config.list_physical_devices())
[PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU')]
</code></pre>
<p>The following is printed when importing tensorflow:</p>
<pre><code>2024-06-26 23:15:15.129300: I external/local_tsl/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.
2024-06-26 23:15:15.131933: I external/local_tsl/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.
2024-06-26 23:15:15.170793: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-06-26 23:15:15.699070: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
2024-06-26 23:15:16.077326: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:998] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355
2024-06-26 23:15:16.081814: W tensorflow/core/common_runtime/gpu/gpu_device.cc:2251] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
</code></pre>
<p>Seems like the cuda drivers are not found as well as "TensorRT" being missing.</p>
<p>This is a fresh ubuntu install, I did not install any other python packages yet.</p>
<p>What can I do to make this work?</p>
 
Top