Giter Site home page Giter Site logo

fjarri-attic / pyfft Goto Github PK

View Code? Open in Web Editor NEW
37.0 37.0 7.0 571 KB

FFT for PyCuda and PyOpenCL. The package is deprecated and its functionality is merged into Reikna.

Home Page: http://pypi.python.org/pypi/pyfft

License: Other

C 4.20% Python 95.80%

pyfft's People

Contributors

fjarri avatar inducer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pyfft's Issues

tigger or reikna ?

When installing pyfft from pipy, using pip, I have the following warning :

PyFFT is deprecated and will not be updated any more.
Its functionality is being moved to Tigger (http://tigger.publicfields.net)

Tigger is nowhere to be found, it should be replaced by Reinka in the message.

pycuda 0.94 requirement

It might be advisable to mention in the module docs that pycuda 0.94 is required by pyfft; some of the constructs invoked by pyfft don't exist in pycuda 0.93.

Failed to find block size for the kernel

Thanks for this useful tool. Works great! One small issue: the sample code in the documentation failed on my Macbook (OS X Lion) with the error above. The Apple OpenCL driver provides a choice of devices (CPU and GPU) with the default being the CPU device, and the Intel CPU does not support the block size in the sample code. I was able to solve this by changing the context definition line to:

ctx = cl.Context(dev_type=cl.device_type.GPU)

typenames module not found

The file cufft/pycuda_fft.py in pycudafft 0.2 attempts to import symbols from the typenames module. This module does not exist in Python 2.6; I had to patch the file to import from the types module.

pycudafft/kernel.mako not installed by setup.py

The file pycudafft/kernel.mako is not installed by default when one runs python setup.py install. Adding the following lines to the setup() call in setup.py would cause it to be installed:

    package_dir={'pycudafft': 'pycudafft'},
    package_data={'pycudafft': ['*.mako']},

pyfft on AMD

I experienced a problem that the generated kernel generate errors with AMD OpenCL, e.g. with line
float2 a[4] = {0,0,0,0,0,0,0,0}
I think this is invalid code, but happens to compile fine with NVidia OpenCL. I suggest replacing it with
float2 a[4] = {(float2)(0.0, 0.0), (float2)(0.0, 0.0), (float2)(0.0, 0.0), (float2)(0.0, 0.0)}

Here is a patch for kernel.make (relative to pyfft 0.3.6) that fixes this problem. With this patch pyfft passes al tests on Win7, AMD HD5850, (and still on OS X 10.6.8, Nvidia GT330M)

diff --git a/pyfft/kernel.mako b/pyfft/kernel.mako
index aca776f..9392b82 100644
--- a/pyfft/kernel.mako
+++ b/pyfft/kernel.mako
@@ -713,7 +713,8 @@

    ## need to fill a[] with zeros, because otherwise nvcc crashes
    ## (it considers a[] not initialized)
  •   ${complex} a[${temp_array_size}] = {${', '.join(['0'] \* temp_array_size \* 2)}};
    
  •   ##${complex} a[${temp_array_size}] = {${', '.join(['0'] \* temp_array_size \* 2)}};
    
  •    ${complex} a[${temp_array_size}] = {${', '.join(['(%s)(0.0f, 0.0f)'%complex] \* temp_array_size)}};  
    

pyfft does not work properly with PyOpenCL 2011.2

Following the example of http://packages.python.org/pyfft/, I tried a simple FFT with OpenCL (see below)
Note: pyFFT doesn't import with PyOpenCL 2011.2: reason: pyopencl has no attribute VERSION
(cl.py, line 8). I bypassed the issue by removing that check.

After that:

from pyfft.cl import Plan
import numpy
import pyopencl as cl
import pyopencl.array as cl_array
ctx = cl.create_some_context(interactive=False)
queue = cl.CommandQueue(ctx)
plan = Plan((16, 16), queue=queue)
data = numpy.ones((16, 16), dtype=numpy.complex64)
gpu_data = cl_array.to_device(ctx, queue, data)
print gpu_data
[[ 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j
1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j]
...
[ 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j
1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j]]
plan.execute(gpu_data.data)
<pyopencl._cl.CommandQueue object at ...>
result = gpu_data.get()
print result
[[ 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j
0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j
0.+0.j 0.+0.j]

What I expected:
[[ 256.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j
0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j
0.+0.j 0.+0.j] [ 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j
0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j
0.+0.j 0.+0.j]]

(A DC component equals to the sum of all the ones in the initial matrix)

import error in test.py

When I attempted to run test/test.py in pyfft-0.3 (after installing pyfft, of course), it failed with the following message:

Traceback (most recent call last):
File "test.py", line 6, in
from pyfft.cuda import plan as FFTPlan
ImportError: cannot import name plan

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.