服务器中安装多版本的cuda

cuda和显卡驱动的版本对应关系

 

安装cuda

在服务中已经安装好了cuda10.0,现在需要安装cuda10.1

chmod +x cuda_10.1.105_418.39_linux.run
sudo ./cuda_10.1.105_418.39_linux.run

 

1. 第一步

Do you accept the above EULA? (accept/decline/quit): x

accept

 

2. 选择安装

x CUDA Installer se Agreement                                                  x
x - [ ] Driver                                                                 x
x      [ ] 418.39                                                              x
x + [X] CUDA Toolkit 10.1                                                      x
x   [ ] CUDA Samples 10.1                                                      x
x   [ ] CUDA Demo Suite 10.1                                                   x
x   [ ] CUDA Documentation 10.1                                                x
x   Install                                                                    x
x   Options  

注意:显卡驱动可以不用安装,因为我之前安装的cuda10.0的时候,已经安装了较高版本的显卡驱动,适配cuda10.1

3. 是否修改软连接,都可以

 A symlink already exists at /usr/local/cuda. Update to this installation?    x
x Yes ] Driver                                                                 x
x No   [ ] 418.39  

如果没有修改的话,也可以重新链接到cuda10.1

sudo ln -snf /usr/local/cuda-10.1 /usr/local/cuda

 

4. 安装完成

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-10.1/
Samples:  Not Selected

Please make sure that
 -   PATH includes /usr/local/cuda-10.1/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-10.1/lib64, or, add /usr/local/cuda-10.1/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-10.1/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.1/doc/pdf for detailed information on setting up CUDA.
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 418.00 is required for CUDA 10.1 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run --silent --driver

Logfile is /var/log/cuda-installer.log

安装cudnn

tar xvf cudnn-10.1-linux-x64-v7.5.1.10.tgz
复制到cuda目录. include里面只有cudnn.h
sudo cp cuda/include/* /usr/local/cuda-10.1/include
sudo cp cuda/lib64/*   /usr/local/cuda-10.1/lib64
重置cudnn.h文件的读写权限:
sudo chmod a+r /usr/local/cuda-10.1/include/cudnn.h

在自己的根目录下,指定cuda版本

vim ~/.bashrc

添加以下

#cuda
export PATH=/usr/local/cuda-10.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH

退出保存,

source ~/.bashrc

 

查看当前使用cuda的版本

username@ubuntu:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Fri_Feb__8_19:08:17_PST_2019
Cuda compilation tools, release 10.1, V10.1.105

 

 

  • 5
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值