当前位置:   article > 正文

GPU服务器安装显卡驱动、CUDA和cuDNN_existing package manager installation of the drive

existing package manager installation of the driver found. it is strongly │

1. 服务器驱动安装

root@hk-MZ32-AR0-00:~#  nvidia-smi 
Fri Feb 10 17:27:58 2023       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.106.00   Driver Version: 460.106.00   CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla T4            Off  | 00000000:04:00.0 Off |                    0 |
| N/A   46C    P0    27W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   1  Tesla T4            Off  | 00000000:06:00.0 Off |                    0 |
| N/A   43C    P0    28W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   2  Tesla T4            Off  | 00000000:0D:00.0 Off |                    0 |
| N/A   48C    P0    28W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   3  Tesla T4            Off  | 00000000:0F:00.0 Off |                    0 |
| N/A   45C    P0    26W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   4  Tesla T4            Off  | 00000000:17:00.0 Off |                    0 |
| N/A   48C    P0    27W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   5  Tesla T4            Off  | 00000000:19:00.0 Off |                    0 |
| N/A   48C    P0    28W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   6  Tesla T4            Off  | 00000000:21:00.0 Off |                    0 |
| N/A   45C    P0    26W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   7  Tesla T4            Off  | 00000000:23:00.0 Off |                    0 |
| N/A   45C    P0    27W /  70W |      0MiB / 15109MiB |      4%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49

2. cuda安装

  • CUDA安装的时候需要注意显卡的驱动版本
  • 参考文档 :接入附上一份

在这里插入图片描述

root@hk-MZ32-AR0-00:~#  wget http://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux.run  
--2023-01-29 19:55:42--  http://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux.run
Resolving developer.download.nvidia.com (developer.download.nvidia.com)... 152.199.39.144
Connecting to developer.download.nvidia.com (developer.download.nvidia.com)|152.199.39.144|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux.run [following]
--2023-01-29 19:55:43--  https://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux.run
Connecting to developer.download.nvidia.com (developer.download.nvidia.com)|152.199.39.144|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://developer.download.nvidia.cn/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux.run [following]
--2023-01-29 19:55:44--  https://developer.download.nvidia.cn/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux.run
Resolving developer.download.nvidia.cn (developer.download.nvidia.cn)... 125.64.2.195, 125.64.2.196, 150.138.231.66, ...
Connecting to developer.download.nvidia.cn (developer.download.nvidia.cn)|125.64.2.195|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3066694836 (2.9G) [application/octet-stream]
Saving to: ‘cuda_11.0.2_450.51.05_linux.run’

100%[=====================================================================================================================================>] 3,066,694,836 11.3MB/s   in 4m 25s 

2023-01-29 20:00:15 (11.0 MB/s) - ‘cuda_11.0.2_450.51.05_linux.run’ saved [3066694836/3066694836]

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
root@hk-MZ32-AR0-00:~# ./cuda_11.0.2_450.51.05_linux.run 

┌──────────────────────────────────────────────────────────────────────────────┐
│ Existing package manager installation of the driver found. It is strongly    │
│ recommended that you remove this before continuing.                          │
│ Abort                                                                        │
│ Continue                                                                     │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│ Up/Down: Move | 'Enter': Select                                              │
└──────────────────────────────────────────────────────────────────────────────┘
# 上下键选择 Continue,按enter,会出现如下画面

┌──────────────────────────────────────────────────────────────────────────────┐
│  End User License Agreement                                                  │
│  --------------------------                                                  │
│                                                                              │
│  NVIDIA Software License Agreement and CUDA Supplement to                    │
│  Software License Agreement.                                                 │
│                                                                              │
│                                                                              │
│  Preface                                                                     │
│  -------                                                                     │
│                                                                              │
│  The Software License Agreement in Chapter 1 and the Supplement              │
│  in Chapter 2 contain license terms and conditions that govern               │
│  the use of NVIDIA software. By accepting this agreement, you                │
│  agree to comply with all the terms and conditions applicable                │
│  to the product(s) included herein.                                          │
│                                                                              │
│                                                                              │
│  NVIDIA Driver                                                               │
│                                                                              │
│                                                                              │
│──────────────────────────────────────────────────────────────────────────────│
│ Do you accept the above EULA? (accept/decline/quit):                         │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

#输入 accept,按enter,回出现如下
┌──────────────────────────────────────────────────────────────────────────────┐
│ CUDA Installer                                                               │
│ - [X] Driver                                                                 │
│      [X] 450.51.05                                                           │
│ + [X] CUDA Toolkit 11.0                                                      │
│   [X] CUDA Samples 11.0                                                      │
│   [X] CUDA Demo Suite 11.0                                                   │
│   [X] CUDA Documentation 11.0                                                │
│   Options                                                                    │
│   Install                                                                    │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│ Up/Down: Move | Left/Right: Expand | 'Enter': Select | 'A': Advanced options │
└──────────────────────────────────────────────────────────────────────────────┘


# 按上下键到 Driver,按空格,取消安装驱动,驱动我们前面已经安装过了。上下键到install,按enter,会出现安装过程
 
===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-11.0/
Samples:  Installed in /home/hk/, but missing recommended libraries

Please make sure that
 -   PATH includes /usr/local/cuda-11.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-11.0/lib64, or, add /usr/local/cuda-11.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-11.0/doc/pdf for detailed information on setting up CUDA.
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least .00 is required for CUDA 11.0 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run --silent --driver

Logfile is /var/log/cuda-installer.log

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106

把cuda的命令添加到系统环境变量

root@hk-MZ32-AR0-00:~# export  PATH=$PATH:/usr/local/cuda/bin/  >> /etc/profile
root@hk-MZ32-AR0-00:~# source /etc/profile

# 执行nvcc命令即可显示cuda的信息
root@hk-MZ32-AR0-00:~# nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Thu_Jun_11_22:26:38_PDT_2020
Cuda compilation tools, release 11.0, V11.0.194
Build cuda_11.0_bu.TC445_37.28540450_0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

