是否有任何快速命令或脚本来检查安装的CUDA版本?
我在安装目录下找到了4.0的手册,但我不确定它是否是实际安装的版本。
是否有任何快速命令或脚本来检查安装的CUDA版本?
我在安装目录下找到了4.0的手册,但我不确定它是否是实际安装的版本。
当前回答
除了上面提到的那些,CUDA安装路径(如果在安装过程中没有更改)通常包含版本号
执行哪个nvcc应该提供路径,这将为您提供版本
PS:这是一种快速而肮脏的方式,上面的答案更优雅,并将通过相当大的努力产生正确的版本
其他回答
使用CUDA运行时API C++包装器编程(注意:我是作者):
auto v1 = cuda::version::maximum_supported_by_driver();
auto v2 = cuda::version::runtime();
这为您提供了一个cuda::version_t结构,您可以对其进行比较,也可以打印/流式传输,例如:
if (v2 < cuda::version_t{ 8, 0 } ) {
std::cerr << "CUDA version " << v2 << " is insufficient." std::endl;
}
在以下时间之后找到我的:
whereis cuda
at
cuda:/usr/lib/cuda/usr/include/cuda.h
with
nvcc --version
CUDA版本9.1.85
如果nvcc--版本不适合您,请使用cat/usr/local/cuda/version.txt
使用tensorflow:
import tensorflow as tf
from tensorflow.python.platform import build_info as build
print(f"tensorflow version: {tf.__version__}")
print(f"Cuda Version: {build.build_info['cuda_version']}")
print(f"Cudnn version: {build.build_info['cudnn_version']}")
tensorflow版本:2.4.0
Cuda版本:11.0
Cudnn版本:8
在使用CUDA 11.6.1的Windows 11上,这对我很有用:
cat "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\version.json"