cuda对应的显卡驱动_win10升级cuda+cudnn 至 cuda10.1适配pytorch

本文详细记录了如何在win10系统上,从CUDA 9.2升级到CUDA 10.1,并安装cudnn以配合PyTorch使用GPU加速。升级过程中,无需手动卸载旧版CUDA,安装程序会自动处理。关键步骤包括检查系统配置、下载安装包、安装CUDA和cudnn,以及配置环境变量。通过命令行验证CUDA版本确认升级成功。
摘要由CSDN通过智能技术生成

本人需要升级nvida的独显cuda来适配pytorch以使用GPU加速功能,这篇文章主要是记录一下升级过程。

首先,非常重要的一点——升级至cuda10.1不需要将老的cuda版本手动卸载。网上很多教程都说一定要先把原来的手动卸掉再安装,但我发现在10.1的安装过程中,安装程序会自动帮你卸掉老的。其次是不需要VPN。

一、个人电脑配置情况

OS:win10

显卡:GTX1050ti

cuda:9.2 ->10.1

驱动版本:391 ->425

特别提示:cuda10.1升级需要C盘大于9G的空间,C盘空间不足的需要C盘扩容。(扩容不需要第三方工具,直接用系统内置的磁盘管理完成扩容工作)

二、安装准备

2.1查看cuda版本及相关信息

在CUDA Toolkit Documentation可以查看cuda版本与操作系统的相关信息:

e79975a60ab5fcff0bfe2088685f88d2.png

在自己电脑上 打开NVIDIA控制面板->帮助->系统信息->组件 即可查看自己的cuda版本。

7b6ea7b590e4f74a4b85a4819b136f4c.png

2.2下载cuda安装包

CUDA Toolkit Archive​developer.nvidia.com

选择自己需要的cuda版本下载,此处我自己下的是win10+cuda10.1+local 之后直接download即可。安装包大概2.5G左右。

bd88bcbdb549edf92ea3433f0116a99c.png

2.3下载cudnn安装包

https://developer.nvidia.com/cudnn-download-survey​developer.nvidia.com

(1)注册自己的邮箱作为账号并登录(没有VPN网速比较慢,须耐心等待),选择download cudnn 。

167780f55a0bc0db525c829ffd390413.png

(2)勾选 I AGREE ...选择自己需要的cudnn版本下载,此处我下载的是最新的版本,下下来是个.zip文件。

3cc24ece31ddf44a7ba2663ece85e1dc.png

三、安装步骤

3.1 cuda

(1)双击cuda安装包启动安装程序,默认位置安装即可

ab8896597dafccdf0830cd0de485e665.png

(2)选择自定义安装,去掉VS Intergration,其余全部勾选(网上很多教程都是只选cuda,但是其他选项会自动更新显卡其它的相关驱动,为避免后续可能出现的不兼容问题,我选择都选上)。

db01bcc94ae10bab06b73c7ebf38a7e2.png

(3)安装位置我选择用系统默认

650bd85c1daaa9b5edf5d84bf14a03cb.png

(4)安装完成,会显示各个新驱动程序的安装情况。最后那三个可选可不选。

59a4a2e92c5f620c28313046ef99740c.png

3.2 cudnn

cudnn解压后内部总共3个文件夹,将三个文件夹的内容分别复制添加到cuda10.1文件夹中先对应的文件夹内。(注意不是替换掉三个文件夹)(文件夹默认是C:Program FilesNVIDIA GPU Computing ToolkitCUDAv10.1)

43526adc6d127b38df749a7bb8919678.png
cudnn文件

053af42e0d944b4701a1192c7ed2cea4.png
cuda10.1文件

3.3配置环境变量

此电脑->属性->高级系统设置->环境变量

系统变量中会自动添加 CUDA_PATH&CUDA_PATH_V10_1

ec4a168ea06bee859c568e12b860ee92.png

在path中新增(系统变量还是用户变量看自己的需求):

C:Program FilesNVIDIA GPU Computing ToolkitCUDAv10.1

C:Program FilesNVIDIA GPU Computing ToolkitCUDAv10.1bin

C:Program FilesNVIDIA GPU Computing ToolkitCUDAv10.1libx64

C:Program FilesNVIDIA GPU Computing ToolkitCUDAv10.1libnvvp

3.4 检验

cmd->输入nvcc -V 产看cuda版本号是否更新

f28398496b7b81528f279a1ee1b40583.png

参考资料:

windows10+nvidia驱动+cuda10.1+cudnn安装教程_fengxinzioo的博客-CSDN博客

自编译tensorflow: 1.python3.5,tensorflow1.12; 2.支持cuda10.0,cudnn7.3.1,TensorRT-5.0.2.6-cuda10.0-cudnn7.3; 3.支持mkl,无MPI; 软硬件硬件环境:Ubuntu16.04,GeForce GTX 1080 配置信息: 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 编译: hp@dla:~/work/ts_compile/tensorflow$ bazel build --config=opt --config=mkl --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、付费专栏及课程。

余额充值