3. cudNN安装

在这里插入图片描述

root@hk-MZ32-AR0-00:~#   rz
 ZMODEM  Session started            e50
------------------------            
 Sent  cudnn-linux-x86_64-8.7.0.84_cuda11-archive.tar.xz               
root@hk-MZ32-AR0-00:~#  tar  -xvf cudnn-linux-x86_64-8.7.0.84_cuda11-archive.tar.xz 
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_adv_infer_static.a
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_adv_infer_static_v8.a
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_adv_train_static.a
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_adv_train_static_v8.a
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_cnn_infer_static.a
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_cnn_infer_static_v8.a
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_cnn_train_static.a
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_cnn_train_static_v8.a
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_ops_infer_static.a
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_ops_infer_static_v8.a
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_ops_train_static.a
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_ops_train_static_v8.a
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn.so.8
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn.so
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn.so.8.7.0
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_adv_infer.so.8
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_adv_infer.so
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_adv_infer.so.8.7.0
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_adv_train.so.8
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_adv_train.so
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_adv_train.so.8.7.0
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_cnn_infer.so
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_cnn_infer.so.8
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_cnn_infer.so.8.7.0
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_cnn_train.so
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_cnn_train.so.8.7.0
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_cnn_train.so.8
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_ops_infer.so.8.7.0
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_ops_infer.so
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_ops_infer.so.8
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_ops_train.so.8.7.0
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_ops_train.so
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/libcudnn_ops_train.so.8
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_v8.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_adv_infer_v8.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_adv_train_v8.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_backend_v8.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_cnn_infer_v8.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_cnn_train_v8.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_ops_infer_v8.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_ops_train_v8.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_version_v8.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_adv_infer.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_adv_train.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_backend.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_cnn_infer.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_cnn_train.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_ops_infer.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_ops_train.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/cudnn_version.h
cudnn-linux-x86_64-8.7.0.84_cuda11-archive/LICENSE
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60

root@hk-MZ32-AR0-00:~# ll cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/
总用量 2520176
drwxr-xr-x 2 25503 2174      4096 1122 04:14 ./
drwxr-xr-x 4 25503 2174      4096 1122 04:14 ../
lrwxrwxrwx 1 25503 2174        23 1122 03:58 libcudnn_adv_infer.so -> libcudnn_adv_infer.so.8*
lrwxrwxrwx 1 25503 2174        27 1122 03:58 libcudnn_adv_infer.so.8 -> libcudnn_adv_infer.so.8.7.0*
-rwxr-xr-x 1 25503 2174 130381904 1122 03:58 libcudnn_adv_infer.so.8.7.0*
-rw-r--r-- 1 25503 2174 132979922 1122 03:58 libcudnn_adv_infer_static.a
lrwxrwxrwx 1 25503 2174        27 1122 03:58 libcudnn_adv_infer_static_v8.a -> libcudnn_adv_infer_static.a
lrwxrwxrwx 1 25503 2174        23 1122 03:58 libcudnn_adv_train.so -> libcudnn_adv_train.so.8*
lrwxrwxrwx 1 25503 2174        27 1122 03:58 libcudnn_adv_train.so.8 -> libcudnn_adv_train.so.8.7.0*
-rwxr-xr-x 1 25503 2174 121095120 1122 03:58 libcudnn_adv_train.so.8.7.0*
-rw-r--r-- 1 25503 2174 123566296 1122 03:58 libcudnn_adv_train_static.a
lrwxrwxrwx 1 25503 2174        27 1122 03:58 libcudnn_adv_train_static_v8.a -> libcudnn_adv_train_static.a
lrwxrwxrwx 1 25503 2174        23 1122 03:58 libcudnn_cnn_infer.so -> libcudnn_cnn_infer.so.8*
lrwxrwxrwx 1 25503 2174        27 1122 03:58 libcudnn_cnn_infer.so.8 -> libcudnn_cnn_infer.so.8.7.0*
-rwxr-xr-x 1 25503 2174 639185544 1122 03:58 libcudnn_cnn_infer.so.8.7.0*
-rw-r--r-- 1 25503 2174 829548950 1122 03:58 libcudnn_cnn_infer_static.a
lrwxrwxrwx 1 25503 2174        27 1122 03:58 libcudnn_cnn_infer_static_v8.a -> libcudnn_cnn_infer_static.a
lrwxrwxrwx 1 25503 2174        23 1122 03:58 libcudnn_cnn_train.so -> libcudnn_cnn_train.so.8*
lrwxrwxrwx 1 25503 2174        27 1122 03:58 libcudnn_cnn_train.so.8 -> libcudnn_cnn_train.so.8.7.0*
-rwxr-xr-x 1 25503 2174 102197000 1122 03:58 libcudnn_cnn_train.so.8.7.0*
-rw-r--r-- 1 25503 2174 153525776 1122 03:58 libcudnn_cnn_train_static.a
lrwxrwxrwx 1 25503 2174        27 1122 03:58 libcudnn_cnn_train_static_v8.a -> libcudnn_cnn_train_static.a
lrwxrwxrwx 1 25503 2174        23 1122 03:58 libcudnn_ops_infer.so -> libcudnn_ops_infer.so.8*
lrwxrwxrwx 1 25503 2174        27 1122 03:58 libcudnn_ops_infer.so.8 -> libcudnn_ops_infer.so.8.7.0*
-rwxr-xr-x 1 25503 2174  97489336 1122 03:58 libcudnn_ops_infer.so.8.7.0*
-rw-r--r-- 1 25503 2174 100636906 1122 03:58 libcudnn_ops_infer_static.a
lrwxrwxrwx 1 25503 2174        27 1122 03:58 libcudnn_ops_infer_static_v8.a -> libcudnn_ops_infer_static.a
lrwxrwxrwx 1 25503 2174        23 1122 03:58 libcudnn_ops_train.so -> libcudnn_ops_train.so.8*
lrwxrwxrwx 1 25503 2174        27 1122 03:58 libcudnn_ops_train.so.8 -> libcudnn_ops_train.so.8.7.0*
-rwxr-xr-x 1 25503 2174  74703096 1122 03:58 libcudnn_ops_train.so.8.7.0*
-rw-r--r-- 1 25503 2174  75156862 1122 03:58 libcudnn_ops_train_static.a
lrwxrwxrwx 1 25503 2174        27 1122 03:58 libcudnn_ops_train_static_v8.a -> libcudnn_ops_train_static.a
lrwxrwxrwx 1 25503 2174        13 1122 03:58 libcudnn.so -> libcudnn.so.8*
lrwxrwxrwx 1 25503 2174        17 1122 03:58 libcudnn.so.8 -> libcudnn.so.8.7.0*
-rwxr-xr-x 1 25503 2174    150200 1122 03:58 libcudnn.so.8.7.0*



