cuda.h,cuda_runtime.h,cuda_runtime_api.h之间的区别 [英] Difference between cuda.h, cuda_runtime.h, cuda_runtime_api.h

查看:4579
本文介绍了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 API
  • cuda_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.

这篇关于cuda.h,cuda_runtime.h,cuda_runtime_api.h之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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