----------------------------------------------------------------------------------------------------------------------------------- ### 安装GPU驱动 1、安装必要程序 apt-get install gcc g++ make 2、执行命令,安装驱动 ./NVIDIA-Linux-x86_64-384.183.run 3、设置systemd systemctl set-default multi-user.target 4、执行命令reboot重启虚拟机 5、执行nvidia-smi,验证驱动 ### 安装Cuda 1、执行以下命令修改权限。 chmod +x cuda_9.0.176_384.81_linux.run 2、安装依赖包 apt install -y freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev 解决问题: Missing recommended library: libGLU.so ln -s /usr/lib/libGL.so.1 /usr/lib/libGL.so 解决问题: Missing recommended library: libGL.so 3、执行以下命令安装CUDA。 ./cuda_9.0.176_384.81_linux.run -toolkit -samples -silent -override --tmpdir=/tmp/ 4、执行以下三条命令验证安装。 cd /usr/local/cuda/samples/1_Utilities/deviceQueryDrv/ make ./deviceQueryDrv 5、设置环境变量(/etc/profile) export CUDA_HOME=/usr/local/cuda-9.0 export PATH=${CUDA_HOME}/bin:$PATH export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${CUDA_HOME}/extras/CUPTI/lib64:$LD_LIBRARY_PATH 然后加载环境变量: source /etc/profile ### 安装CUDNN # cuda-9.0 tar xf cudnn-9.0-linux-x64-v7.6.5.32.tgz cp -r cuda/include/cudnn.h /usr/local/cuda-9.0/include/ cp -r cuda/lib64/lib* /usr/local/cuda-9.0/lib64/ cd /usr/local/cuda-9.0/lib64 rm -f libcudnn.so libcudnn.so.7 ln -s libcudnn.so.7.6.5 libcudnn.so.7 ln -s libcudnn.so.7 libcudnn.so # cuda-10.0 tar xf cudnn-10.0-linux-x64-v7.6.5.32.tgz cp -r cuda/include/cudnn.h /usr/local/cuda-10.0/include/ cp -r cuda/lib64/lib* /usr/local/cuda-10.0/lib64/ cd /usr/local/cuda-10.0/lib64 rm -f libcudnn.so libcudnn.so.7 ln -s libcudnn.so.7.6.5 libcudnn.so.7 ln -s libcudnn.so.7 libcudnn.so ----------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------- ## Cuda-10.1 1. Download wget http://59.36.11.51/driver/cuda/cuda-10.1/cuda_10.1.105_418.39_linux.run wget http://59.36.11.51/driver/cuda/cuda-10.1/cudnn-10.1-linux-x64-v7.6.5.32.tgz 2. Install cuda bash cuda_10.1.105_418.39_linux.run accept x CUDA Installer x x - [X] Driver x x [X] 418.39 x x + [X] CUDA Toolkit 10.1 x x [ ] CUDA Samples 10.1 x x [ ] CUDA Demo Suite 10.1 x x [ ] CUDA Documentation 10.1 x x Install x x Options 3. Install cudnn tar xf cudnn-10.1-linux-x64-v7.6.5.32.tgz cp -r cuda/include/cudnn.h /usr/local/cuda-10.1/include/ cp -r cuda/lib64/lib* /usr/local/cuda-10.1/lib64/ ls -l /usr/local/cuda-10.1/lib64/libcudnn* ----------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------- # Cuda-9.2 1. Download wget http://59.36.11.51/driver/cuda/cuda-9.2/cuda_9.2.148_396.37_linux.run wget http://59.36.11.51/driver/cuda/cuda-9.2/cuda_9.2.148.1_linux.run wget http://59.36.11.51/driver/cuda/cuda-9.2/cudnn-9.2-linux-x64-v7.6.5.32.tgz 2. Install cuda bash cuda_9.2.148_396.37_linux.run Do you accept the previously read EULA? accept/decline/quit: accept Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 396.37? (y)es/(n)o/(q)uit: no Install the CUDA 9.2 Toolkit? (y)es/(n)o/(q)uit: yes Enter Toolkit Location [ default is /usr/local/cuda-9.2 ]: Do you want to install a symbolic link at /usr/local/cuda? (y)es/(n)o/(q)uit: yes Install the CUDA 9.2 Samples? (y)es/(n)o/(q)uit: no 3. Install cuda-patch bash cuda_9.2.148.1_linux.run Do you accept the previously read EULA? accept/decline/quit: accept Enter CUDA Toolkit installation directory [ default is /usr/local/cuda-9.2 ]: 4. Install cudnn tar xf cudnn-9.2-linux-x64-v7.6.5.32.tgz cp -r cuda/include/cudnn.h /usr/local/cuda-9.2/include/ cp -r cuda/lib64/lib* /usr/local/cuda-9.2/lib64/ ls -l /usr/local/cuda-9.2/lib64/libcudnn* -----------------------------------------------------------------------------------------------------------------------------------