https://developer.nvidia.com/cuda-toolkit-archive

下载好cuda

./cuda_10.0.130_410.48_linux.run

https://developer.nvidia.com/rdp/cudnn-download

执行如下命令

nvcc --version

如果看到如下界面则表示安装成功

unbutu下cuda和cudnn的安装_hive

下载好cudnn

sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

最后执行如下命令

 cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

如果看到如下界面则表示安装成功

unbutu下cuda和cudnn的安装_linux_02