python - 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)
解决方案
推荐阅读
- rust - 转换一个 MaybeUninit<[T; 听起来不错吗?N]> 到 [MaybeUninit
; N]? - azure - azure devops 使用 asp.net core 2.2 构建错误
- spring-boot - 尝试实现 hatos 时出现编译时错误,它没有向我显示 methodOn 方法
- c++ - 不是多态类型,或者为什么我们需要虚拟析构函数?
- javascript - Mapbox 地理编码和方向 API
- angular - 是否可以在模块中同时使用 NgxUiLoaderHttpModule 和 NgxUiLoaderRouterModule。ts?
- android - 如何在 SQL 中向表中添加几列?
- postgresql - 如何通过一个查询插入多行?
- javascript - 在子组件中的输入元素中的 Keydown.enter 事件上,也调用了父组件中定义的方法
- arangodb - ArangoDB AQL - 我可以在一个查询中遍历多个图吗?