Code Monkey home page Code Monkey logo

pyfftw's Introduction

https://travis-ci.org/hgomersall/pyFFTW.png?branch=master

PyFFTW

pyFFTW is a pythonic wrapper around FFTW 3, the speedy FFT library. The ultimate aim is to present a unified interface for all the possible transforms that FFTW can perform.

Both the complex DFT and the real DFT are supported, as well as on arbitrary axes of abitrary shaped and strided arrays, which makes it almost feature equivalent to standard and real FFT functions of numpy.fft (indeed, it supports the clongdouble dtype which numpy.fft does not).

Wisdom import and export now works fairly reliably.

Operating FFTW in multithreaded mode is supported.

pyFFTW implements the numpy and scipy fft interfaces in order for users to take advantage of the speed of FFTW with minimal code modifications.

A comprehensive unittest suite can be found with the source on the github repository or with the source distribution on PyPI.

The documentation can be found on github pages, the source is on github and the python package index page is here.

Requirements (i.e. what it was designed for)

  • Python 2.7 or greater (Python 3 is supported)
  • Numpy 1.6
  • FFTW 3.3 or higher (lower versions may work)
  • Cython 0.15 or higher (though the source release on PyPI loses this dependency)

(install these as much as possible with your preferred package manager).

Installation

We recommend not building from github, but using the release on the python package index with tools such as easy_install or pip:

pip install pyfftw

or:

easy_install pyfftw

Installers are on the PyPI page for both 32- and 64-bit Windows, which include all the necessary DLLs.

With FFTW installed, the PyPI release should install fine on Linux and Mac OSX. It doesn't mean it won't work anywhere else, just we don't have any information on it.

Read on if you do want to build from source...

Building

To build in place:

python setup.py build_ext --inplace

That cythons the python extension and builds it into a shared library which is placed in pyfftw/. The directory can then be treated as a python package.

After you've run setup.py with cython available, you then have a normal C extension in the pyfftw directory. Further building does not depend on cython (as long as the .c file remains).

For more ways of building and installing, see the distutils documentation

Platform specific build info

Windows

To build for windows from source, download the fftw dlls for your system and the header file from here (they're in a zip file) and place them in the pyfftw directory. The files are libfftw3-3.dll, libfftw3l-3.dll, libfftw3f-3.dll. If you're using a version of FFTW other than 3.3, it may be necessary to copy fftw3.h into include\win.

The builds on PyPI use mingw for the 32-bit release and the Windows SDK C++ compiler for the 64-bit release. The scripts should handle this automatically. If you want to compile for 64-bit Windows, you have to use the MS Visual C++ compiler. Set up your environment as described here and then run setup.py with the version of python you wish to target and a suitable build command.

For using the MS Visual C++ compiler, you'll need to create a set of suitable .lib files as described on the FFTW page.

Mac OSX

It has been suggested that FFTW should be installed from macports.

pyfftw's People

Contributors

hgomersall avatar rainwoodman avatar

Watchers

 avatar  avatar  avatar  avatar

pyfftw's Issues

Creating MPI plan fails for input_shape (11, 1) on 3 nodes.

Run the following code with mpirun -n 3

import numpy as np
import pyfftw

p = pyfftw.create_mpi_plan(input_shape=(11,1),
                           input_dtype=np.complex,
                           output_dtype=np.complex,
                           direction='FFTW_FORWARD',
                           flags=['FFTW_ESTIMATE'])

This raises

Traceback (most recent call last):
File "pyfftw_debugging.py", line 44, in
flags=['FFTW_ESTIMATE'])
File "pyfftw/mpi.pxi", line 922, in pyfftw.pyfftw.create_mpi_plan (/tmp/pyFFTW/pyfftw/pyfftw.c:21947)
File "pyfftw/mpi.pxi", line 1687, in pyfftw.pyfftw.FFTW_MPI.cinit (/tmp/pyFFTW/pyfftw/pyfftw.c:29076)
RuntimeErrorRuntimeError: The data configuration has an uncaught error that led to FFTW returning an invalid plan in MPI rank 1.Please report this as a bug.

Deprecation warning when accessing input_array of mpi plan

Accessing an input_array of a mpi plan creates a deprecation warning. The following code

import pyfftw
import numpy as np
p = pyfftw.create_mpi_plan(input_shape=(6,6), input_dtype=np.complex, output_dtype=np.complex, direction='FFTW_FORWARD')
p.input_array

returns
using a non-integer number instead of an integer will result in an error in the future

I was not able to debug this completely, but it could be that the array access here contains floats:
https://github.com/fredRos/pyFFTW/blob/mpi/pyfftw/mpi.pxi#L1269

Define `HAVE_MPI` if single precision missing

From https://www.travis-ci.com/s-sajid-ali/pyFFTW/builds/72827599

running build_ext
Build pyFFTW with support for FFTW with
double precision + pthreads
long precision + pthreads
cythoning /home/travis/build/s-sajid-ali/pyFFTW/pyfftw/pyfftw.pyx to /home/travis/build/s-sajid-ali/pyFFTW/pyfftw/pyfftw.c
Error compiling Cython file:
------------------------------------------------------------
...
        cdef void *plan = self._plan
        cdef fftw_generic_execute fftw_execute = self._fftw_execute
        with nogil:
            fftw_execute(plan, input_pointer, output_pointer)
IF HAVE_MPI:
  ^
------------------------------------------------------------

build with mpi

Check that both long and long_mpi libs exist to avoid link error at load time

pyfftw produces wrong results for array with shape (10, 1) on more than 2 nodes

The following code doesn't work for comm.size > 2

import numpy as np
from numpy.testing import assert_allclose
import pyfftw

p = pyfftw.create_mpi_plan(input_shape=(10,1),
                           input_dtype=np.complex,
                           output_dtype=np.complex,
                           direction='FFTW_FORWARD',
                           flags=['FFTW_ESTIMATE'])

p_inverse = pyfftw.create_mpi_plan(input_shape=(10,1),
                           input_dtype=np.complex,
                           output_dtype=np.complex,
                           direction='FFTW_BACKWARD',
                           flags=['FFTW_ESTIMATE'])

np.random.seed(16)
a = np.random.random(p.input_array.shape) + \
    np.random.random(p.input_array.shape)*1j

p.input_array[:] = a
p()
p_inverse.input_array[:] = p.output_array
p_inverse()
assert_allclose(p_inverse.output_array, a)

Intel MKL support

No single or long double precision supported by Intel. Check this online

Installing on an OS X operating system

Hi,

Does anybody have experience installing pyFFTW with mpi support on an OS X machine? If I try, it immediately throws an error, that the fttw3.h cannot be found. However the fftw3.h is within the directory of ./include/win/fftw3.h, so I don't see the reason why setup.py cannot find this file or am I missing something?

Cheers,

Daniel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.