【Linux】Linux安装navida驱动和cuda开发包
查看硬件版本
lspci | grep -i nvidia
NVIDIA Corporation GP100GL [Tesla P100 PCIe 16GB] (rev a1)
根据版本下载对应驱动
https://www.nvidia.cn/Download/index.aspx?lang=cn
http://cn.download.nvidia.com/tesla/410.104/NVIDIA-Linux-x86_64-410.104.run
本例为选择了cuda_toolkit_9.0;
驱动版本文件:NVIDIA-Linux-x86_64-384.183.run
安装驱动
chmod +x ./NVIDIA-Linux-x86_64-384.183.run
./NVIDIA-Linux-x86_64-384.183.run
Q:如果提示”The Nouveau kernel driver is currently in use by your system…………”
需要禁用第三方驱动
- apt purge nvidia*
- vim /etc/modprobe.d/blacklist-nouveau.conf—>
blacklist nouveau options nouveau modeset=0
- update-initramfs -u
- reboot
-
检查是否禁用lsmod grep nouveau
Q:Verifying archive integrity… Error in check sums 1237657955 1463329162
文件校验错误,需要重新下载
查看驱动信息
nvidia-smi
下载并安装CUDA_toolkit
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run
./cuda_9.0.176_384.81_linux-run
Q:unsupported compiler: 7.3.0
g++、gcc的版本问题
降低 g++、gcc的版本.
gcc --version;
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
g++ --version;
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
apt install gcc-6 g++-6;
ln -s /usr/bin/gcc-6 /usr/local/bin/gcc
ln -s /usr/bin/g++-6 /usr/local/bin/g++
再执行
./cuda_9.0.176_384.81_linux-run
环境变量配置
添加可执行文件路径
vim ~/.bashrc
export PATH=/usr/local/cuda-9.0/bin:$PATH
source ~/.bashrc
添加动态库鲁健
vim /etc/ld.so.conf
添加
/usr/local/cuda-9.0/lib64
ldconfig
下载ffmpeg并在编译
git clone https://git.ffmpeg.org/ffmpeg.git
git checkout n(tag)3.4.5
./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
make -j 10
Q:nasm/yasm not found or too old
apt-get install yasm
Q:ERROR: cuda requested, but not all dependencies are satisfied: ffnvcodec
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
cd nv-codec-headers
make
sudo make install
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
如何还有问题:检查pkgconf是否安装;apt-get install pkgconf
Q:The minimum required Nvidia driver for nvenc is 390.25 or newer
ffmpeg版本过高,或者驱动版本过低,适当调整
测试:
https://developer.nvidia.com/ffmpeg
Transcode a single video file
FFMPEG: ffmpeg -hwaccel cuvid -c:v h264_cuvid -i
查看cuda版本
cuda 版本
cat /usr/local/cuda/version.txt
cudnn 版本
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
ubuntu_18_04_64
安装tensorflow
-
检查python开发环境 python3 –version pip3 –version virtualenv –version
-
安琥在那个cuDNN https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html
virtualenv
virtualenv ENV
source /path/to/ENV/bin/activate
deactivate
Til next time,
gentlesnow
at 15:15