root@hk-MZ32-AR0-00:~# ll cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/
总用量 448
drwxr-xr-x 2 25503 2174  4096 1122 04:14 ./
drwxr-xr-x 4 25503 2174  4096 1122 04:14 ../
-rw-r--r-- 1 25503 2174 29025 1122 03:58 cudnn_adv_infer.h
-rw-r--r-- 1 25503 2174 29025 1122 03:58 cudnn_adv_infer_v8.h
-rw-r--r-- 1 25503 2174 27700 1122 03:58 cudnn_adv_train.h
-rw-r--r-- 1 25503 2174 27700 1122 03:58 cudnn_adv_train_v8.h
-rw-r--r-- 1 25503 2174 24727 1122 03:58 cudnn_backend.h
-rw-r--r-- 1 25503 2174 24727 1122 03:58 cudnn_backend_v8.h
-rw-r--r-- 1 25503 2174 29083 1122 03:58 cudnn_cnn_infer.h
-rw-r--r-- 1 25503 2174 29083 1122 03:58 cudnn_cnn_infer_v8.h
-rw-r--r-- 1 25503 2174 10217 1122 03:58 cudnn_cnn_train.h
-rw-r--r-- 1 25503 2174 10217 1122 03:58 cudnn_cnn_train_v8.h
-rw-r--r-- 1 25503 2174  2968 1122 03:58 cudnn.h
-rw-r--r-- 1 25503 2174 49631 1122 03:58 cudnn_ops_infer.h
-rw-r--r-- 1 25503 2174 49631 1122 03:58 cudnn_ops_infer_v8.h
-rw-r--r-- 1 25503 2174 25733 1122 03:58 cudnn_ops_train.h
-rw-r--r-- 1 25503 2174 25733 1122 03:58 cudnn_ops_train_v8.h
-rw-r--r-- 1 25503 2174  2968 1122 03:58 cudnn_v8.h
-rw-r--r-- 1 25503 2174  3113 1122 03:58 cudnn_version.h
-rw-r--r-- 1 25503 2174  3113 1122 03:58 cudnn_version_v8.h
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
root@hk-MZ32-AR0-00:~# cp  -P  cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/*   /usr/local/cuda/lib64/

root@hk-MZ32-AR0-00:~# cp  -P  cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/*  /usr/local/cuda/include/
  • 1
  • 2
  • 3
