标签:环境 nbsp run 命令 权限 persist etc mod bsp
在 Linux 主机上配置了很多次 Cuda/CuDNN 的运行环境,在此记录下用到的脚本命令以复用。
特别提醒,先了解清楚 GPU 卡的型号,查清与主机 Linux 内核兼容的驱动程序、Cuda 和 CuDNN 的发行版。
请以 root 权限执行本文的所有 bash 命令。
1. NVIDIA 驱动安装
# WIKI: https://download.nvidia.com/XFree86/Linux-x86_64/375.20/README/installdriver.html wget http://us.download.nvidia.com/tesla/384.145/NVIDIA-Linux-x86_64-384.145.run && chmod u+x NVIDIA-Linux-x86_64-384.145.run && ./NVIDIA-Linux-x86_64-384.145.run --silent --dkms --accept-license
2. 打开持久模式
nvidia-smi -pm ENABLED # WIKI https://docs.nvidia.com/deploy/driver-persistence/index.html # +-----------------------------------------------------------------------------+ # | NVIDIA-SMI 384.145 Driver Version: 384.145 | # |-------------------------------+----------------------+----------------------+ # | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | # | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | # |===============================+======================+======================| # | 0 Tesla V100-PCIE... Off | 00000000:1A:00.0 Off | 0 | # | N/A 34C P0 37W / 250W | 0MiB / 16152MiB | 0% Default | # +-------------------------------+----------------------+----------------------+ # | 1 Tesla V100-PCIE... Off | 00000000:1F:00.0 Off | 0 | # | N/A 36C P0 36W / 250W | 0MiB / 16152MiB | 0% Default | # +-------------------------------+----------------------+----------------------+
3. CUDA Toolkit 安装
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run && chmod u+x cuda_9.0.176_384.81_linux-run && ./cuda_9.0.176_384.81_linux-run --toolkit --silent --verbos cat << EOF >> /etc/ld.so.conf.d/cuda.conf /usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64 EOF ldconfig cat << EOF >> /etc/profile.d/cuda.sh export PATH=/usr/local/cuda/bin:\$PATH EOF source /etc/profile
4. CuDNN 安装
# CuDNN 下载需要 Nvidia 账号。直接访问以下 URL,会被重定向到登录页面。 # https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.0.5/prod/9.0_20171129/Ubuntu16_04-x64/libcudnn7_7.0.5.15-1+cuda9.0_amd64 dpkg -i libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb # 安装到 /usr/lib/x86_64-linux-gnu
标签:环境 nbsp run 命令 权限 persist etc mod bsp
原文地址:https://www.cnblogs.com/shishaochen/p/9735424.html