安装多版本cuda时,nvcc和cuda版本不一致问题

Ubuntu 16.04,原始cuda版本8.0,安装cuda 10.0后,使用nvcc --version查询,显示cuda仍为8.0

ubuntu@zhangli:/usr/local$ nvcc --version 
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61

 

但使用cat查询,显示为10.0

ubuntu@zhangli:/usr/local$ cat /usr/local/cuda/version.txt 
CUDA Version 10.0.130

 

使用stat cuda查询,同样显示软链接已链到10.0

ubuntu@zhangli:/usr/local$ stat cuda
File: 'cuda' -> '/usr/local/cuda-10.0'
Size: 20 Blocks: 0 IO Block: 4096 symbolic link
Device: 811h/2065d    Inode: 2902997 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2019-04-30 15:23:34.587721331 +0800
Modify: 2019-04-30 15:22:00.913838239 +0800
Change: 2019-04-30 15:22:00.913838239 +0800
Birth: -

 

解决方法:将bashrc文件中的cuda的8.0改为10.0,再source一下,就ok了

ubuntu@zhangli:/usr/local$ sudo gedit ~/.bashrc

# 改为10.0
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

ubuntu@zhangli:/usr/local$ source ~/.bashrc

 

posted @ 2020-04-01 14:35  老三的博客  阅读(9036)  评论(0编辑  收藏  举报