root@hk-MZ32-AR0-00:~# ll /usr/local/cuda/lib64/libcudnn* 
lrwxrwxrwx 1 root root        23 210 17:39 /usr/local/cuda/lib64/libcudnn_adv_infer.so -> libcudnn_adv_infer.so.8*
lrwxrwxrwx 1 root root        27 210 17:39 /usr/local/cuda/lib64/libcudnn_adv_infer.so.8 -> libcudnn_adv_infer.so.8.7.0*
-rwxr-xr-x 1 root root 130381904 210 17:39 /usr/local/cuda/lib64/libcudnn_adv_infer.so.8.7.0*
-rw-r--r-- 1 root root 132979922 210 17:39 /usr/local/cuda/lib64/libcudnn_adv_infer_static.a
lrwxrwxrwx 1 root root        27 210 17:39 /usr/local/cuda/lib64/libcudnn_adv_infer_static_v8.a -> libcudnn_adv_infer_static.a
lrwxrwxrwx 1 root root        23 210 17:39 /usr/local/cuda/lib64/libcudnn_adv_train.so -> libcudnn_adv_train.so.8*
lrwxrwxrwx 1 root root        27 210 17:39 /usr/local/cuda/lib64/libcudnn_adv_train.so.8 -> libcudnn_adv_train.so.8.7.0*
-rwxr-xr-x 1 root root 121095120 210 17:39 /usr/local/cuda/lib64/libcudnn_adv_train.so.8.7.0*
-rw-r--r-- 1 root root 123566296 210 17:39 /usr/local/cuda/lib64/libcudnn_adv_train_static.a
lrwxrwxrwx 1 root root        27 210 17:39 /usr/local/cuda/lib64/libcudnn_adv_train_static_v8.a -> libcudnn_adv_train_static.a
lrwxrwxrwx 1 root root        23 210 17:39 /usr/local/cuda/lib64/libcudnn_cnn_infer.so -> libcudnn_cnn_infer.so.8*
lrwxrwxrwx 1 root root        27 210 17:39 /usr/local/cuda/lib64/libcudnn_cnn_infer.so.8 -> libcudnn_cnn_infer.so.8.7.0*
-rwxr-xr-x 1 root root 639185544 210 17:39 /usr/local/cuda/lib64/libcudnn_cnn_infer.so.8.7.0*
-rw-r--r-- 1 root root 829548950 210 17:39 /usr/local/cuda/lib64/libcudnn_cnn_infer_static.a
lrwxrwxrwx 1 root root        27 210 17:39 /usr/local/cuda/lib64/libcudnn_cnn_infer_static_v8.a -> libcudnn_cnn_infer_static.a
lrwxrwxrwx 1 root root        23 210 17:39 /usr/local/cuda/lib64/libcudnn_cnn_train.so -> libcudnn_cnn_train.so.8*
lrwxrwxrwx 1 root root        27 210 17:39 /usr/local/cuda/lib64/libcudnn_cnn_train.so.8 -> libcudnn_cnn_train.so.8.7.0*
-rwxr-xr-x 1 root root 102197000 210 17:39 /usr/local/cuda/lib64/libcudnn_cnn_train.so.8.7.0*
-rw-r--r-- 1 root root 153525776 210 17:39 /usr/local/cuda/lib64/libcudnn_cnn_train_static.a
lrwxrwxrwx 1 root root        27 210 17:39 /usr/local/cuda/lib64/libcudnn_cnn_train_static_v8.a -> libcudnn_cnn_train_static.a
lrwxrwxrwx 1 root root        23 210 17:39 /usr/local/cuda/lib64/libcudnn_ops_infer.so -> libcudnn_ops_infer.so.8*
lrwxrwxrwx 1 root root        27 210 17:39 /usr/local/cuda/lib64/libcudnn_ops_infer.so.8 -> libcudnn_ops_infer.so.8.7.0*
-rwxr-xr-x 1 root root  97489336 210 17:39 /usr/local/cuda/lib64/libcudnn_ops_infer.so.8.7.0*
-rw-r--r-- 1 root root 100636906 210 17:39 /usr/local/cuda/lib64/libcudnn_ops_infer_static.a
lrwxrwxrwx 1 root root        27 210 17:39 /usr/local/cuda/lib64/libcudnn_ops_infer_static_v8.a -> libcudnn_ops_infer_static.a
lrwxrwxrwx 1 root root        23 210 17:39 /usr/local/cuda/lib64/libcudnn_ops_train.so -> libcudnn_ops_train.so.8*
lrwxrwxrwx 1 root root        27 210 17:39 /usr/local/cuda/lib64/libcudnn_ops_train.so.8 -> libcudnn_ops_train.so.8.7.0*
-rwxr-xr-x 1 root root  74703096 210 17:39 /usr/local/cuda/lib64/libcudnn_ops_train.so.8.7.0*
-rw-r--r-- 1 root root  75156862 210 17:39 /usr/local/cuda/lib64/libcudnn_ops_train_static.a
lrwxrwxrwx 1 root root        27 210 17:39 /usr/local/cuda/lib64/libcudnn_ops_train_static_v8.a -> libcudnn_ops_train_static.a
lrwxrwxrwx 1 root root        13 210 17:39 /usr/local/cuda/lib64/libcudnn.so -> libcudnn.so.8*
lrwxrwxrwx 1 root root        17 210 17:39 /usr/local/cuda/lib64/libcudnn.so.8 -> libcudnn.so.8.7.0*
-rwxr-xr-x 1 root root    150200 210 17:39 /usr/local/cuda/lib64/libcudnn.so.8.7.0*
root@hk-MZ32-AR0-00:~# ll /usr/local/cuda/lib64/libcudnn*   | wc -l
33
root@hk-MZ32-AR0-00:~# ll cudnn-linux-x86_64-8.7.0.84_cuda11-archive/
include/ lib/     LICENSE  
root@hk-MZ32-AR0-00:~# ll cudnn-linux-x86_64-8.7.0.84_cuda11-archive/lib/*  |wc -l
33



root@hk-MZ32-AR0-00:~# ll /usr/local/cuda/include/cudn*   
-rw-r--r-- 1 root root 29025 210 17:39 /usr/local/cuda/include/cudnn_adv_infer.h
-rw-r--r-- 1 root root 29025 210 17:39 /usr/local/cuda/include/cudnn_adv_infer_v8.h
-rw-r--r-- 1 root root 27700 210 17:39 /usr/local/cuda/include/cudnn_adv_train.h
-rw-r--r-- 1 root root 27700 210 17:39 /usr/local/cuda/include/cudnn_adv_train_v8.h
-rw-r--r-- 1 root root 24727 210 17:39 /usr/local/cuda/include/cudnn_backend.h
-rw-r--r-- 1 root root 24727 210 17:39 /usr/local/cuda/include/cudnn_backend_v8.h
-rw-r--r-- 1 root root 29083 210 17:39 /usr/local/cuda/include/cudnn_cnn_infer.h
-rw-r--r-- 1 root root 29083 210 17:39 /usr/local/cuda/include/cudnn_cnn_infer_v8.h
-rw-r--r-- 1 root root 10217 210 17:39 /usr/local/cuda/include/cudnn_cnn_train.h
-rw-r--r-- 1 root root 10217 210 17:39 /usr/local/cuda/include/cudnn_cnn_train_v8.h
-rw-r--r-- 1 root root  2968 210 17:39 /usr/local/cuda/include/cudnn.h
-rw-r--r-- 1 root root 49631 210 17:39 /usr/local/cuda/include/cudnn_ops_infer.h
-rw-r--r-- 1 root root 49631 210 17:39 /usr/local/cuda/include/cudnn_ops_infer_v8.h
-rw-r--r-- 1 root root 25733 210 17:39 /usr/local/cuda/include/cudnn_ops_train.h
-rw-r--r-- 1 root root 25733 210 17:39 /usr/local/cuda/include/cudnn_ops_train_v8.h
-rw-r--r-- 1 root root  2968 210 17:39 /usr/local/cuda/include/cudnn_v8.h
-rw-r--r-- 1 root root  3113 210 17:39 /usr/local/cuda/include/cudnn_version.h
-rw-r--r-- 1 root root  3113 210 17:39 /usr/local/cuda/include/cudnn_version_v8.h
root@hk-MZ32-AR0-00:~# ll /usr/local/cuda/include/cudn*    |wc  -l
18
root@hk-MZ32-AR0-00:~# ll cudnn-linux-x86_64-8.7.0.84_cuda11-archive/include/* | wc -l 
18
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66

