tensorflow 利用GPU进行tf 2.15

slsn1g29  于 5个月前  发布在  其他
关注(0)|答案(2)|浏览(90)

问题类型

构建/安装

你是否在TensorFlow Nightly版本中复现了这个bug?

问题来源

源代码

TensorFlow版本

2.15

自定义代码

OS平台和发行版

WSL Ubuntu 22.04.3(Windows 10)

移动设备

无响应

Python版本

3.10

Bazel版本

无响应

GCC/编译器版本

无响应

CUDA/cuDNN版本

11.8/8.6

GPU型号和内存大小

4095MB NVIDIA GeForce RTX 2070 SUPER

当前行为?

TensorFlow无法找到GPU。

独立代码以重现问题

`python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"`

I have a lot of training data, so I'm trying to get TensorFlow to utilize the computer's GPU. I have been unsuccessful so far. Any help would be greatly appreciated.

The project I'm working on requires tf 2.15.

My understanding is that these are the options for tf to make it run on the GPU:
1. Python 3.9 with tf 2.10
2. Python 3.10 with the [DirectML plugin](https://github.com/microsoft/tensorflow-directml-plugin#tensorflow-directml-plugin-) (tf 2.10)
3. Linux (WSL in this case)

Since the project requirement is tf 2.15, I'm left with only option 3.

I've been following the installation instructions here:
[](https://www.tensorflow.org/install/pip#windows-wsl2)
and here
[](https://docs.nvidia.com/cuda/wsl-user-guide/index.html#cuda-support-for-wsl-2)

I.e. Cuda 11.8 and cuDNN 8.6.

相关日志输出

2024-05-30 21:40:47.425057: 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-05-30 21:40:48.004912: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT

2024-05-30 21:40:48.594078: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.

2024-05-30 21:40:48.613551: 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...
[]

一些其他可能相关的信息:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 520.61.05    Driver Version: 555.85       CUDA Version: 12.5     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  On   | 00000000:01:00.0  On |                  N/A |
|  0%   55C    P0    42W / 215W |    725MiB /  8192MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+
k4emjkb1

k4emjkb11#

请确保您已安装兼容的Nvidia GPU和驱动程序。同时,请核实CUDA、cuDNN和TensorFlow DLLs的路径是否已添加到系统环境变量PATH中。
谢谢!

t3irkdon

t3irkdon2#

感谢回复@sushreebarsa!
是的,我将nvidia-smi输出放在了上面。
您提到了环境变量路径,我将其理解为WSL中的.bashrc文件。然而,当您说"system"和"as well"时,让我觉得您是指在Windows系统上?

相关问题