nvidia-smi
返回的是driver所能支持的最新的cuda版本
系统安装的cuda版本可以随意,torch会优先使用虚拟环境中安装的cuda版本
Conda管理Cuda
安装指定版本
1 | conda install nvidia/label/cuda-12.4.0::cuda-toolkit -c nvidia/label/cuda-12.4.0 |
安装最新版本
1 | conda install cuda-toolkit |
某些仓库需要指定cuda路径才能编译包
1 | conda env config vars set LD_LIBRARY_PATH="/home/cyl/miniconda3/envs/gsam/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/:$LD_LIBRARY_PATH" |
- To find the correct path for
CUDA_HOME
usewhich nvcc
. In my case, output of the command was:
1 | >>> which nvcc |
Threefore, I set the CUDA_HOME
as /home/user/miniconda3/envs/py12/
.
Note2: To find the correct path for LD_LIBRARY_PATH
use find ~ -name cuda_runtime_api.h
. In my case, output of the command was:
1 | >>> find ~ -name cuda_runtime_api.h |
So I set the LD_LIBRARY_PATH
as /home/user/miniconda3/envs/py12/targets/x86_64-linux/lib/
and CPATH
as /home/user/miniconda3/envs/py12/targets/x86_64-linux/include/
. If you have multiple CUDA installations, the output of find ~ -name cuda_runtime_api.h
will display multiple paths. Make sure to choose the path that corresponds to the environment you have created.
ref:https://github.com/IDEA-Research/GroundingDINO/issues/355