Need help with switch-cuda?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

245 Stars 90 Forks MIT License 7 Commits 0 Opened issues


A simple bash script for switching between installed versions of CUDA.

Services available


Need anything else?

Contributors list

No Data


Sometimes, it becomes necessary to switch to an earlier version of CUDA in order to run older code on a machine that is actually set up to use the current version of the CUDA toolkit. This is as simple as adjusting the values of a few environment variables, yet it is cumbersome to do manually. Therefore, this repository provides the bash script
, which adjusts the environment to use a specific version of CUDA for the current bash session.

has been written for and tested on Ubuntu 16.04, but is easily adapted for other platforms.


source [VERSION]

Notice that the script has to be sourced rather than executed, as it performs changes of environment variables that are supposed to persist after the script has finished. If a version number is provided, than all relevant environment variables are adjusted to the required CUDA version (including

, and
). If no version is provided, however, then the script simply prints all versions of CUDA that have been found on the used machine (in


$ source 
The following CUDA installations have been found (in '/usr/local'):
* cuda-8.0
* cuda-9.0
* cuda-9.1
$ source 9.0
Switched to CUDA 9.0.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.