Tensorflow 2找不到GPU

时间:2019-11-16 19:38:13

标签: installation tensorflow2.0

操作系统:Ubuntu 18.04

CPU:Intel i7-8core

GPU:Nvidia GTX 1060

RAM:16 GB

我已使用以下命令在Anaconda虚拟环境中安装了tensorflow 2:

pip unistall tensorflow-gpu == 2.0

安装没有错误,但是当我使用时:

tf.test.is_gpu_available()

我收到以下消息:

I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-11-16 20:36:36.130788: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2808000000 Hz
2019-11-16 20:36:36.131397: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55bd440b6050 executing computations on platform Host. Devices:
2019-11-16 20:36:36.131414: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): Host, Default Version
2019-11-16 20:36:36.133350: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2019-11-16 20:36:36.134418: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: CUDA_ERROR_UNKNOWN: unknown error
2019-11-16 20:36:36.134439: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: quartermaine
2019-11-16 20:36:36.134445: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: quartermaine
2019-11-16 20:36:36.134490: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:200] libcuda reported version is: 430.50.0
2019-11-16 20:36:36.134511: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:204] kernel reported version is: 430.50.0
2019-11-16 20:36:36.134518: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:310] kernel version seems to match DSO: 430.50.0
False

这告诉我们没有可用的GPU。

1 个答案:

答案 0 :(得分:0)

请先尝试重新引导系统,因为可能会有一些待处理的更新。 其次试试这个:-

import os
os.environ['CUDA_VISIBLE_DEVICES'] = "0"