cuda云服务器,Ubuntu18.04 云服务器安装NVIDIA-DRIVER,CUDA,CUDnn

本文详细指导了在Ubuntu 16.04和18.04系统上安装NVIDIA驱动和cuDNN库的步骤,包括安装前的准备、添加CUDA repository、安装关键组件、安装CUDA驱动以及cuDNN文件的下载、解压和配置。适合深度学习开发者进行GPU环境设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

nvidia-driver

This section includes instructions for installing the NVIDIA driver on Ubuntu 16.04 LTS and Ubuntu 18.04 LTS distributions using the package manager. The NVIDIA driver requires that the kernel headers and development packages for the running version of the kernel be installed at the time of the driver installation, as well whenever the driver is rebuilt. For example, if your system is running kernel version 4.4.0, the 4.4.0 kernel headers and development packages must also be installed. The kernel headers and development packages for the currently running kernel can be installed with:

$ sudo apt-get install linux-headers-$(uname -r)

Ensure packages on the CUDA network repository have priority over the Canonical repository.

$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g')

$ wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/cuda-$distribution.pin

$ sudo mv cuda-$distribution.pin /etc/apt/preferences.d/cuda-repository-pin-600

Install the CUDA repository public GPG key. Note that on Ubuntu 16.04, replace https with http in the command below.

$ sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/7fa2af80.pub

Setup the CUDA network repository.

$ echo "deb http://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64 /" | sudo tee /etc/apt/sources.list.d/cuda.list

Update the APT repository cache and install the driver using the cuda-drivers meta-package. Use the --no-install-recommends option for a lean driver install without any dependencies on X packages. This is particularly useful for headless installations on cloud instances.

$ sudo apt-get update

$ sudo apt-get -y install cuda-drivers

CUDA

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin

sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600

wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb

sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb

sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub

sudo apt-get update

sudo apt-get -y install cuda

CUDnn

文件下载及解压 进入官网下载压缩包文件: cuDNN Library for Linux

46c5b51e95bb07fbd35b7c314387c88a.png

终端解压

sudo tar -xzvf cudnn-10.2-linux-x64-v7.6.5.32.tgz

下载好后的tgz文件和解压后的目录:

cd cuda

文件复制 终端输入以下命令将文件复制到CUDA中

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 /usr/local/cuda/lib64/libcudnn*

复制后即完成cuDNN安装.

验证安装 终端输入:cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2 ,如下显示即安装成功。

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

注意:本文归作者所有,未经作者允许,不得转载

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值