Installing Multiple CUDA Versions on Windows and Switching as Needed

This article is transcribed by SimpRead. Original URL: blog.csdn.net

Preface

In most cases, you can install standalone CUDA/cuDNN in an Anaconda virtual environment. This method allows users to maintain multiple independent CUDA versions. However, Anaconda does not support certain versions of CUDA/cuDNN. Therefore, it becomes necessary to configure multiple CUDA/cuDNN versions locally and switch between them as needed.

# Search for supported CUDA/cuDNN versions in the channel; both CUDA and cuDNN must be supported
conda search cudatoolkit
conda search cudnn

View Currently Used and Previously Installed CUDA Versions

1. Check the currently used CUDA version

nvcc -V

2. Check already installed CUDA versions

Right-click on “This PC” → Properties → Advanced System Settings → Environment Variables
Two CUDA versions are currently installed: 10.2 and 11.6

Installing a New CUDA Version

The detailed steps are described in 【CUDA/cuDNN Installation Guide】; here we only cover the key steps.


Take installing CUDA Toolkit 9.0/cuDNN 7.0.5 (on Windows 10) as an example:
【Official CUDA Website】
Download and run the .exe file → Select installation location → Custom → Default installation (selected by the author)
Check whether the directory exists under the custom installation path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA (default)

【Official cuDNN Archive】
Extract the downloaded cuDNN 7.0.5 package, then move the files from the bin, include, and lib folders into the corresponding bin, include, and lib directories of CUDA 9.0. Finally, configure the environment variable Path.

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9\libnvvp

Switching CUDA Versions

Now switching from version 11.6 to 9.0

1. Change CUDA_PATH from 11.6 to 9.0

2. Move the two entries related to CUDA 9.0 to higher positions in the system Path environment variable

3. Reopen cmd and test

Summary

This guide provides a simple and detailed walkthrough of installing multiple CUDA versions and switching between them on Windows 10.