Article directory
CUDA
View the highest CUDA version supported by the GPU driver
Run the command: nvidia-smi
CUDA Version: 11.6, indicating that the highest version of CUDA supported by the current driver is 11.6
CUDA download
CUDA download address: CUDA Toolkit Archive
Find the CUDA version suitable for your GPU driver in the list, and select the corresponding system
Copy the link to the address bar of the browser to directly access the download.
Use the tool to upload the cuda_12.0.1_525.85.12_linux.run file to the specified path of your own server.
Specify the path to install CUDA
run sudo sh cuda_12.0.1_525.85.12_linux.run --tmpdir=/home/houzm/houzm/01_develop_tools/cuda
If the following error is prompted, you can create a custom path, and then specify –tmpdir
Extraction failed.
Ensure there is enough space in /tmp and that the installation package is not corrupt
Signal caught, cleaning up
sh cuda_12.0.1_525.85.12 when executing sh _linux.run --tmpdir=/home/houzm/houzm/01_develop_tools/cuda
There may be a prompt that there are multiple graphics card drivers: Existing package manager installation of the driver found. It is strongly recommended that you remove this before continuing. You can choose Continue to continue the installation, and do not choose to reinstall the driver during the subsequent installation process.
After selecting accept, change the installation option ('X' means selected, here I only install CUDA Toolkit and CUDA Samples, generally it is enough not to engage in CUDA programming and run deep learning alone): the method of canceling the selection is: the cursor stays on the Driver
line Go up, and then press Enter, so that the X in [] disappears
Go back to the previous step and deselect all Done then Install.
cuDNN
Download address: cuDNN Archive
Install the software in .deb format to the specified path: dpkg -i --instdir=/dest/dir/path some.deb
tar -xvf cudnn-linux-x86_64-8.8.1.3_cuda11-archive.tar.xz -C /yourpath/01_develop_tools/cudnn/cudnn_8.8.1_linux
cuDNN Official Installation Guide
(base) houzm@root605:~/houzm/01_develop_tools/cudnn/cudnn_8.8.1_linux/cudnn-linux-x86_64-8.8.1.3_cuda11-archive/include$ cat /home/houzm/houzm/01_develop_tools/cudnn/cudnn_8.8.1_linux/cudnn-linux-x86_64-8.8.1.3_cuda11-archive/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
#define CUDNN_MAJOR 8
#define CUDNN_MINOR 8
#define CUDNN_PATCHLEVEL 1
–
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)
/* cannot use constexpr here since this is a C-only file */
Verify that cuda is successfully installed and the version information
(py3.8) houzm@root605:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Mar_21_19:15:46_PDT_2021
Cuda compilation tools, release 11.3, V11.3.58
Build cuda_11.3.r11.3/compiler.29745058_0
pytorch
conda create --name openmmlab python=3.8 -y
conda activate openmmlab
Find the pytorch installation command corresponding to your cuda version on the pytorch official website. pytorch official download address
conda install pytorch1.13.1 torchvision0.14.1 torchaudio==0.13.1 pytorch-cuda=11.6 -c pytorch -c nvidia
Verify that pytorch is installed successfully & GPU is available
(py38) houzm@root605:~/houzm/01_develop_tools/cudnn/cudnn_8.8.1_linux/cudnn-linux-x86_64-8.8.1.3_cuda11-archive/include$ > > > python
Python 3.8.16 (default, Mar 2 2023, 03:21:46)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import torch as t
>>> device = t.device(‘cuda’ if t.cuda.is_available() else ‘cpu’)
>>> print(device)
cuda