如何获得 CUDA 版本? [英] How to get the CUDA version?

查看:19
本文介绍了如何获得 CUDA 版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何快速命令或脚本来检查安装的 CUDA 版本?

Is there any quick command or script to check for the version of CUDA installed?

在安装目录下找到了4.0的说明书,不知道是不是实际安装的版本.

I found the manual of 4.0 under the installation directory but I'm not sure whether it is of the actual installed version or not.

推荐答案

正如 Jared 在评论中提到的,从命令行:

As Jared mentions in a comment, from the command line:

nvcc --version

(或 /usr/local/cuda/bin/nvcc --version)给出 CUDA 编译器版本(与工具包版本匹配).

(or /usr/local/cuda/bin/nvcc --version) gives the CUDA compiler version (which matches the toolkit version).

从应用程序代码中,您可以查询运行时 API 版本

From application code, you can query the runtime API version with

cudaRuntimeGetVersion()

或带有

cudaDriverGetVersion()

正如 Daniel 所指出的,deviceQuery 是一个 SDK 示例应用,可查询上述内容以及设备功能.

As Daniel points out, deviceQuery is an SDK sample app that queries the above, along with device capabilities.

正如其他人所说,您还可以使用(例如,在 Mac 或 Linux 上)检查 version.txt 的内容

As others note, you can also check the contents of the version.txt using (e.g., on Mac or Linux)

cat /usr/local/cuda/version.txt

但是,如果安装了除 /usr/local/cuda 符号链接之外的另一个版本的 CUDA 工具包,如果另一个版本在您的 中较早,则可能会报告不准确的版本>PATH 比上面的,请谨慎使用.

However, if there is another version of the CUDA toolkit installed other than the one symlinked from /usr/local/cuda, this may report an inaccurate version if another version is earlier in your PATH than the above, so use with caution.

这篇关于如何获得 CUDA 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