Skip to content

Instantly share code, notes, and snippets.

@Barath19
Last active May 29, 2024 23:28
Show Gist options
  • Select an option

  • Save Barath19/64cc77ab1efda29cf09f2f4000f43510 to your computer and use it in GitHub Desktop.

Select an option

Save Barath19/64cc77ab1efda29cf09f2f4000f43510 to your computer and use it in GitHub Desktop.
Multiple CUDA versions - Simple Method - The 10 Commandsment
  1. Install the latest/stable version of the nvidia driver. For eg, 12.2 in my case
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.161.08             Driver Version: 535.161.08   CUDA Version: 12.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                       On  | 00000000:37:00.0 Off |                    0 |
| N/A   47C    P8              16W /  70W |      2MiB / 15360MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+
  1. Download the second cuda version you need to install (11.8) from here. Select the OS and the runfile (local) image
  2. chmod +x cuda_11.8.0_520.61.05_linux.run
  3. sudo ./cuda_11.8.0_520.61.05_linux.run
  4. [IMPO] When prompted deselect the driver. So that we have the original driver intact and not spend next 2hrs fixing it!! image

image

select install image

  1. [IMPO] Select No for the symlink update image

  2. Now update the environment variables

  • export PATH=/usr/local/cuda-11.8/bin:$PATH
  • export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH
  1. use CUDA_HOME variable to switch between different version. E.g. CUDA_HOME=/usr/local/cuda-11.8 python setup.py develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment