简体   繁体   English

CUDA_VERSION 和 CUDART_VERSION 一定是一样的吗?

[英]Are CUDA_VERSION and CUDART_VERSION necessarily the same?

The CUDA Driver API defines CUDA_VERSION (in cuda.h ), and the CUDA Runtime API defines CUDART_VERSION (in cuda_runtime_api.h ). CUDA 驱动程序 API 定义了CUDA_VERSION (在cuda.h中),CUDA 运行时 API 定义了CUDART_VERSION (在cuda_runtime_api.h中)。 However - CUDART_VERSION is not defined as CUDA_VERSION but directly as a number.但是 - CUDART_VERSION未定义为CUDA_VERSION而是直接定义为数字。

Are they always supposed to have the exact same value, or are there circumstances in which they might differ?它们是否总是应该具有完全相同的值,或者在某些情况下它们可能不同?

They will be the same observationally, but not linked.它们在观察上是相同的,但没有联系。

As you already know at runtime , the CUDA version can be different than the CUDART version.正如您在运行时已经知道的那样,CUDA 版本可能与 CUDART 版本不同。 Therefore (or, insofar as that answer describes) there is no connection between the two.因此(或者,就该答案所描述的而言)两者之间没有联系。

However, both cuda.h and cuda_runtime_api.h will be installed by a CUDA installer.但是, cuda.hcuda_runtime_api.h都将由 CUDA 安装程序安装。 So with respect to what that installer installs, they will match.因此,就安装程序安装的内容而言,它们将匹配。 The installer installs both a driver and a development environment where the CUDA (driver API) version and CUDA runtime API version match.安装程序安装驱动程序和开发环境,其中 CUDA(驱动程序 API)版本和 CUDA 运行时 API 版本匹配。 But later on that can change (if you update the driver, for example.) That is to say, the runtime versions can change depending on subsequent install activity.但稍后可能会改变(例如,如果您更新驱动程序)。也就是说,运行时版本可能会根据后续安装活动而改变。 But the cuda.h installed by the CUDA toolkit installer and the cuda_runtime_api.h installed by the CUDA toolkit installer will remain what they were, as installed by the toolkit installer.但是cuda.h工具包安装程序安装的 cuda.h 和 CUDA 工具包安装程序安装的cuda_runtime_api.h将保持原样,由工具包安装程序安装。

cuda_runtime_api.h does not depend on cuda.h . cuda_runtime_api.h不依赖于cuda.h For that reason, one define is not simply a define of the other.出于这个原因,一个定义不仅仅是另一个的定义。 You can build CUDA runtime API applications that don't depend on cuda.h (the deviceQuery sample code is an example) and so there is no reason for cuda_runtime_api.h to build a define based on something in cuda.h - that would require you to always include cuda.h whenever you include cuda_runtime_api.h , and the CUDA designers had no intention of that.您可以构建 CUDA 运行时 API 不依赖于cuda.h的应用程序( deviceQuery示例代码是一个示例),因此cuda_runtime_api.h没有理由基于cuda.h中的内容构建定义 - 这需要每当你包含cuda_runtime_api.h时,你总是包含cuda.h ,而 CUDA 设计师无意这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM