首页 > 解决方案 > TensorFlow 只看到 cpu

问题描述

我已经尝试了几乎所有的方法,但 tensorflow 没有看到 gpu。

>>> tf.test.is_gpu_available()
WARNING:tensorflow:From <stdin>:1: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2020-10-08 16:57:31.356377: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-10-08 16:57:31.408641: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 2299965000 Hz
2020-10-08 16:57:31.409379: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5d51170 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-10-08 16:57:31.409459: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-10-08 16:57:31.425795: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcuda.so.1
2020-10-08 16:57:32.550621: E tensorflow/stream_executor/cuda/cuda_driver.cc:314] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2020-10-08 16:57:32.550734: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (dmitry-pc): /proc/driver/nvidia/version does not exist
False
>>> tf.python.client.device_lib.list_local_devices()
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 15855895153430362166
, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 2500413154884527026
physical_device_desc: "device: XLA_CPU device"
]

Ubuntu 20.04

GPU-> geforce 940mx

CUDA-> 10.1

cudnn-> 7.6

张量流-GPU-> 2.3.1

我尝试重新安装 tensorflow、cuda、cudnn。详细的建议也无济于事(https://stackoverflow.com/a/55891075/13669210

标签: pythontensorflowgpu

解决方案


推荐阅读