更新时间:2023-11-10 16:47:52
非常宽泛的字词:
cuda.h
定义了CUDA cuda_runtime_api.h
定义 cuda_runtime.h
定义 cuda_runtime_api.h
键入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 everything cuda_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.