[更新时间:2019.1.2]Win10 +VS2017+ python3.66 + CUDA9.2 + cuDNNv7.2.1 + tensorflow-gpu 1.12.0 最新版

Win10 +VS2017+ python3.66 + CUDA9.2 + cuDNNv7.2.1 + tensorflow-gpu 1.12.0 最新版

 

 

官网的tensorflow 1.10只支持 cuda9.0  不支持9.2,不安装cuda9.0的话会出错。本文的目的是用最新版的CUDA9.2 + cuDNNv7.2.1来运行tensorflow 1.10

 

 

 

CUDA安装

根据官网描述在下载CUDA之前请确保:

  1. GPU型号兼容
  2. 支持的Windows版本
  3. 支持的Microsoft Visual Studio版本

cuda下载地址:http://developer.nvidia.com/cuda-downloads

CUDA安装路径:“C:\ProgramData\NVIDIA GPU Computing Toolkit\v9.2” 

或者安装在D:\ProgramData\NVIDIA GPU Computing Toolkit\v9.2 后面下载的cudnn要放在CUDA安装路径中。

 

这里我安装的是Microsoft Visual Studio 2017,但是之前在安装CUDA 9.2时总是安装失败,于是又尝试了9.1 ,9.0都是一样的问题,安装失败,所以我判断是Microsoft Visual Studio 的问题。之后重装了Microsoft Visual Studio 2017 ,成功安装。

输入nvcc --version或者nvcc -V验证:

Win10 +VS2017+ python3.66 + CUDA9.2 + cuDNNv7.2.1 + tensorflow-gpu 1.10.0 最新版

cuDNN下载

cuDNN只是cuda的一个补丁。需要注册一个官网帐号, 下载地址:https://developer.nvidia.com/rdp/cudnn-download

https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.2.1/prod/9.2_20180806/cudnn-9.2-windows10-x64-v7.2.1.38

 

注意下载的是这个版本cuDNNv7.2.1 ,之前的版本是 7.1.4 会出以下错误

Loaded runtime CuDNN library: 7.1.4 but source was compiled with: 7.2.1. 

解压缩下载的CuDnn文件,得到3个文件夹:bin, include, lib。

