在Windows 10上使用pycharm在GPU上运行Tensorflow时出错

时间:2019-12-24 07:41:17

标签: python windows tensorflow keras cuda

我一直试图在Windows 10上安装tensorflow-gpu, 我遵循了这个YouTube教程herethis website

总结,我做了以下工作: 首先,我检查了Tensorflow Website中要求的CUDA版本,发现它是CUDA 10.2。然后检查NVidia是否启用并支持我的GPU(GeForce GTX 650)类型,并在列表中找到了它。然后,我按顺序完成了以下步骤:

1-已安装Visual Studio 2019

2-已安装CUDA 10.2

3-已安装cuDNN v 7.6.5

4-在系统环境中添加了以下两个目录:

  • C:\ Program Files \ NVIDIA GPU计算工具包\ CUDA \ v10.2 \ bin

  • C:\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v10.2 \ libnvvp

5-安装Anaconda(Python 3.7)

6-使用python 3.5设置虚拟环境:名为“ Tensorflow-GPU”并激活它。

7-安装了以下软件包:

  • pip install --ignore-installed --upgrade tensorflow-gpu

  • pip install keras

  • pip安装熊猫

  • 点安装numpy

我得到的软件包版本如下:

Python-> 3.5.6

Tensorflow-gpu-> 2.0.0

Keras-> 2.3.1

Keras-Application-> 1.0.8

Kera预处理-> 1.1.0

Numpy-> 1.18.0

h5py- 2.1.0

我尝试通过首先在anaconda提示符下激活环境并导入TensorFlow进行尝试,它可以正常工作且没有错误(在pycharm上也是如此)。 enter image description here

但是,当我使用此简单代码检查TensorFlow是否检测到GPU时,它会提供GPU的信息(如蓝色圆圈所示),然后用“ GPU不可用”将其忽略

代码:

from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
import tensorflow_hub as hub

print("Version: ", tf.__version__)
print("Eager mode: ", tf.executing_eagerly())
print("Hub Version: ", hub.__version__)
print("GPU is", "available" if tf.config.experimental.list_physical_devices("GPU") else "NOT AVAILABLE")

输出:

enter image description here

我搜索了以下警告:“忽略具有Cuda计算能力3.0的可见gpu设备(设备:0,名称:GeForce GTX 650,pci总线ID:0000:01:00.0,计算能力:3.0)。最低要求的Cuda能力是3.5。“

我发现这个answer的说法是从源头而不是pip建立张量流,但是我发现这很困难 !!

为什么未检测到我的GPU?这个过程中有什么问题吗?


1 个答案:

答案 0 :(得分:-1)

您应该使用诸如1050或更高版本的新版本来解决大多数问题。

请参见here

被提及

硬件要求

支持以下支持GPU的设备:

具有CUDA®Compute Capability 3.5或更高版本的NVIDIA®GPU卡。请参阅支持CUDA的GPU卡列表。