TensorFlow: Use GPU 使用GPU运行TensorFlow

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TensorFlow: Use GPU 使用GPU运行TensorFlow相关的知识,希望对你有一定的参考价值。

参考技术A 硬件要求:NVIDIA® GPU card with CUDA® Compute Capability 3.5 or higher.

See the list of CUDA-enabled GPU cards .
e.g. NVIDIA GeForce 930M是

软件要求:

一些建议:

设备管理器 -> GPU 右键 属性 -> Driver 栏 -> Update Driver

安装: https://developer.nvidia.com/cuda-toolkit-archive

Download cuDNN v7.6.1 (June 24, 2019), for CUDA 10.0
All versions here

将CUDA, CUPTI, cuDNN 路径 加到 系统环境变量PATH 中。
Terminal command:

教程: https://www.jianshu.com/p/64b94a6a7e98

conda activate [env_name]

先卸载 tensorflow (cpu): pip uninstall tensorflow
再安装 tensorflow-gpu 1.13.1: pip install tensorflow-gpu==1.13.1
或安装 tensorflow-gpu 2.0.0-beta1: pip install tensorflow-gpu==2.0.0-beta1

明明有GPU, 为什么会返回False呢?
往上看错误信息:

之后在Terminal中运行成功:

PyCharm: Configure a Conda virtual environment
PyCharm: Setting an existing project interpreter

最后终于在PyCharm中运行成功啦:

Reference:
https://www.tensorflow.org/install/gpu
https://www.tensorflow.org/guide/using_gpu
有问题欢迎留言讨论

以上是关于TensorFlow: Use GPU 使用GPU运行TensorFlow的主要内容,如果未能解决你的问题,请参考以下文章

Tensorflow 不使用 GPU,发现 xla_gpu 不是 gpu

tensorflow只能在装有gpu的机器上运行

TensorFlow中使用GPU

pc虽然识别gpu,但是在tensorflow-gpu中使用了一个CPU

tensorflow怎么删除gpu版本,下载cpu版本

TensorFlow——tensorflow指定CPU与GPU运算