[AstroPy] fftw3

Jens Melinder jens at astro.su.se
Fri Jun 24 13:21:09 EDT 2016


Hi Bruno,

I’m using this version of pyfftw:
https://github.com/pyFFTW/pyFFTW <https://github.com/pyFFTW/pyFFTW>
(There is another wrapper around as well, but that did not work for me). There are some problems building this inside a Ureka environment, but seems to be working fine in conda.

This is well documented and works really well for me. In my testing I found this wrapper something like 3-4 times faster than the scipy/numpy fftw implementations (running on a single core, I’ve never gotten the hyperthreading to work with any of the FFTW implementations).

The package also has a interfaces module that lets you use the pyfftw fftws inside a an astropy.convolution function call. Here is a code snippet from my code:

import pyfftw
from astropy.convolution import convolve_fft
fftn=pyfftw.interfaces.numpy_fft.fftn
ifftn=pyfftw.interfaces.numpy_fft.ifftn

def fftwn(*dat):
	return fftn(*dat,threads=1)

def ifftwn(*dat):
	return ifftn(*dat,threads=1)

def conv(ima,kernel):
    return convolve_fft(ima,kernel,boundary='wrap',fftn=fftwn,ifftn=ifftwn)

You may not need the fftwn and ifftwn functions, if I remember correctly I only created those to be able to test the hyperthreading.

Good luck!

Cheers,
Jens




> 24 jun 2016 kl. 17:17 skrev Bruno O. Sánchez <bruno.sanchez.63 at gmail.com>:
> 
> Hello guys,
> 
> I am an astronomer from Córdoba Argentina, and I work a lot with astropy. I have been working on proper coaddition of images with spatially variant PSF, and I am currently using the convolution from astropy and scipy.
> 
> I've encountered some perfomance issues, and noticed that there is some previous discussion on the settings of astropy.convolution.convolve fft engines.
> 
> I wonder if any of you have succeded in setting a fftw3 engine for convolution, and if you have a snippet for using it. The fftw3 planning stage confuses me, and I can't find a documentation on pyfftw3.
> 
> Any clues you can give me for this would be greatly appreciated!
> 
> Bruno SANCHEZ
> Observatorio Astronómico de Córdoba
> 
> 
> 
> -- 
> Bruno
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> https://mail.scipy.org/mailman/listinfo/astropy



-----------------------------------
Jens Melinder
Department of Astronomy
Stockholm University
jens at astro.su.se
+46 706471856




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20160624/df02cb70/attachment.html>


More information about the AstroPy mailing list