python


3、tensorflow配置gpu加速

<p><a href="https://blog.csdn.net/louishao/article/details/78827691">https://blog.csdn.net/louishao/article/details/78827691</a>、 CuDA8.0.44,CuDNN至少6.0---win10--python3.5--tensorflow==1.3.0</p> <pre><code class="language-bash">C:\Users\zcr&gt;conda create -n p36-gpu python=3.6 C:\Users\zcr&gt;activate p36-gpu (p36-gpu) C:\Users\zcr&gt;pip install tensorflow-gpu==1.3.0 -i https://pypi.tuna.tsinghua.edu.cn/simple (p36-gpu) C:\Users\zcr&gt;python &gt;&gt;&gt; import tensorflow as tf &gt;&gt;&gt; sess = tf.Session() 2018-09-06 16:48:23.976673: W C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2018-09-06 16:48:23.989645: W C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2018-09-06 16:48:24.709735: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:955] Found device 0 with properties: name: GeForce 840M major: 5 minor: 0 memoryClockRate (GHz) 1.124 pciBusID 0000:03:00.0 Total memory: 2.00GiB Free memory: 1.66GiB 2018-09-06 16:48:24.721736: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:976] DMA: 0 2018-09-06 16:48:24.725216: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:986] 0: Y 2018-09-06 16:48:24.732317: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:1045] Creating TensorFlow device (/gpu:0) -&gt; (device: 0, name: GeForce 840M, pci bus id: 0000:03:00.0) &gt;&gt;&gt; a = tf.constant(2) &gt;&gt;&gt; b = tf.constant(3) &gt;&gt;&gt; print(sess.run(a+b)) 5</code></pre> <p>安装tensorflow1.8.0-gpu</p> <pre><code>C:\Users\zcr&gt;nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2017 NVIDIA Corporation Built on Fri_Sep__1_21:08:32_Central_Daylight_Time_2017 Cuda compilation tools, release 9.0, V9.0.176 C:\Users\zcr&gt;activate keras (keras) C:\Users\zcr&gt;python Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 12:30:02) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; import tensorflow &gt;&gt;&gt; import tensorflow as tf &gt;&gt;&gt; print(tf.__version__) 1.8.0 </code></pre> <h3>新增说明</h3> <p>1、安装anaconda、配置anaconda加速、配置pip加速 2、下载cuda_9.0.176_win10.exe 3、下载cudnn-9.0-windows10-x64-v7.4.1.5.zip 4、安装cuda_9.0.176_win10.exe</p> <pre><code>CUDA Toolkit 9.0 Downloads--安装 Download cuDNN v7.1.2 (Mar 21, 2018), for CUDA 9.0--下载完后解压复制到 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0 目录下</code></pre> <p>5、增加环境变量到path</p> <pre><code>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64</code></pre> <p>6、</p> <pre><code>C:\Users\zcr&gt;activate p36 (p36) C:\Users\zcr&gt;pip install tensorflow-gpu==1.11 .... (p36) C:\Users\zcr&gt;python Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 12:30:02) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; import tensorflow &gt;&gt;&gt;</code></pre> <p>7、gpu版成功</p> <h3>2019 04.01</h3> <p>下载链接 <a href="https://developer.nvidia.com/cuda-10.0-download-archive">https://developer.nvidia.com/cuda-10.0-download-archive</a></p> <p><a href="https://developer.nvidia.com/rdp/cudnn-download">https://developer.nvidia.com/rdp/cudnn-download</a></p>

页面列表

ITEM_HTML