cuda、cudan和tensorflow安装
注意版本的对应
1.tensorflow-gpu版本 1.12.0
https://github.com/fo40225/tensorflow-windows-wheel/tree/master/1.12.0/py36/GPU/cuda100cudnn73sse2
2.cuda版本 v10.0
https://developer.nvidia.com/cuda-toolkit-archive
3.cudnn版本 cudnn-10.0-windows10-x64-v7.4.2.24
https://developer.nvidia.com/rdp/cudnn-download
CUDA(Compute Unified Device Architecture)
cuda是显卡厂商NVIDIA推出的运算平台
下载下来之后一路安装即可,建议进行推荐的精简版安装
安装完成之后进行环境变量的配置和检查
驱动版本的检查
CUDA(Compute Unified Device Architecture)
NVIDIA cuDNN是用于深度神经网络的GPU加速库
下载之后copy至对应的文件夹
tensorflow-gpu
tensorflow-gpu 是在tensorflow的基础上添加了支持GPU运算的调用
https://github.com/fo40225/tensorflow-windows-wheel/tree/master/1.12.0/py36/GPU/cuda100cudnn73sse2
下载之后使用命令安装
pip install tensorflow_gpu-1.12.0-cp36-cp36m-win_amd64.whl
安装完成之后验证
pip list
可以看到
使用代码验证
import tensorflow
print(tensorflow.__version__)
运行结果
可用算力验证
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
运行结果
D:\work\untitled\venv\Scripts\python.exe D:/work/untitled/tensorflow/gpu_vaild.py
2020-02-10 14:10:03.861686: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2020-02-10 14:10:04.436503: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: GeForce GTX 960M major: 5 minor: 0 memoryClockRate(GHz): 1.176
pciBusID: 0000:01:00.0
totalMemory: 2.00GiB freeMemory: 1.64GiB
2020-02-10 14:10:04.436975: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2020-02-10 14:10:05.554941: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-02-10 14:10:05.555159: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2020-02-10 14:10:05.555462: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
2020-02-10 14:10:05.555730: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/device:GPU:0 with 1393 MB memory) -> physical GPU (device: 0, name: GeForce GTX 960M, pci bus id: 0000:01:00.0, compute capability: 5.0)
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 4643708661770041355
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 1461639577
locality {
bus_id: 1
links {
}
}
incarnation: 5075100962980543595
physical_device_desc: "device: 0, name: GeForce GTX 960M, pci bus id: 0000:01:00.0, compute capability: 5.0"
]
Process finished with exit code 0
推荐阅读
https://zhuanlan.zhihu.com/p/91334380