本文介绍了提高 Python 中的 FFT 性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Python 中最快的 FFT 实现是什么?

What is the fastest FFT implementation in Python?

numpy.fft 和 scipy.fftpack 似乎都基于 fftpack,而不是 FFTW.fftpack 和 FFTW 一样快吗?使用多线程 FFT 还是使用分布式 (MPI) FFT 怎么样?

It seems numpy.fft and scipy.fftpack both are based on fftpack, and not FFTW. Is fftpack as fast as FFTW? What about using multithreaded FFT, or using distributed (MPI) FFT?

推荐答案

您当然可以使用 Cython 或其他允许您访问外部库的类似工具来包装您想要测试的任何 FFT 实现.

You could certainly wrap whatever FFT implementation that you wanted to test using Cython or other like-minded tools that allow you to access external libraries.

如果您要测试 FFT 实现,您还可以查看基于 GPU 的代码(如果您可以访问适当的硬件).有几个:reikna.fftscikits.cuda.

If you're going to test FFT implementations, you might also take a look at GPU-based codes (if you have access to the proper hardware). There are several: reikna.fft, scikits.cuda.

还有一个基于 CPU 的 python FFTW 包装器 pyFFTW.

There's also a CPU based python FFTW wrapper pyFFTW.

(也有 pyFFTW3,但它不像 pyFFTW 那样积极维护,并且它不适用于 Python3.(source))

(There is pyFFTW3 as well, but it is not so actively maintained as pyFFTW, and it does not work with Python3. (source))

我对这些都没有经验.如果速度对您很重要,那么您可能需要为您的特定应用程序进行一些挖掘和基准测试.

I don't have experience with any of these. It's probably going to fall to you to do some digging around and benchmark different codes for your particular application if speed is important to you.

这篇关于提高 Python 中的 FFT 性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 10:34
查看更多