CUDA版本自由切换

首先查看当前cuda版本

ls /usr/local/

我们可以看到

bin  cuda-11.0  cuda-11.8  cuda-12.0  etc  games  include  lib  man  sbin  share  src

然后编辑环境变量

vim ~/.bashrc

最下面加入11.8的环境变量

## cuda path

# cuda 11.8
export PATH=/usr/local/cuda-11.8/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$ld_library_path
export CUDA_HOME=/usr/local/cuda-11.8

然后source一下

 source ~/.bashrc 

我们可以nvcc看下

nvcc -V

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0

你可能感兴趣的:(linux,人工智能,运维)