2022-09-14 version
Environment setup
OS: Ubuntu 20.04
CUDA: 11.6.2
cuDNN: 8.4.0.27
1. CUDA 11.6.2 install
https://developer.nvidia.com/cuda-toolkit-archive
https://developer.nvidia.com/cuda-11-6-2-download-archive
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.6.2/local_installers/cuda-repo-ubuntu2004-11-6-local_11.6.2-510.47.03-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-6-local_11.6.2-510.47.03-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-6-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
sip2@sip2-2021:~/Downloads$ /usr/local/cuda/bin/nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_Mar__8_18:18:20_PST_2022
Cuda compilation tools, release 11.6, V11.6.124
Build cuda_11.6.r11.6/compiler.31057947_0
Insert CUDA path in bashrc
sip2@sip2-2021:~/Downloads$ gedit ~/.bashrc
# CUDA 11.6.2
export PATH=/usr/local/cuda-11.6/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
2. cuDNN8.4.0.27
https://developer.nvidia.com/rdp/cudnn-archive
Local Installer for Ubuntu18.04 x86_64 (Deb)
https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html
sudo apt-get install zlib1g
sip2@sip2-2021:~/Downloads$ sudo dpkg -i cudnn-local-repo-ubuntu1804-8.4.0.27_1.0-1_amd64.deb
Selecting previously unselected package cudnn-local-repo-ubuntu1804-8.4.0.27.
(Reading database ... 363558 files and directories currently installed.)
Preparing to unpack cudnn-local-repo-ubuntu1804-8.4.0.27_1.0-1_amd64.deb ...
Unpacking cudnn-local-repo-ubuntu1804-8.4.0.27 (1.0-1) ...
Setting up cudnn-local-repo-ubuntu1804-8.4.0.27 (1.0-1) ...
sip2@sip2-2021:~/Downloads$sudo cp /var/cudnn-local-repo-*/cudnn-local-*-keyring.gpg /usr/share/keyrings/
sip2@sip2-2021:~/Downloads$ sudo apt-get install libcudnn8=8.4.0.27-1+cuda11.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 usb-modeswitch usb-modeswitch-data
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
libcudnn8
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/421 MB of archives.
After this operation, 1,253 MB of additional disk space will be used.
Get:1 file:/var/cudnn-local-repo-ubuntu1804-8.4.0.27 libcudnn8 8.4.0.27-1+cuda11.6 [421 MB]
Selecting previously unselected package libcudnn8.
(Reading database ... 363570 files and directories currently installed.)
Preparing to unpack .../libcudnn8_8.4.0.27-1+cuda11.6_amd64.deb ...
Unpacking libcudnn8 (8.4.0.27-1+cuda11.6) ...
Setting up libcudnn8 (8.4.0.27-1+cuda11.6) ...
sip2@sip2-2021:~/Downloads$ sudo apt-get install libcudnn8-dev=8.4.0.27-1+cuda11.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 usb-modeswitch usb-modeswitch-data
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
libcudnn8-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/449 MB of archives.
After this operation, 1,557 MB of additional disk space will be used.
Get:1 file:/var/cudnn-local-repo-ubuntu1804-8.4.0.27 libcudnn8-dev 8.4.0.27-1+cuda11.6 [449 MB]
Selecting previously unselected package libcudnn8-dev.
(Reading database ... 363587 files and directories currently installed.)
Preparing to unpack .../libcudnn8-dev_8.4.0.27-1+cuda11.6_amd64.deb ...
Unpacking libcudnn8-dev (8.4.0.27-1+cuda11.6) ...
Setting up libcudnn8-dev (8.4.0.27-1+cuda11.6) ...
update-alternatives: using /usr/include/x86_64-linux-gnu/cudnn_v8.h to provide /usr/include/cudnn.h (libcudnn) in auto mode
sip2@sip2-2021:~/Downloads$ sudo apt-get install libcudnn8-samples=8.4.0.27-1+cuda11.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 usb-modeswitch usb-modeswitch-data
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
libcudnn8-samples
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,664 kB of archives.
After this operation, 2,169 kB of additional disk space will be used.
Get:1 file:/var/cudnn-local-repo-ubuntu1804-8.4.0.27 libcudnn8-samples 8.4.0.27-1+cuda11.6 [1,664 kB]
Selecting previously unselected package libcudnn8-samples.
(Reading database ... 363620 files and directories currently installed.)
Preparing to unpack .../libcudnn8-samples_8.4.0.27-1+cuda11.6_amd64.deb ...
Unpacking libcudnn8-samples (8.4.0.27-1+cuda11.6) ...
Setting up libcudnn8-samples (8.4.0.27-1+cuda11.6) ...
sip2@sip2-2021:~/Downloads$ cp -r /usr/src/cudnn_samples_v8/ $HOME
sip2@sip2-2021:~/Downloads$ cd $HOME/cudnn_samples_v8/mnistCUDNN
sip2@sip2-2021:~/cudnn_samples_v8/mnistCUDNN$ make clean && make
rm -rf *o
rm -rf mnistCUDNN
CUDA_VERSION is 11060
Linking agains cublasLt = true
CUDA VERSION: 11060
TARGET ARCH: x86_64
HOST_ARCH: x86_64
TARGET OS: linux
SMS: 35 50 53 60 61 62 70 72 75 80 86 87
/usr/local/cuda/bin/nvcc -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -ccbin g++ -m64 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_87,code=sm_87 -gencode arch=compute_87,code=compute_87 -o fp16_dev.o -c fp16_dev.cu
nvcc warning : The 'compute_35', 'compute_37', 'sm_35', and 'sm_37' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
g++ -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -o fp16_emu.o -c fp16_emu.cpp
g++ -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -o mnistCUDNN.o -c mnistCUDNN.cpp
/usr/local/cuda/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_87,code=sm_87 -gencode arch=compute_87,code=compute_87 -o mnistCUDNN fp16_dev.o fp16_emu.o mnistCUDNN.o -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -lcublasLt -LFreeImage/lib/linux/x86_64 -LFreeImage/lib/linux -lcudart -lcublas -lcudnn -lfreeimage -lstdc++ -lm
nvcc warning : The 'compute_35', 'compute_37', 'sm_35', and 'sm_37' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
sip2@sip2-2021:~/cudnn_samples_v8/mnistCUDNN$ ./mnistCUDNN
Executing: mnistCUDNN
cudnnGetVersion() : 8400 , CUDNN_VERSION from cudnn.h : 8400 (8.4.0)
Host compiler version : GCC 9.4.0
There are 1 CUDA capable devices on your machine :
device 0 : sms 40 Capabilities 8.6, SmClock 1620.0 Mhz, MemSize (Mb) 7982, MemClock 7001.0 Mhz, Ecc=0, boardGroupID=0
Using device 0
Testing single precision
Loading binary file data/conv1.bin
Loading binary file data/conv1.bias.bin
Loading binary file data/conv2.bin
Loading binary file data/conv2.bias.bin
Loading binary file data/ip1.bin
Loading binary file data/ip1.bias.bin
Loading binary file data/ip2.bin
Loading binary file data/ip2.bias.bin
Loading image data/one_28x28.pgm
Performing forward propagation ...
Testing cudnnGetConvolutionForwardAlgorithm_v7 ...
^^^^ CUDNN_STATUS_SUCCESS for Algo 1: -1.000000 time requiring 0 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 0: -1.000000 time requiring 0 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 2: -1.000000 time requiring 57600 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 5: -1.000000 time requiring 178432 memory
コメント
コメントを投稿