4. 安装docker环境

root@hk-MZ32-AR0-00:~# curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

root@hk-MZ32-AR0-00:~# add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

root@hk-MZ32-AR0-00:~# apt-get -y install docker-ce
  • 1
  • 2
  • 3
  • 4
  • 5

5. 安装nvidia-docker2

5.1 ubuntu系统安装

root@hk-MZ32-AR0-00:~# curl -s -L https://nvidia.github.io/nvidia-docker/$(. /etc/os-release;echo $ID$VERSION_ID)/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
deb https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/$(ARCH) /
#deb https://nvidia.github.io/libnvidia-container/experimental/ubuntu18.04/$(ARCH) /
deb https://nvidia.github.io/nvidia-container-runtime/stable/ubuntu18.04/$(ARCH) /
#deb https://nvidia.github.io/nvidia-container-runtime/experimental/ubuntu18.04/$(ARCH) /
deb https://nvidia.github.io/nvidia-docker/ubuntu18.04/$(ARCH) /

root@hk-MZ32-AR0-00:~# sed -i 's/18.04/22.04/g'  /etc/apt/sources.list.d/nvidia-docker.list
root@hk-MZ32-AR0-00:~# apt-get update
命中:1 http://mirrors.aliyun.com/ubuntu bionic InRelease
命中:2 https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal InRelease                                                                                                        
获取:3 http://mirrors.aliyun.com/ubuntu bionic-security InRelease [88.7 kB]                                                                                                     
命中:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic InRelease                                                                                                             
获取:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates InRelease [88.7 kB]                                                                                           
获取:6 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease [88.7 kB]                                                                                                      
获取:7 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports InRelease [83.3 kB]                                                                                         
获取:8 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64  InRelease [1,484 B]                                                                             
命中:9 https://packages.microsoft.com/ubuntu/18.04/prod bionic InRelease                                                                             
获取:10 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security InRelease [88.7 kB]                                                              
获取:11 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease [242 kB]                                                                   
获取:12 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-proposed InRelease [242 kB]                                         
命中:13 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu focal InRelease                                                                
命中:14 https://linux.teamviewer.com/deb stable InRelease                                                                                   
获取:15 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main i386 Packages [1,604 kB]
获取:16 http://mirrors.aliyun.com/ubuntu bionic-backports InRelease [83.3 kB]             
获取:17 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main amd64 Packages [2,909 kB]
获取:18 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [76.8 kB]           
获取:19 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main amd64 DEP-11 Metadata [297 kB]                     
获取:20 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [302 kB]                
获取:21 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,468 B]                    
获取:22 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports/main amd64 DEP-11 Metadata [8,108 B]     
获取:23 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [10.0 kB]                       
获取:24 https://nvidia.github.io/libnvidia-container/stable/ubuntu22.04/amd64  InRelease [1,484 B]                                  
获取:25 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [61.0 kB]
获取:26 http://mirrors.aliyun.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]
获取:27 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 Packages [2,909 kB] 
获取:28 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/main amd64 DEP-11 Metadata [76.8 kB]
获取:29 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/universe amd64 DEP-11 Metadata [61.1 kB]               
获取:30 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]            
获取:31 https://nvidia.github.io/nvidia-container-runtime/stable/ubuntu22.04/amd64  InRelease [1,481 B]                     
获取:32 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-proposed/main Sources [81.3 kB]                   
获取:33 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-proposed/main Translation-en [38.8 kB]
获取:34 https://nvidia.github.io/nvidia-docker/ubuntu22.04/amd64  InRelease [1,474 B]       
获取:35 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-proposed/main amd64 DEP-11 Metadata [6,552 B]         
获取:36 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64  Packages [22.3 kB]
获取:37 https://nvidia.github.io/libnvidia-container/stable/ubuntu22.04/amd64  Packages [22.3 kB]
获取:38 https://nvidia.github.io/nvidia-container-runtime/stable/ubuntu22.04/amd64  Packages [7,416 B]
获取:39 https://nvidia.github.io/nvidia-docker/ubuntu22.04/amd64  Packages [4,488 B]        
获取:40 http://mirrors.aliyun.com/ubuntu bionic-updates/main i386 Packages [1,604 kB]                                                                                           
获取:41 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [297 kB]                                                                                     
获取:42 http://mirrors.aliyun.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [302 kB]                                                                                 
获取:43 http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,468 B]                                                                              
获取:44 http://mirrors.aliyun.com/ubuntu bionic-proposed/main Sources [81.3 kB]                                                                                                 
获取:45 http://mirrors.aliyun.com/ubuntu bionic-proposed/main Translation-en [38.8 kB]                                                                                          
获取:46 http://mirrors.aliyun.com/ubuntu bionic-proposed/main amd64 DEP-11 Metadata [6,516 B]                                                                                   
获取:47 http://mirrors.aliyun.com/ubuntu bionic-backports/main amd64 DEP-11 Metadata [8,092 B]                                                                                  
获取:48 http://mirrors.aliyun.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [10.1 kB]                                                                              
已下载 11.9 MB,耗时 11(1,115 kB/s)                                                                                                                                          
正在读取软件包列表... 2%
正在读取软件包列表... 完成
root@test:/etc/apt/sources.list.d# 
root@test:/etc/apt/sources.list.d# apt-get install nvidia-docker2
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
下列软件包是自动安装的并且现在不需要了:
  libevent-2.1-7 libnatpmp1 libxvmc1 transmission-common
使用'apt autoremove'来卸载它(它们)。
将会同时安装下列软件:
  libnvidia-container-tools libnvidia-container1 nvidia-container-toolkit nvidia-container-toolkit-base
