关于CUDA不使用cufft库编写FFT代码

因为自己对cuda不熟悉,但是项目需求要并发计算FFT,所以总结下来,自己最近查的有效资料

  1. 作为数学生,刚开始不太理解从时域到频域的转换,看了这篇文章后理解了,文章链接戳这里,同时对于转换前后信号的对应关系,可以参考这篇
  2. 刚开始在cpu上实现FFT,可以参考这两篇文章,12,但是这两篇文章对于输入数据都是用的数组,后来查找发现用复数域的库更方便,我就把输入数据改成用复数库了。FFT的公式推导啥的没有特别找文章看,在找资料的时候随便看了看就理解公式怎么来的了。
  3. 开始在GPU上写FFT代码了,先是文章1。计算完成以后发现速度很慢,根本就没有并行计算的优势,又找了文章2,这篇文章用的CUDA的自带的库cufft,我没有在自己电脑上跑,同事跑了,比上面那篇文章快很多。然后我不理解为什么文章1这么慢,就又开始找,找到了文章3,这篇文章的源码会报错,自己需要改一改,但是很简单,这个就跑的很快了,但是我没有和CUDA自带的cufft库进行比较,我觉得肯定cufft更快的。这篇文章里面用了三个核函数,前两个核函数是用来做输入数据的逆转的,最后一个核函数里面才是进行蝶形运算的。文章1是在一个核函数里面进行两个for循环,我怀疑就是这样,让速度变慢的。但是文章3的计算结果大部分值是对的,有小部分值有问题,我没有找到原因(估计是我CUDA没有学好的原因),希望和我有同样需求的小伙伴一起交流讨论。我准备放一放FFT了,我要开始学cmake了。
  • 8
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
This document describes CUFFT, the NVIDIA® CUDA™ Fast Fourier Transform (FFT) library. The FFT is a divide-and-conquer algorithm for efficiently computing discrete Fourier transforms of complex or real-valued data sets. It is one of the most important and widely used numerical algorithms in computational physics and general signal processing. The CUFFT library provides a simple interface for computing parallel FFTs on an NVIDIA GPU, which allows users to leverage the floating-point power and parallelism of the GPU without having to develop a custom, CUDA FFT implementation. FFT libraries typically vary in terms of supported transform sizes and data types. For example, some libraries only implement radix-2 FFTs, restricting the transform size to a power of two. The CUFFT Library aims to support a wide range of FFT options efficiently on NVIDIA GPUs. This version of the CUFFT library supports the following features: I Complex and real-valued input and output I 1D, 2D, and 3D transforms I Batch execution for doing multiple transforms of any dimension in parallel I Transform sizes up to 64 million elements in single precision and up to 128 million elements in double precision in any dimension, limited by the available GPU memory I In-place and out-of-place transforms I Double-precision (64-bit floating point) on compatible hardware (sm1.3 and later) I Support for streamed execution, enabling asynchronous computation and data movement I FFTW compatible data layouts I Arbitrary intra- and inter-dimension element strides I Thread-safe API that can be called from multiple independent host threads
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值