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