cuda10安装_Win10安装GPU版本的Tensorflow 2.1
日期:2020年10月17日
首先,下載Anaconda個人版,最新版本是3.7,安裝的時候推薦把Anaconda添加到系統環境變量中。
https://www.anaconda.com/products/individual
第二步,安裝nv的SDK
在NV官網下載CUDA 10.1:
https://developer.nvidia.com/cuda-10.1-download-archive-base
安裝的時候CUDA 10.1可以選擇高級選項。去掉勾選與VS的集成,特別喜歡VS的當我沒說,個人喜歡輕量級的VS Code,下面會提到。
安裝目錄選擇默認配置就好,點下一步等等就安裝完成了。
下載安裝,cuda 10.1對應的cudnn 7.6版本。(需要注冊NV賬號,微信登錄也行)
https://developer.nvidia.com/rdp/cudnn-archive
下載對應的cudnn,紅框里的都可以。
下載解壓,將cudnn 7.6解壓,放到下面的目錄下,與cuda10.1里的bin合并。
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\最后,將下面的目錄添加到系統變量里。
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin第三步,從開始菜單打開Anaconda的Prompt進入安裝。
1,創建envs環境
conda create -n tf2.1 python==3.72,進入envs環境
conda activate tf2.13,安裝cuda和cudnn
conda install cudatookit=10.1conda install cudnn=7.6
4,安裝tensorflow
pip install tensorflow==2.1如果覺得速度比較慢的話,可以使用國內的源,
pip install tensorflow==2.1 -i https://pypi.tuna.tsinghua.edu.cn/simpleor
pip install tensorflow==2.1 -i https://pypi.douban.com/simple
5,進入python編譯器后查看,如果cuda配置正確的話。
(tf2.1) C:\Users\sk>pythonPython 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2020-10-17 22:43:23.720583: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
>>>
如果配置的有問題,則會提示:cudart64_101.dll not found,cuda沒配置好。
>>> import tensorflow as tf2020-10-17 21:56:58.058980: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-10-17 21:56:58.064859: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
>>>
至此,支持GPU的Tensorflow已經安裝成功。
第四步,在Jupyter Notebook里是不看到我們新創建的envs的,也就用不了jupyter notebook,我們需要配置一下envs:tf2.1,也就是將新建的環境添加到jupyter的kernel中。
pip install ipykernel -i https://pypi.tuna.tsinghua.edu.cn/simplepython -m ipykernel install --name tf2.1
Jupyter Notebook選擇tf2.1,如圖所示,配置成功。
第五步,在VS Code里配置tf 2.1。
第六步,在Pycharm CE里配置tf 2.1。
總結
以上是生活随笔為你收集整理的cuda10安装_Win10安装GPU版本的Tensorflow 2.1的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 蒙特卡洛树搜索的主要流程有哪些_海运拼箱
- 下一篇: 文件头_常见文件文件头