下列【新】软件包将被安装:
  libnvidia-container-tools libnvidia-container1 nvidia-container-toolkit nvidia-container-toolkit-base nvidia-docker2
升级了 0 个软件包,新安装了 5 个软件包,要卸载 0 个软件包,有 80 个软件包未被升级。
需要下载 3,773 kB 的归档。
解压缩后会消耗 14.6 MB 的额外空间。
您希望继续执行吗? [Y/n] y
获取:1 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64  libnvidia-container1 1.12.0-1 [927 kB]
获取:2 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64  libnvidia-container-tools 1.12.0-1 [24.5 kB]                                                      
获取:3 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64  nvidia-container-toolkit-base 1.12.0-1 [2,066 kB]                                                 
获取:4 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64  nvidia-container-toolkit 1.12.0-1 [750 kB]                                                        
获取:5 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64  nvidia-docker2 2.12.0-1 [5,544 B]                                                                 
已下载 3,773 kB,耗时 213(28.3 kB/s)                                                                                                                                      
正在选中未选择的软件包 libnvidia-container1:amd64。
(正在读取数据库 ... 系统当前共安装有 202374 个文件和目录。)
准备解压 .../libnvidia-container1_1.12.0-1_amd64.deb  ...
正在解压 libnvidia-container1:amd64 (1.12.0-1) ...
正在选中未选择的软件包 libnvidia-container-tools。
准备解压 .../libnvidia-container-tools_1.12.0-1_amd64.deb  ...
正在解压 libnvidia-container-tools (1.12.0-1) ...
正在选中未选择的软件包 nvidia-container-toolkit-base。
准备解压 .../nvidia-container-toolkit-base_1.12.0-1_amd64.deb  ...
正在解压 nvidia-container-toolkit-base (1.12.0-1) ...
正在选中未选择的软件包 nvidia-container-toolkit。
准备解压 .../nvidia-container-toolkit_1.12.0-1_amd64.deb  ...
正在解压 nvidia-container-toolkit (1.12.0-1) ...
正在选中未选择的软件包 nvidia-docker2。
准备解压 .../nvidia-docker2_2.12.0-1_all.deb  ...
正在解压 nvidia-docker2 (2.12.0-1) ...
正在设置 nvidia-container-toolkit-base (1.12.0-1) ...
正在设置 libnvidia-container1:amd64 (1.12.0-1) ...
正在设置 libnvidia-container-tools (1.12.0-1) ...
正在设置 nvidia-container-toolkit (1.12.0-1) ...
正在设置 nvidia-docker2 (2.12.0-1) ...
正在处理用于 libc-bin (2.31-0ubuntu9.7) 的触发器 ...



root@hk-MZ32-AR0-00:~# systemctl restart docker

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109

5.2 centos系统安装

[root@bj ~]# sudo yum install -y nvidia-docker2
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                                                      | 6.2 kB  00:00:00     
 * base: mirrors.163.com
 * epel: mirrors.bfsu.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
base                                                                                                                                                      | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                                                          | 3.5 kB  00:00:00     
extras                                                                                                                                                    | 2.9 kB  00:00:00     
libnvidia-container/x86_64/signature                                                                                                                      |  833 B  00:00:00     
Retrieving key from https://nvidia.github.io/libnvidia-container/gpgkey
Importing GPG key 0xF796ECB0:
 Userid     : "NVIDIA CORPORATION (Open Source Projects) <cudatools@nvidia.com>"
 Fingerprint: c95b 321b 61e8 8c18 09c4 f759 ddca e044 f796 ecb0
 From       : https://nvidia.github.io/libnvidia-container/gpgkey
libnvidia-container/x86_64/signature                                                                                                                      | 2.1 kB  00:00:00 !!! 
nvidia-container-runtime/x86_64/signature                                                                                                                 |  833 B  00:00:00     
Retrieving key from https://nvidia.github.io/nvidia-container-runtime/gpgkey
Importing GPG key 0xF796ECB0:
 Userid     : "NVIDIA CORPORATION (Open Source Projects) <cudatools@nvidia.com>"
 Fingerprint: c95b 321b 61e8 8c18 09c4 f759 ddca e044 f796 ecb0
 From       : https://nvidia.github.io/nvidia-container-runtime/gpgkey
nvidia-container-runtime/x86_64/signature                                                                                                                 | 2.1 kB  00:00:00 !!! 
nvidia-docker/x86_64/signature                                                                                                                            |  833 B  00:00:00     
Retrieving key from https://nvidia.github.io/nvidia-docker/gpgkey
Importing GPG key 0xF796ECB0:
 Userid     : "NVIDIA CORPORATION (Open Source Projects) <cudatools@nvidia.com>"
 Fingerprint: c95b 321b 61e8 8c18 09c4 f759 ddca e044 f796 ecb0
 From       : https://nvidia.github.io/nvidia-docker/gpgkey