将这个三个文件夹复制到“C:\ProgramData\NVIDIA GPU Computing Toolkit\v9.2” (CUDA安装路径

或者安装在D:\ProgramData\NVIDIA GPU Computing Toolkit\v9.2

之后确认环境变量:

确认CUDA_PATH和CUDA_PATH_V9.2已经存在。如果没有。

手动添加 “C:\ProgramData\NVIDIA GPU Computing Toolkit\v9.2\bin”到Path里面。

如何验证是否正确安装了CUDA

在运行里面输入“cmd” 然后用命令“nvcc -V”进行测试 必须用大写的V,否则出错

即如下的代码

nvcc -V

运行的结果如下

 

==============================

pip安装Tensorflow-gpu

 注意:

目前tensorflow还不能支持cuda9.2,所以只能通过源码编译或者别人编译好的安装包安装。大神编译的各种版本的tensorflow安装包地址:https://github.com/fo40225/tensorflow-windows-wheel

根据说明找到资源路径:[1.11-1.12 必须安装cuda10]

 

https://raw.githubusercontent.com/fo40225/tensorflow-windows-wheel/master/1.12.0/py36/GPU/cuda100cudnn73avx2/tensorflow_gpu-1.12.0-cp36-cp36m-win_amd64.7z.001

https://raw.githubusercontent.com/fo40225/tensorflow-windows-wheel/master/1.12.0/py36/GPU/cuda100cudnn73avx2/tensorflow_gpu-1.12.0-cp36-cp36m-win_amd64.7z.002

下载完成后:2个文件合并一下。

tensorflow_gpu-1.12.0-cp36-cp36m-win_amd64.whl

复制到C:\Windows\System32文件夹下,然后执行命令:pip install tensorflow_gpu-1.12.0-cp36-cp36m-win_amd64.whl(若运行失败,会报错在哪个文件夹不能找到该文件,再把.whl文件移到指定文件夹即可)

或cmd直接 cd 到存放的目录 D:\Tensorflow下

【需要翻~~~墙,否则 installed tensorboard-1.12.0 无法安装,导致安装失败】

 

最后pip list查看:

 

运行测试

最后输入python

输入import tensorflow as tf 查看:

完工~~体验gpu的运算速度吧

Win10 +VS2017+ python3.66 + CUDA9.2 + cuDNNv7.2.1 + tensorflow-gpu 1.10.0 最新版

还有问题的,可以加群264191384 注明(warp)

WIN10+cuda10+pytorch+py3.68环境下,warpctc 编译不成功的解决办法

自编译tensorflow1.python3.5,tensorflow1.12; 2.支持cuda10.0,cudnn7.3.1,TensorRT-5.0.2.6-cuda10.0-cudnn7.3; 3.无mkl支持; 软硬件硬件环境:Ubuntu16.04,GeForce GTX 1080 TI 配置信息: hp@dla:~/work/ts_compile/tensorflow$ ./configure WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown". You have bazel 0.19.1 installed. Please specify the location of python. [Default is /usr/bin/python]: /usr/bin/python3 Found possible Python library paths: /usr/local/lib/python3.5/dist-packages /usr/lib/python3/dist-packages Please input the desired Python library path to use. Default is [/usr/local/lib/python3.5/dist-packages] Do you wish to build TensorFlow with XLA JIT support? [Y/n]: XLA JIT support will be enabled for TensorFlow. Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: No OpenCL SYCL support will be enabled for TensorFlow. Do you wish to build TensorFlow with ROCm support? [y/N]: No ROCm support will be enabled for TensorFlow. Do you wish to build TensorFlow with CUDA support? [y/N]: y CUDA support will be enabled for TensorFlow. Please specify the CUDA SDK version you want to use. [Leave empty to default to CUDA 10.0]: Please specify the location where CUDA 10.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: /usr/local/cuda-10.0 Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 7]: 7.3.1 Please specify the location where cuDNN 7 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda-10.0]: Do you wish to build TensorFlow with TensorRT support? [y/N]: y TensorRT support will be enabled for TensorFlow. Please specify the location where TensorRT is installed. [Default is /usr/lib/x86_64-linux-gnu]://home/hp/bin/TensorRT-5.0.2.6-cuda10.0-cudnn7.3/targets/x86_64-linux-gnu Please specify the locally installed NCCL version you want to use. [Default is to use https://github.com/nvidia/nccl]: Please specify a list of comma-separated Cuda compute capabilities you want to build with. You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus. Please note that each additional compute capability significantly increases your build time and binary size. [Default is: 6.1,6.1,6.1]: Do you want to use clang as CUDA compiler? [y/N]: nvcc will be used as CUDA compiler. Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: Do you wish to build TensorFlow with MPI support? [y/N]: No MPI support will be enabled for TensorFlow. Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native -Wno-sign-compare]: Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: Not configuring the WORKSPACE for Android builds. Preconfigured Bazel build configs. You can use any of the below by adding "--config=" to your build command. See .bazelrc for more details. --config=mkl # Build with MKL support. --config=monolithic # Config for mostly static monolithic build. --config=gdr # Build with GDR support. --config=verbs # Build with libverbs support. --config=ngraph # Build with Intel nGraph support. --config=dynamic_kernels # (Experimental) Build kernels into separate shared objects. Preconfigured Bazel build configs to DISABLE default on features: --config=noaws # Disable AWS S3 filesystem support. --config=nogcp # Disable GCP support. --config=nohdfs # Disable HDFS support. --config=noignite # Disable Apacha Ignite support. --config=nokafka # Disable Apache Kafka support. --config=nonccl # Disable NVIDIA NCCL support. Configuration finished 编译: bazel build --config=opt --verbose_failures //tensorflow/tools/pip_package:build_pip_package 卸载已有tensorflow: hp@dla:~/temp$ sudo pip3 uninstall tensorflow 安装自己编译的成果: hp@dla:~/temp$ sudo pip3 install tensorflow-1.12.0-cp35-cp35m-linux_x86_64.whl
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值