Ubuntu 18.04LTS cuda cudnn 安装

# install other import packages
sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev

# CUDA 9 requires gcc 6
sudo apt install gcc-6
sudo apt install g++-6

# downoad one of the "runfile (local)" installation packages from cuda toolkit archive 
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run

# make the download file executable
chmod +x cuda_9.0.176_384.81_linux-run 
sudo ./cuda_9.0.176_384.81_linux-run --override

# Answer questions following while installation begin
# You are attempting to install on an unsupported configuration. Do you wish to continue? y
# Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81? n
# Install the CUDA 9.0 Toolkit? y

# set up symlinks for gcc/g++
sudo ln -s /usr/bin/gcc-6 /usr/local/cuda/bin/gcc
sudo ln -s /usr/bin/g++-6 /usr/local/cuda/bin/g++

# setup your paths
echo 'export PATH=/usr/local/cuda-9.0/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH' >> ~/.bash.rc
source ~/.bashrc

# install cuDNN v7.1
# in order to download cuDNN you have to regeistered here https://developer.nvidia.com/developer-program/signup
# then download cuDNN v7.1 form https://developer.nvidia.com/cudnn
CUDNN_TAR_FILE="cudnn-9.0-linux-x64-v7.1"
wget http://developer.download.nvidia.com/compute/redist/cudnn/v7.1/${CUDNN_TAR_FILE}
tar -xzvf ${CUDNN_TAR_FILE}

#copy the following files into the cuda toolkit directory.
sudo cp -P cuda/include/cudnn.h /usr/local/cuda-9.0/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-9.0/lib64/
sudo chmod a+r /usr/local/cuda-9.0/lib64/libcudnn*

检查cuda是否安装成功
1.检查路径 ~/dev 下 有无存在名为 nvidia* (以nvidia开头)的多个文件(device files)
若无,安装错误,见解决篇。
2.检查 CUDA Toolkit是否安装成功
终端输入 :

nvcc -V

会输出CUDA的版本信息(V要大写)
3.编译samples例子
进入到Samples安装目录,然后在该目录下终端输入make,等待十来分钟。
4.编译完成后测试
可以在Samples里面找到bin/x86_64/linux/release/目录,并切换到该目录
运行deviceQuery程序,sudo ./deviceQuery
查看输出结果,重点关注最后一行,Pass表示通过测试
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值