ubuntu18.04安装多个CUDA版本

ubuntu18.04安装多个CUDA版本

 

首先安装nvidia驱动,目前nvidia驱动版本是:465.31

安装教程参考文章:https://blog.csdn.net/ByteMelody/article/details/117298221?spm=1001.2014.3001.5502

为了兼容Tensorflow,PyTorch等深度学习框架。这里选择安装2个CUDA版本,分别是:CUDA11.1.0和CUDA10.2版。

 

1.搜索CUDA点击进入下载页

2.点击立刻下载

 

3.选择历史版本

4.选择对应版本

5.分别下载CUDA10.2和CUDA11.1.0版本的相关文件。

 

6.分别安装这两个版本的CUDA

ls -hl
total 6.0G
-rw-rw-r-- 1  119M Aug 11  2020 cuda_10.2.1_linux.run
-rw-rw-r-- 1  119M Nov 10  2020 cuda_10.2.2_linux.run
-rw-rw-r-- 1  2.5G Nov 14  2019 cuda_10.2.89_440.33.01_linux.run
-rw-rw-r-- 1  3.3G May 20 19:00 cuda_11.1.0_455.23.05_linux.run

sudo sh cuda_10.2.89_440.33.01_linux.run

 

输入:accept

因为已经安装过更高版本的驱动所以这里选择不安装驱动 ,其余都安装。

cuda10.2版本安装成功!

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

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-10.2/
Samples:  Installed in /home/yangzh/, but missing recommended libraries

# 配置环境变量

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

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

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.2/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 440.00 is required for CUDA 10.2 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

# 安装补丁

sudo sh cuda_10.2.1_linux.run

选择accept

选择Install

选择Upgrade all,完成!

sudo sh cuda_10.2.2_linux.run

同样选择accept

选择Install

选择Upgrade all,完成!

 

安装CUDA11.1.0版本

sudo sh cuda_11.1.0_455.23.05_linux.run

选择accept

除了Driver其他都安装

是否覆盖软连接,选择Yes,后面配置文件可以更改。

安装完成

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

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-11.1/
Samples:  Installed in /home/yangzh/, but missing recommended libraries

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

To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.1/bin
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least .00 is required for CUDA 11.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

 

配置环境变量

 vim ~/.bashrc

# 备注:可以根据需要选择不同版本的CUDA

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

source ~/.bashrc

nvcc -V

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89

 

 

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值