Created
March 4, 2026 17:25
-
-
Save KorewaLidesu/b5836b7984a87a5e8ff12d135ec73915 to your computer and use it in GitHub Desktop.
Switching CUDA version inside fish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function cuda_switch -a cuda_version | |
| if test -z $cuda_version | |
| echo "cuda_switch info : Switch to default CUDA" | |
| echo "To switch to specific version, append after the command (eg: cuda_switch 11.7)" | |
| set PATH (echo "$PATH" | sed "s/\/opt\/cuda[-0-9\.]*/\/opt\/cuda/") | |
| set CUDA_PATH "/opt/cuda" | |
| else if test -e /opt/cuda-$cuda_version | |
| echo "cuda_switch info : Found CUDA $cuda_version at /opt/cuda-$cuda_version" | |
| echo "Switching to CUDA $cuda_version" | |
| set PATH (echo "$PATH" | sed "s/\/opt\/cuda[-0-9\.]*/\/opt\/cuda-$cuda_version/") | |
| set CUDA_PATH "/opt/cuda-$cuda_version" | |
| else | |
| echo "cuda_switch error : Specified CUDA version not found" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment