当前位置:   article > 正文

cuda版本查看、卸载、安装(linux下)_卸载电脑的cudalinux

卸载电脑的cudalinux

cuda版本查看,cudnn版本查看

法1:

nvcc -V或nvcc --version

法2:

在安装目录下查看cuda版本:cat /usr/local/cuda/version.txt
在安装目录下查看cudnn版本:cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

cuda卸载

1,先查看cuda版本2,卸载cuda时,如果是用运行文件安装的,可以用如下命令卸载:sudo /usr/local/cuda-8.0/bin/uninstall_cuda_8.0.pl然后将剩余的cudnn文件也删除sudo rm -rf /usr/local/cuda-8.0这样就完全删除了cuda8.0 3,某些情况下cuda / bin文件夹中是不包含uninstall_cuda_8.0.pl的,这时可以用另一种方法卸载:sudo apt-get remove cuda sudo apt autoremove sudo apt-get remove cuda *然后cd / usr / local / pathudo rm -rf cuda-8.0这样就完全删除了cuda8.0

cuda安装

[cuda下载地址](https://developer.nvidia.com/cuda-downloads)1,在下载的目录下打开终端(终端的说明,按间隔速度较快)sudo sh cuda名字

第一次安装此处用yes(您确定想要用这个新版本的cuda),第二次用no您​​想要的在/ usr / local / cuda安装符号链接吗?(y)es /( n)o /(退出:

#..一堆协议说明...
#直接按q退出协议说明.
zerozone@zerozone: accept/decline/quit: accept  #接受协议
 
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 375.26? 
y)es/(n)o/(q)uit: n  #是否显卡驱动包,由于已经安装显卡驱动,选择n
 
Install the CUDA 8.0 Toolkit?
(y)es/(n)o/(q)uit: y #是否安装工具包,选择y
 
Enter Toolkit Location
[ default is /usr/local/cuda-8.0 ]: #工具包安装地址,默认回车即可
 
Do you want to install a symbolic link at /usr/local/cuda? 
(y)es/(n)o/(q)uit: n #添加链接**注意这个链接,如果你之前安装过另一个版本的cuda,除非你确定想 要用这个新版本的cuda,否则这里就建议选no,因为指定该链接后会将cuda指向这个新的版本**
 
Install the CUDA 8.0 Samples?
(y)es/(n)o/(q)uit:   y #安装样例
  
Enter CUDA Samples Location
 [ default is /root ]:  #样例安装地址默认即可
 
# ***安装信息***
Installing the CUDA Toolkit in /usr/local/cuda-8.0 ...
 
Missing recommended library: libXi.so
Missing recommended library: libXmu.so
#注意,这里出现了Missing recommended library错误,
#是因为博主在第一次安装时,没有添加最开始的那条安装相关依赖的指令,
#之后我添加了依赖后,再次安装,就没有Missing错误了
 
Installing the CUDA Samples in /root ...
Copying samples to /root/NVIDIA_CUDA-8.0_Samples now...
Finished copying samples.
 
===========
= Summary =
===========
Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-8.0
Samples:  Installed in /root, but missing recommended libraries
 
Please make sure that
 -   PATH includes /usr/local/cuda-8.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-8.0/lib64, or, add /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf and run ldconfig as root
 
To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-8.0/bin
 
Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-8.0/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 361.00 is required for CUDA 8.0 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 /tmp/cuda_install_6388.log   
# ***安装完成***
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58

2、配置环境变量

vim /etc/profile

在打开的文件末尾加上:

export PATH=/usr/local/cuda-9.0/bin:$PATH

export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64$LD_LIBRARY_PATH

重启机器使生效

3、可以测试下cuda的samples

cd /usr/local/cuda-9.0/samples/1_Utilities/deviceQuery

sudo make

./deviceQuery

会出现cuda的各项信息

4、添加环境变量

vim ~/.bashrc

在打开的文件末尾加上:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64

export PATH=$PATH:/usr/local/cuda-9.0/bin

export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-9.0

然后执行source ~/.bashrc使环境变量生效

5、设置环境变量和动态链接库

vim /etc/profile

在打开的文件末尾加上:

exportPATH=/usr/local/cuda/bin:$PATH

6、创建链接文件
sudo vim /etc/ld.so.conf.d/cuda.conf

在打开的文件中写入:

/usr/local/cuda/lib64

执行sudo ldconfig
安装完cuda之后可以nvcc -V查看版本

cudnn安装

cudnn下载地址
思路:把cudnn解压后的两个文件夹里面的文件分别拷贝到,对应的cuda文件夹中。

sudo cp cuda/lib64/* /usr/local/cuda-10.0/lib64/
sudo cp cuda/include/* /usr/local/cuda-10.0/include/
sudo chmod +x /usr/local/cuda-10.0/lib64/*
sudo chmod +x /usr/local/cuda-10.0/include/*
  • 1
  • 2
  • 3
  • 4
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/972557
推荐阅读
相关标签
  

闽ICP备14008679号