如何在.cpp文件中使用Cuda数据结构 [英] How to use Cuda data structures in .cpp files

查看:125
本文介绍了如何在.cpp文件中使用Cuda数据结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在.cpp文件中使用Cuda定义的数据结构,如float3,float4,dim3等?



解决方案

是的能够。只需 #includevector_types.h(确保CUDA include目录在您的 -I 路径)。我认为此代码示例演示了它(不是你真的需要



另外,一些CUDA SDK代码示例包括一个名为vector_math.h的头文件,它定义了多个运算符,*,dot等)。这将是在SDK common / include目录,我相信(注意,这不是一个标准,支持的一部分CUDA - 它是一个代码示例,你可以自己写)。


Is it possible to use the Cuda-defined data structures, such as float3, float4, dim3 etc. in a .cpp file?

How would you go about achieving this if it is possible?

Thanks

解决方案

Yes you can. Just #include "vector_types.h" (make sure the CUDA include directory is in your -I path). I think this code sample demonstrates it (not that you really need an example for something this simple).

Also, some of the CUDA SDK code samples include a header called "vector_math.h", which defines a number of operators (+, *, dot, etc.) for the vector types. That would be in the SDK common/include directory, I believe (note that this is not a standard, supported part of CUDA -- it's an example of code you could write yourself).

这篇关于如何在.cpp文件中使用Cuda数据结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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