#Win7 + tensorflow-gpu1.8.0 + cuda9.0 + cuDNN 7.0 + Python3.5.2 + vs安装教程
如需转载请标明出处:/itas109
QQ技术交流群:129518033
目录
文章目录
#Win7 + tensorflow-gpu1.8.0 + cuda9.0 + cuDNN 7.0 + Python3.5.2 + vs安装教程@[toc]
tensorflow:tensorflow-gpu1.8.0
cuda:cuda_9.0.176_windows
cuDNN:cuDNN v7.1.4 (May 16, ), for CUDA 9.0
python:3.5.2 64bit
编译器:VS 12.0.21005.1 REL
显卡:NVIDIA GeForce GTX 950
系统环境:Windows 7 64bit
##前言
tensorflow与python的结合简直是机器学习的完美搭配,本文就介绍如何搭建tensorflow的gpu开发环境。
##1.VS安装和Python 3.5.2安装
略过
##2.cuda9.0指南知识
CUDA 9.0的安装指南:
/cuda/archive/9.0/cuda-installation-guide-microsoft-windows/index.html
###2.1 CUDA 9.0操作系统支持
###2.2 CUDA 9.0 window下编译器支持
##3.CUDA 9.0安装
###3.1下载CUDA9.0
下载地址:
/cuda-90-download-archive
###3.2安装主程序
点击cuda_9.0.176_windows.exe进行安装
如图,1表示主程序,剩余3个为补丁程序,按照顺序安装即可。
点击同意并继续
点击自定义(高级)
全部勾选,默认即为全部勾选
点击下一步
程序开始安装中…
安装完成
###3.3安装补丁程序
补丁程序按照顺序安装即可
##4.cuDNN安装
版本:
cuDNN v7.1.4 (May 16, ), for CUDA 9.0
下载地址:
/rdp/cudnn-download
###4.1 解压文件
下载完成后解压cudnn-9.0-windows7-x64-v7.1.zip
###4.2 覆盖文件
将文件夹里的内容拷贝到CUDA的安装目录并覆盖相应的文件夹,CUDA拷贝目录:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0
##5.测试sample
测试程序目录:
C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.0
推荐sample:3_Imaging\histogram
其他sample运行失败也无所谓,因为部分Sample依赖了第三方库,所以很多Sample无法正常编译。
##6.安装tensorflow-gpu1.8.0
这里下载的是离线的whl文件,版本为gpu1.8.0
###6.1 下载
下载地址:tensorflow-gpu1.8.0
###6.2 离线安装
pip install c:\tensorflow_gpu-1.8.0-cp35-cp35m-win_amd64.whl
###6.3 安装完成
##7.tensorflow的GPU验证
验证代码
import tensorflow as tfa = tf.test.is_built_with_cuda() # 判断CUDA是否可以用b = tf.test.is_gpu_available(cuda_only=False,min_cuda_compute_capability=None) # 判断GPU是否可以用print(a)print(b)
运行结果:
-07-17 22:40:19.814200: I T:\src\github\tensorflow\tensorflow\core\platform\:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2-07-17 22:40:20.025200: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\:1356] Found device 0 with properties: name: GeForce GTX 950 major: 5 minor: 2 memoryClockRate(GHz): 1.2155pciBusID: 0000:01:00.0totalMemory: 2.00GiB freeMemory: 1.89GiB-07-17 22:40:20.025200: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\:1435] Adding visible gpu devices: 0-07-17 22:40:20.347200: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\:923] Device interconnect StreamExecutor with strength 1 edge matrix:-07-17 22:40:20.348200: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\:929]0 -07-17 22:40:20.348200: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\:942] 0: N -07-17 22:40:20.348200: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\:1053] Created TensorFlow device (/device:GPU:0 with 1668 MB memory) -> physical GPU (device: 0, name: GeForce GTX 950, pci bus id: 0000:01:00.0, compute capability: 5.2)TrueTrue
Refrence:
/cuda/archive/9.0/
/deeplearning/sdk/cudnn-install/index.html#install-windows
/weixin_42359147/article/details/80622306
觉得文章对你有帮助,可以扫描二维码捐赠给博主,谢谢!
如需转载请标明出处:/itas109
QQ技术交流群:129518033