如何使用 TensorFlow GPU? [英] How do I use TensorFlow GPU?
问题描述
如何在 Python 3.6 x64 中使用 TensorFlow GPU 版本而不是 CPU 版本?
How do I use TensorFlow GPU version instead of CPU version in Python 3.6 x64?
import tensorflow as tf
Python 使用我的 CPU 进行计算.
我可以注意到它,因为我有一个错误:
Python is using my CPU for calculations.
I can notice it because I have an error:
您的 CPU 支持此 TensorFlow 二进制文件不支持的指令编译使用:AVX2
Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
我已经安装了 tensorflow 和 tensorflow-gpu.
I have installed tensorflow and tensorflow-gpu.
如何切换到 GPU 版本?
How do I switch to GPU version?
推荐答案
遵循本教程 Tensorflow GPU 我做到了,而且效果很好.
Follow this tutorial Tensorflow GPU I did it and it works perfect.
注意! - 安装 9.0 版! Tensorflow-gpu 不支持更新的版本
Attention! - install version 9.0! newer version is not supported by Tensorflow-gpu
步骤:
- 卸载旧的 tensorflow
- 安装tensorflow-gpu
pip install tensorflow-gpu
- 安装 Nvidia 显卡 &驱动程序(您可能已经有了)
- 下载&安装 CUDA
- 下载&安装cuDNN
- 通过简单的程序验证
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
这篇关于如何使用 TensorFlow GPU?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!