nvidia-docker/x86_64/signature                                                                                                                            | 2.1 kB  00:00:00 !!! 
teamviewer/x86_64/signature                                                                                                                               |  867 B  00:00:00     
teamviewer/x86_64/signature                                                                                                                               | 2.5 kB  00:00:00 !!! 
updates                                                                                                                                                   | 2.9 kB  00:00:00     
(1/3): nvidia-container-runtime/x86_64/primary                                                                                                            |  11 kB  00:00:01     
(2/3): nvidia-docker/x86_64/primary                                                                                                                       | 8.0 kB  00:00:01     
(3/3): libnvidia-container/x86_64/primary                                                                                                                 |  27 kB  00:00:03     
libnvidia-container                                                                                                                                                      171/171
nvidia-container-runtime                                                                                                                                                   71/71
nvidia-docker                                                                                                                                                              54/54
Resolving Dependencies
--> Running transaction check
---> Package nvidia-docker2.noarch 0:2.11.0-1 will be installed
--> Processing Dependency: nvidia-container-toolkit >= 1.10.0-1 for package: nvidia-docker2-2.11.0-1.noarch
--> Running transaction check
---> Package nvidia-container-toolkit.x86_64 0:1.11.0-1 will be installed
--> Processing Dependency: nvidia-container-toolkit-base = 1.11.0-1 for package: nvidia-container-toolkit-1.11.0-1.x86_64
--> Processing Dependency: libnvidia-container-tools < 2.0.0 for package: nvidia-container-toolkit-1.11.0-1.x86_64
--> Processing Dependency: libnvidia-container-tools >= 1.11.0-1 for package: nvidia-container-toolkit-1.11.0-1.x86_64
--> Running transaction check
---> Package libnvidia-container-tools.x86_64 0:1.11.0-1 will be installed
--> Processing Dependency: libnvidia-container1(x86-64) >= 1.11.0-1 for package: libnvidia-container-tools-1.11.0-1.x86_64
--> Processing Dependency: libnvidia-container.so.1(NVC_1.0)(64bit) for package: libnvidia-container-tools-1.11.0-1.x86_64
--> Processing Dependency: libnvidia-container.so.1()(64bit) for package: libnvidia-container-tools-1.11.0-1.x86_64
---> Package nvidia-container-toolkit-base.x86_64 0:1.11.0-1 will be installed
--> Running transaction check
---> Package libnvidia-container1.x86_64 0:1.11.0-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================
 Package                                                 Arch                             Version                            Repository                                     Size
=================================================================================================================================================================================
Installing:
 nvidia-docker2                                          noarch                           2.11.0-1                           libnvidia-container                           8.7 k
Installing for dependencies:
 libnvidia-container-tools                               x86_64                           1.11.0-1                           libnvidia-container                            50 k
 libnvidia-container1                                    x86_64                           1.11.0-1                           libnvidia-container                           1.0 M
 nvidia-container-toolkit                                x86_64                           1.11.0-1                           libnvidia-container                           780 k
 nvidia-container-toolkit-base                           x86_64                           1.11.0-1                           libnvidia-container                           2.5 M

Transaction Summary
=================================================================================================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 4.3 M
Installed size: 12 M
Downloading packages:
(1/5): libnvidia-container-tools-1.11.0-1.x86_64.rpm                                                                                                      |  50 kB  00:00:01     
(2/5): libnvidia-container1-1.11.0-1.x86_64.rpm                                                                                                           | 1.0 MB  00:00:03     
(3/5): nvidia-container-toolkit-1.11.0-1.x86_64.rpm                                                                                                       | 780 kB  00:00:03     
(4/5): nvidia-docker2-2.11.0-1.noarch.rpm                                                                                                                 | 8.7 kB  00:00:00     
(5/5): nvidia-container-toolkit-base-1.11.0-1.x86_64.rpm                                                                                                  | 2.5 MB  00:00:43     
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                             94 kB/s | 4.3 MB  00:00:46     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : nvidia-container-toolkit-base-1.11.0-1.x86_64                                                                                                                 1/5 
  Installing : libnvidia-container1-1.11.0-1.x86_64                                                                                                                          2/5 
  Installing : libnvidia-container-tools-1.11.0-1.x86_64                                                                                                                     3/5 
  Installing : nvidia-container-toolkit-1.11.0-1.x86_64                                                                                                                      4/5 
  Installing : nvidia-docker2-2.11.0-1.noarch                                                                                                                                5/5 
  Verifying  : libnvidia-container1-1.11.0-1.x86_64                                                                                                                          1/5 
  Verifying  : nvidia-container-toolkit-base-1.11.0-1.x86_64                                                                                                                 2/5 
  Verifying  : nvidia-container-toolkit-1.11.0-1.x86_64                                                                                                                      3/5 
  Verifying  : libnvidia-container-tools-1.11.0-1.x86_64                                                                                                                     4/5 
  Verifying  : nvidia-docker2-2.11.0-1.noarch                                                                                                                                5/5 

Installed:
  nvidia-docker2.noarch 0:2.11.0-1                                                                                                                                               

Dependency Installed:
  libnvidia-container-tools.x86_64 0:1.11.0-1 libnvidia-container1.x86_64 0:1.11.0-1 nvidia-container-toolkit.x86_64 0:1.11.0-1 nvidia-container-toolkit-base.x86_64 0:1.11.0-1

Complete!
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 若是centos系统,需要用yum安装过nvidia-docker2,虽然已经安装过nvidia-container-toolkit,但是在容器中使用gpu的时候报错,更新安装 nvidia-container-toolkit

在这里插入图片描述

# 设置yum源:nvidia-container-toolkit.repo


[root@bj ~]# distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
>    && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.repo | tee /etc/yum.repos.d/nvidia-container-toolkit.repo
[libnvidia-container]
name=libnvidia-container
baseurl=https://nvidia.github.io/libnvidia-container/stable/centos7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://nvidia.github.io/libnvidia-container/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt

[libnvidia-container-experimental]
name=libnvidia-container-experimental
baseurl=https://nvidia.github.io/libnvidia-container/experimental/centos7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=0
gpgkey=https://nvidia.github.io/libnvidia-container/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt


