win10 64 配置tensorflow1.9注意事项

我的电脑是win10 64 用的anconda,安装的是tensorflow1.9 gpu+CUDA 9.0 + cudnn v7.0 版本,在安装过程捣鼓了好久,尝试了还几个版本,以下是注意事项:

特别提醒:我的cuda默认装在C:\Users\hcl\AppData\Local\Temp\CUDA,但是安装完成却跑到了C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0 我也不知道为啥

安装过程中参考的一个博客https://blog.csdn.net/sb19931201/article/details/53648615

1:目前最新的tensorflow1.9只能配置CUDA 9.0 + cudnn v7.0 ,照着tensorflow官网来配置就没问题

https://tensorflow.google.cn/install/install_windows#common_installation_problems

2:cuda9.0的安装过程 一直都是next,把cuDNN下载下来以后,解压并复制至 安装目录C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0 即可

cuda下载链接:https://developer.nvidia.com/cuda-toolkit-archive

cuDNN下载链接:https://developer.nvidia.com/rdp/cudnn-archive

3:在cuda安装完成后,我又添加了两个路径到系统环境变量中:

     C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib

    C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64

4:展示一下运行效果图:第一次运行hi出现红色框内的警告,在别人电脑上也会出现这个,目前也不知道是为什么,正在研究中。。。

例程输入:

import tensorflow as tf
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
print(sess.run(c))

 输出

warning: Debugger speedups using cython not found. Run '"D:\F\Anaconda3\python.exe" "C:\Users\hcl\.p2\pool\plugins\org.python.pydev.core_6.3.3.201805051638\pysrc\setup_cython.py" build_ext --inplace' to build.
pydev debugger: starting (pid: 14604)
D:\F\Anaconda3\lib\site-packages\h5py\__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
2018-07-22 23:02:45.289253: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2018-07-22 23:02:45.482112: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1392] Found device 0 with properties: 
name: GeForce GTX 1050 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.62
pciBusID: 0000:01:00.0
totalMemory: 4.00GiB freeMemory: 3.30GiB
2018-07-22 23:02:45.483065: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1471] Adding visible gpu devices: 0
2018-07-22 23:02:46.329448: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-07-22 23:02:46.329842: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:958]      0 
2018-07-22 23:02:46.330076: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0:   N 
2018-07-22 23:02:46.330418: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1084] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3025 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
Device mapping:
/job:localhost/replica:0/task:0/device:GPU:0 -> device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1
2018-07-22 23:02:46.484913: I T:\src\github\tensorflow\tensorflow\core\common_runtime\direct_session.cc:288] Device mapping:
/job:localhost/replica:0/task:0/device:GPU:0 -> device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1

MatMul: (MatMul): /job:localhost/replica:0/task:0/device:GPU:0
2018-07-22 23:02:46.487999: I T:\src\github\tensorflow\tensorflow\core\common_runtime\placer.cc:886] MatMul: (MatMul)/job:localhost/replica:0/task:0/device:GPU:0
a: (Const): /job:localhost/replica:0/task:0/device:GPU:0
2018-07-22 23:02:46.488641: I T:\src\github\tensorflow\tensorflow\core\common_runtime\placer.cc:886] a: (Const)/job:localhost/replica:0/task:0/device:GPU:0
b: (Const): /job:localhost/replica:0/task:0/device:GPU:0
2018-07-22 23:02:46.489333: I T:\src\github\tensorflow\tensorflow\core\common_runtime\placer.cc:886] b: (Const)/job:localhost/replica:0/task:0/device:GPU:0
[[22. 28.]
 [49. 64.]]

猜你喜欢

转载自blog.csdn.net/zhuisaozhang1292/article/details/81147904