安装tensorflow-gpu时出现问题?

时间:2019-07-20 13:57:30

标签: python tensorflow anaconda

我已经在我的电脑上安装了tensorflow-gpu。然后我在anaconda(tf_gpu)中创建了一个使用tensorflow-gpu的环境。

打开anaconda提示符并激活tf_gpu环境后,键入:

python
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())

我得到以下输出:

2019-07-20 16:47:07.670932: I 
tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports 
instructions that this TensorFlow binary was not compiled to use: AVX 
AVX2
2019-07-20 16:47:07.843280: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 
with properties:
name: GeForce GTX 950M major: 5 minor: 0 memoryClockRate(GHz): 0.928
pciBusID: 0000:01:00.0
totalMemory: 4.00GiB freeMemory: 3.34GiB
2019-07-20 16:47:07.850883: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible 
gpu devices: 0
2019-07-20 16:48:53.443303: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect 
StreamExecutor with strength 1 edge matrix:
2019-07-20 16:48:53.449483: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:990]      0
2019-07-20 16:48:53.453555: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0:   N
2019-07-20 16:48:53.462369: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow 
device (/device:GPU:0 with 3050 MB memory) -> physical GPU (device: 0, 
name: GeForce GTX 950M, pci bus id: 0000:01:00.0, compute capability: 
5.0)
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 659623925268091428
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 3198956339
locality {
    bus_id: 1
  links {
  }
}
incarnation: 17589411030014621263
physical_device_desc: "device: 0, name: GeForce GTX 950M, pci bus id: 
 0000:01:00.0, compute capability: 5.0"
]

当我打开spyder并输入相同的两行代码时:

from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())

什么也没有发生,它会尝试永久编译它。没有错误,没有输出。我也有tensorflow-cpu环境,当我尝试一些在gpu环境中的tensorflow-cpu环境中工作的代码时,也没有任何反应。再次需要永远进行编译。您认为是什么问题?

1 个答案:

答案 0 :(得分:1)

您确定它什么都不做吗?您尝试过等待吗? 我曾经遇到过这个错误:

https://github.com/tensorflow/tensorflow/issues/18652

希望这会有所帮助

那里的大多数人建议安装最新的夜间版本。似乎有效