[root@bj ~]# yum install -y nvidia-container-toolkit
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Repository libnvidia-container is listed more than once in the configuration
Repository libnvidia-container-experimental is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * epel: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package nvidia-container-toolkit.x86_64 0:1.11.0-1 will be updated
---> Package nvidia-container-toolkit.x86_64 0:1.12.0-0.1.rc.3 will be an update
--> Processing Dependency: nvidia-container-toolkit-base = 1.12.0-0.1.rc.3 for package: nvidia-container-toolkit-1.12.0-0.1.rc.3.x86_64
--> Processing Dependency: libnvidia-container-tools >= 1.12.0-0.1.rc.3 for package: nvidia-container-toolkit-1.12.0-0.1.rc.3.x86_64
--> Running transaction check
---> Package libnvidia-container-tools.x86_64 0:1.11.0-1 will be updated
---> Package libnvidia-container-tools.x86_64 0:1.12.0-0.1.rc.3 will be an update
--> Processing Dependency: libnvidia-container1(x86-64) >= 1.12.0-0.1.rc.3 for package: libnvidia-container-tools-1.12.0-0.1.rc.3.x86_64
---> Package nvidia-container-toolkit-base.x86_64 0:1.11.0-1 will be updated
---> Package nvidia-container-toolkit-base.x86_64 0:1.12.0-0.1.rc.3 will be an update
--> Running transaction check
---> Package libnvidia-container1.x86_64 0:1.11.0-1 will be updated
---> Package libnvidia-container1.x86_64 0:1.12.0-0.1.rc.3 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================
 Package                                            Arch                        Version                              Repository                                             Size
=================================================================================================================================================================================
Updating:
 nvidia-container-toolkit                           x86_64                      1.12.0-0.1.rc.3                      libnvidia-container-experimental                      797 k
Updating for dependencies:
 libnvidia-container-tools                          x86_64                      1.12.0-0.1.rc.3                      libnvidia-container-experimental                       50 k
 libnvidia-container1                               x86_64                      1.12.0-0.1.rc.3                      libnvidia-container-experimental                      1.0 M
 nvidia-container-toolkit-base                      x86_64                      1.12.0-0.1.rc.3                      libnvidia-container-experimental                      3.4 M

Transaction Summary
=================================================================================================================================================================================
Upgrade  1 Package (+3 Dependent packages)

Total download size: 5.2 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/4): libnvidia-container-tools-1.12.0-0.1.rc.3.x86_64.rpm                                                                                               |  50 kB  00:00:00     
(2/4): nvidia-container-toolkit-1.12.0-0.1.rc.3.x86_64.rpm                                                                                                | 797 kB  00:00:00     
(3/4): libnvidia-container1-1.12.0-0.1.rc.3.x86_64.rpm                                                                                                    | 1.0 MB  00:00:02     
(4/4): nvidia-container-toolkit-base-1.12.0-0.1.rc.3.x86_64.rpm                                                                                           | 3.4 MB  00:00:00     
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                            2.0 MB/s | 5.2 MB  00:00:02     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : nvidia-container-toolkit-base-1.12.0-0.1.rc.3.x86_64                                                                                                          1/8 
  Updating   : libnvidia-container1-1.12.0-0.1.rc.3.x86_64                                                                                                                   2/8 
  Updating   : libnvidia-container-tools-1.12.0-0.1.rc.3.x86_64                                                                                                              3/8 
  Updating   : nvidia-container-toolkit-1.12.0-0.1.rc.3.x86_64                                                                                                               4/8 
  Cleanup    : nvidia-container-toolkit-1.11.0-1.x86_64                                                                                                                      5/8 
  Cleanup    : libnvidia-container-tools-1.11.0-1.x86_64                                                                                                                     6/8 
  Cleanup    : libnvidia-container1-1.11.0-1.x86_64                                                                                                                          7/8 
  Cleanup    : nvidia-container-toolkit-base-1.11.0-1.x86_64                                                                                                                 8/8 
  Verifying  : libnvidia-container1-1.12.0-0.1.rc.3.x86_64                                                                                                                   1/8 
  Verifying  : nvidia-container-toolkit-base-1.12.0-0.1.rc.3.x86_64                                                                                                          2/8 
  Verifying  : libnvidia-container-tools-1.12.0-0.1.rc.3.x86_64                                                                                                              3/8 
  Verifying  : nvidia-container-toolkit-1.12.0-0.1.rc.3.x86_64                                                                                                               4/8 
  Verifying  : libnvidia-container-tools-1.11.0-1.x86_64                                                                                                                     5/8 
  Verifying  : nvidia-container-toolkit-base-1.11.0-1.x86_64                                                                                                                 6/8 
  Verifying  : nvidia-container-toolkit-1.11.0-1.x86_64                                                                                                                      7/8 
  Verifying  : libnvidia-container1-1.11.0-1.x86_64                                                                                                                          8/8 

Updated:
  nvidia-container-toolkit.x86_64 0:1.12.0-0.1.rc.3                                                                                                                              

Dependency Updated:
  libnvidia-container-tools.x86_64 0:1.12.0-0.1.rc.3         libnvidia-container1.x86_64 0:1.12.0-0.1.rc.3         nvidia-container-toolkit-base.x86_64 0:1.12.0-0.1.rc.3        

Complete!
[root@bj ~]# systemctl restart docker  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109

6. 测试docker容调用GPU服务

root@hk-MZ32-AR0-00:~# docker run --rm --gpus all nvidia/cuda:10.0-base nvidia-smi
Sat Feb 11 07:13:48 2023       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.106.00   Driver Version: 460.106.00   CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla T4            Off  | 00000000:04:00.0 Off |                    0 |
| N/A   47C    P0    27W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   1  Tesla T4            Off  | 00000000:06:00.0 Off |                    0 |
| N/A   43C    P0    28W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   2  Tesla T4            Off  | 00000000:0D:00.0 Off |                    0 |
| N/A   49C    P0    28W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   3  Tesla T4            Off  | 00000000:0F:00.0 Off |                    0 |
| N/A   45C    P0    26W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   4  Tesla T4            Off  | 00000000:17:00.0 Off |                    0 |
| N/A   48C    P0    27W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   5  Tesla T4            Off  | 00000000:19:00.0 Off |                    0 |
| N/A   49C    P0    28W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   6  Tesla T4            Off  | 00000000:21:00.0 Off |                    0 |
| N/A   45C    P0    26W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   7  Tesla T4            Off  | 00000000:23:00.0 Off |                    0 |
| N/A   45C    P0    28W /  70W |      0MiB / 15109MiB |      5%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/649416
推荐阅读
相关标签
  

闽ICP备14008679号