提取交错浮点数据
对于使用 cuda 的 cufft 库的任何人(或了解其知识的人)来说,从交错数据类型 cufftComplex 恢复数据的最有效方法是什么?
数据按如下方式添加到结构中:
cufftComplex SomeData;
/*...a loop...*/
SomeData[i].x=1.0f;
SomeData[i].y=0.0f;
因此,现在如果我将 &(SomeData[0].x&
转换为指向浮点数的指针,我的数据格式为“1 0 1 0 1” “因为 x/y 数据是交错的。我想正确键入它,以便得到“1 1 1 1”等。有没有办法在不使用循环并直接分配元素的情况下重新转换此类型?
感谢您提供任何信息正如我之前提到的,这是 CUDA sdk 的一部分。
For anybody using the cufft library from cuda (or somebody that knows their stuff)- what is the most efficient way to recover data from the interleaved data type cufftComplex?
Data is added to the structure as follows:
cufftComplex SomeData;
/*...a loop...*/
SomeData[i].x=1.0f;
SomeData[i].y=0.0f;
So now if I cast &(SomeData[0].x&
as a pointer to a float, I have data in the form "1 0 1 0 1 " Because the x/y data is interleaved. I want to correctly type it so that I get "1 1 1 1 " ect. Is there a way to recast this type without using a loop and directly assigning the elements?
Thanks for any info. As I previously mentioned this is part of the CUDA sdk.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能仅仅通过转换来做到这一点 - 底层数据是交错的,没有办法解决这个问题。如果您确实需要连续的数据流(例如纯实数数据),那么您将必须对数据进行去交错,您可以就地或异地执行此操作。
You can't do it just by casting - the underlying data is interleaved and there is no way around that. If you really do need a contiguous stream of e.g. real-only data then you will have to de-interleave the data, which you can do either in place or out-of-place.