CUDA Toolkit multi-version installation and configuration

       The purpose of multi-version installation of CUDA Toolkit is to support multiple versions of CUDA Toolkit, and update the current version to the subsequent version that supports common pytorch (ie cuda11.6). Currently, the default installation of the system is cuda10.2, cuda11.0 and cuda11.2. CUDA generally has two APIs, one is the driver API (Driver Version), which depends on the NVIDIA driver and can be viewed by nvidia-smi; the other is the running API (Runtime Version), which is required for software operation, such as the cuda api version required by the python environment wait. Generally, the driver API version >= the running API version.
0.cuda version query command
Running API (runtime api): nvcc -V
Driver API (driver api): nvidia-smi, cycle monitoring: watch -n 1 -d nvidia-smi
Operating environment: "Red Hat Enterprise Linux Server7.5 , python3.10, cuda11, torch1.13.1
1. Download: https://developer.nvidia.com/ Select the corresponding version to download
2. Install: sudo sh cuda_11.6.2_510.47.03_linux.run
select accept, only select CUDA Toolkit 11.6, remove all others, select Install, see the figure below for details

3. Establish a soft link of cuda. ​​Generally, it will be created automatically after the default installation is completed. Later, the soft link can be adjusted as needed, such as changing to cuda-11.2, etc.
Enter the /usr/local/ directory
sudo rm -rf cuda # Before deleting The created soft link
sudo ln -s /usr/local/cuda-11.6/ /usr/local/cuda # Create a new soft link (the link version is 11.6)
4. Configure PATH , open the .bashrc file and add the following two lines
of export PATH="/usr/local/cuda/bin:/root/anaconda3/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:$LD_LIBRARY_PATH "
5. The configuration file takes effect : source .bashrc

Guess you like

Origin blog.csdn.net/hhue2007/article/details/132624836