cuda.h,cuda_runtime.h,cuda_runtime_api.h之间的区别 [英] Difference between cuda.h, cuda_runtime.h, cuda_runtime_api.h
问题描述
我开始使用CUDA编程,在一些例子中,我找到了包含文件 cuda.h
, cuda_runtime.h
和 cuda_runtime_api.h
。
I'm starting to program with CUDA, and in some examples I find the include files cuda.h
, cuda_runtime.h
and cuda_runtime_api.h
included in the code. Can someone explain to me the difference between these files?
推荐答案
非常宽泛的字词:
-
cuda.h
定义了CUDA
驱动程序API的公共主机
函数和类型。 -
cuda_runtime_api.h
定义
CUDA运行时API的public
主机函数和类型 -
cuda_runtime.h
定义cuda_runtime_api.h
键入
用于CUDA语言扩展和
设备固有函数的定义和函数覆盖。
cuda.h
defines the public host functions and types for the CUDA driver API.cuda_runtime_api.h
defines the public host functions and types for the CUDA runtime APIcuda_runtime.h
defines everythingcuda_runtime_api.h
does, as well as built-in type definitions and function overlays for the CUDA language extensions and device intrinsic functions.
主机代码要与包含API调用的主机编译器一起编译,您可以包括 cuda.h
或 cuda_runtime_api.h
。如果您需要其他CUDA语言内置函数(如类型),并且正在使用运行时API并使用主机编译器进行编译,则可以包括 cuda_runtime.h
。如果你编写的代码将使用nvcc编译,这一切都是无关紧要的,因为nvcc会自动处理所有需要的头文件,而无需程序员干预。
If you were writing host code to be compiled with the host compiler which includes API calls, you would include either cuda.h
or cuda_runtime_api.h
. If you needed other CUDA language built-ins, like types, and were using the runtime API and compiling with the host compiler, you would include cuda_runtime.h
. If you are writing code which will be compiled using nvcc, it is all irrelevant, because nvcc takes care of inclusion of all the required headers automatically without programmer intervention.
这篇关于cuda.h,cuda_runtime.h,cuda_runtime_api.h之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!