Table of contents
1. Download and Installation Instructions
-
Toolkit download address
- CUDA historical version download address: https://developer.nvidia.com/cuda-toolkit-archive
- cuDNN historical version download address: https://developer.nvidia.com/rdp/cudnn-archive
- Download address of each version of cudatoolkit: https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/
-
version requirements
pytorch, cuda, and cuDNN are strictly corresponding, and cuda_10.2.89_440.33.01_linux.run is installed here, and the corresponding cudnn version is 10.2-linux-x64-v7.6.5.32
-
File Upload
Upload the downloaded installation package to the folder where files are stored under offline Linux, and upload it here to the files folder in the home directory.
2. CUDA installation
**Note: **Here, take installing cuda into the software folder as an example to complete the following installation steps:
-
Copy the cuda toolkit installer in the files folder to the software folder
cp files/cuda_10.2.89_440.33.01_linux.run ~/software/
Enter the directory where the cuda toolkit installer is placed (/data/users/CHHDHPC/2017901437/software/), and execute ls to view the files in the current directory:
-
Modify the running permission of the cuda toolkit installer
chmod +x cuda_10.2.89_440.33.01_linux.run
-
Run the cuda toolkit installer
./cuda_10.2.89_440.33.01_linux.run
-
Type accept and press Enter. The following appears:
-
Only check the CUDA Toolkit option. If other version installation packages have other options, only check the CUDA Toolkit option.
-
Move the cursor to Options and press Enter to modify the installation directory. After pressing Enter, the following figure appears:
Here we need to modify the paths of Toolkit Options and Library install path. -
Modify Toolkit Options path
- Move the cursor to Toolkit Options and press Enter
- Uncheck all checked options as shown below
- Move the cursor to Change Toolkit Install Path and press Enter
- Change the installation path to the path in your own home directory, here it is changed to " /data/users/CHDHPC/2017901437/software/cuda-10.2/ ", where 2017901437 is the user account.
- Press the Enter key to confirm, the following content appears
- Move the cursor to Doen, press Enter to return, and the following content appears
- Move the cursor to Toolkit Options and press Enter
-
Modify the Library install path path
- Move the cursor to the Library install path, and press the Enter key, the following content appears
- Enter the modified path, which is modified here to " /data/users/CHHDHPC/2017901437/software/cuda-10.2/ ", as shown below
- Press the Enter key to confirm, the following content appears
- Move the cursor to Done, press Enter to confirm, and the path modification is completed
- Move the cursor to the Library install path, and press the Enter key, the following content appears
-
Start the installation: move the cursor to Install, and press Enter to start the installation, as follows
-
The installation is complete: the following installation information appears, indicating that the installation is successful
-
Modify environment variables
-
Open the bashrc configuration file
# 打开bashrc配置文件 vim ~/.bashrc
-
Then, add the following to it:
# cuda env export CUDA_HOME=$CUDA_HOME:/data/users/CHDHPC/2017901437/software/cuda-10.2 export PATH=$PATH:/data/users/CHDHPC/2017901437/software/cuda-10.2/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/users/CHDHPC/2017901437/software/cuda-10.2/lib64
-
The addition is complete, as shown in the figure below:
-
Execute
wq
, save and exit
-
-
activate environment variable
source ~/.bashrc
-
The test installation was successful
-
The installation is complete
3. cuDNN installation
-
Copy the cuDNN toolkit installer in the files folder to the software folder
cp cudnn-10.2-linux-x64-v7.6.5.32.tgz ~/software/
Enter the directory where the cuDNN toolkit installer is placed (/data/users/CHHDHPC/2017901437/software/), and execute ls to view the files in the current directory:
-
Unzip the downloaded cuDNN
tar -zxvf cudnn-10.2-linux-x64-v7.6.5.32.tgz
-
Copy the cuDNN pressurized file to the CUDA installation directory
cp cuda/include/cudnn* cuda-10.2/include/ cp cuda/lib64/libcudnn* cuda-10.2/lib64/
-
Modify the permissions of copied files
chmod a+r cuda-10.2/include/cudnn* cuda-10.2/lib64/libcudnn*
-
After the installation is complete, delete the decompressed cuda folder and other installation packages under the installation directory software.
4. cudatoolkit installation
-
Copy the cudatoolkit toolkit installer in the files folder to the software folder
cp cudatoolkit-10.2.89-hfd86e86_1.tar.bz2 ~/software/
Enter the directory where the cudatoolkit toolkit installer is placed (/data/users/CHDHPC/2017901437/software/), and execute ls to view the files in the current directory:
-
Activate the python virtual environment to configure the environment in anaconda. The default environment is configured here, that is, the base virtual environment is activated. If the environment is already active, skip this step.
conda activate base
-
Use the conda installation command to package the cudatoolkit tool in the currently activated virtual environment. (The conda install installation command can only install packages in the currently activated python virtual environment)
conda install --offline cudatoolkit-10.2.89-hfd86e86_1.tar.bz2
-
The installation is complete as shown below
5. The test installation is successful
-
Activate the virtual environment
conda activate base
-
Enter the python interpreter and enter the following code to test the successful installation of pytorch and cuda.
import torch print(torch.version.cuda)