欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Ubuntu16.04配置CUDA9.0和cudnn

程序员文章站 2022-05-27 13:26:28
...
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1

sudo sh cuda_9.0.176_384.81_linux.run
accept no yes yes yes yes
sudo gedit ~/.bashrc   文件的末尾添加环境变量
    export PATH=/home/xin/software/anaconda3/bin:$PATH
    export  PATH=/usr/local/cuda-9.0/bin:$PATH
    export  LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64$LD_LIBRARY_PATH

source ~/.bashrc   生效环境变量

sudo ldconfig

验证:cd /usr/local/cuda-9.0/samples&&sudo apt-get install cmake&&make –j5&&cd ./bin/x86_64/linux/release&&./deviceQuery&&nvcc --version

1 #解压文件  cudnn
tar -zxvf cudnn-9.0-linux-x64-v7.tgz
cd ./cuda
sudo cp ./include/cudnn.h  /usr/local/cuda/include/   可能需要修改cudnn.h的文件和文件夹权限才能复制过去,不行可以直接右键复制过去
cd ./lib64&&sudo cp lib*  /usr/local/cuda/lib64/&&sudo chmod a+r /usr/local/cuda/include/cudnn.h&&sudo chmod a+r /usr/local/cuda/lib64/libcudnn*&&nvcc --version

验证可选的:cp -r /usr/src/cudnn_samples_v7/ $HOME&&cd $HOME/cudnn_samples_v7/mnistCUDNN&&make clean && make&& ./mnistCUDNN

卸载的方式sudo /usr/local/cuda-9.0/bin/uninstall_cuda-9.0.pl