改善Python中的FFT性能

改善Python中的FFT性能

本文介绍了改善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.fft scikits.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.())

(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性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 12:31