Giter VIP home page Giter VIP logo

gpyfft's Introduction

gpyfft

A Python wrapper for the OpenCL FFT library clFFT.

Introduction

clFFT

The open source library clFFT implements FFT for running on a GPU via OpenCL. Some highlights are:

  • batched 1D, 2D, and 3D transforms
  • supports many transform sizes (any combinatation of powers of 2,3,5,7,11, and 13)
  • flexible memory layout
  • single and double precisions
  • complex and real-to-complex transforms
  • supports injecting custom code for data pre- and post-processing

gpyfft

This python wrapper is designed to tightly integrate with PyOpenCL. It consists of a low-level Cython based wrapper with an interface similar to the underlying C library. On top of that it offers a high-level interface designed to work on data contained in instances of pyopencl.array.Array, a numpy work-alike array class for GPU computations. The high-level interface takes some inspiration from pyFFTW. For details of the high-level interface see fft.py.

News

  • 2017/11/05 for 2D and 3D transforms with default (empty) settings for the transform axes, now a more clever ordering of the transform axes is chosen, depending on the memory layout: last axis is transformed first for a C contiguous input array. I have seen huge performance improvements, 3x to 4x compared to the previous approach (always first axis first). Please report back benchmark results ('python -m gpyfft.benchmark') if this holds true for your GPU.

Status

The low lever interface is complete (more or less), the high-level interface is not yet settled and likely to change in future. Features to come (not yet implemented in the high-level interface):

work done

  • low level wrapper (mostly) completed
  • high level wrapper
  • complex-to-complex transform, in- and out-of-place
  • real-to-complex transform (out-of-place)
  • complex-to-real transform (out-of-place)
  • single precision
  • double precision
  • interleaved data
  • support injecting custom OpenCL code (pre and post callbacks)
  • accept pyopencl arrays with non-zero offsets (Syam Gadde)
  • heuristics for optimal performance for choosing order axes transform if none given (Release 0.7.1)

Basic usage

Here we describe a simple example of performing a batch of 2D complex-to-complex FFT transforms on the GPU, using the high-level interface of gpyfft. The full source code of this example ist contained in simple_example.py, which is the essence of benchmark.py. Note, for testing it is recommended to start simple_example.py from the command line, so you have the possibility to interactively choose an OpenCL context (otherwise, e.g. when using an IPython, you are not asked end might end up with a CPU device, which is prone to fail).

imports:

import numpy as np
import pyopencl as cl
import pyopencl.array as cla
from gpyfft.fft import FFT

initialize GPU:

context = cl.create_some_context()
queue = cl.CommandQueue(context)

initialize memory (on host and GPU). In this example we want to perform in parallel four 2D FFTs for 1024x1024 single precision data.

data_host = np.zeros((4, 1024, 1024), dtype = np.complex64)
#data_host[:] = some_useful_data
data_gpu = cla.to_device(queue, data_host)

create FFT transform plan for batched inline 2D transform along second two axes.

transform = FFT(context, queue, data_gpu, axes = (2, 1))

If you want an out-of-place transform, provide the output array as additional argument after the input data.

Start the work and wait until it is finished (Note that enqueu() returns a tuple of events)

event, = transform.enqueue()
event.wait()

Read back the data from the GPU to the host

result_host = data_gpu.get()

Benchmark

A simple benchmark is contained as a submodule, you can run it on the command line by python -m gpyfft.benchmark, or from Python

import gpyfft.benchmark
gpyfft.benchmark.run()

Note, you might want to set the PYOPENCL_CTX environment variable to select your OpenCL platform and device.

gpyfft's People

Contributors

cmey avatar geggo avatar gjacquenot avatar kbrafford avatar kif avatar nevsan avatar rainwoodman avatar vincefn 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gpyfft's Issues

Complains about _clfftBakePlan not found when importing

Trying to install gpyfft on a new Mac Mini M1.

Successfully built and compiled sources

python setup.py build
python setup.py install

with no errors.

When importing in python, I get:

In [1]: import gpyfft
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-3687f3cada1c> in <module>
----> 1 import gpyfft

~/Downloads/gpyfft-master/gpyfft/__init__.py in <module>
      4 
      5 from .version import __version__
----> 6 from .gpyfftlib import GpyFFT, GpyFFT_Error, Plan
      7 from .fft import *

ImportError: dlopen(/Users/wyselight/Downloads/gpyfft-master/gpyfft/gpyfftlib.cpython-38-darwin.so, 2): Symbol not found: _clfftBakePlan
  Referenced from: /Users/wyselight/Downloads/gpyfft-master/gpyfft/gpyfftlib.cpython-38-darwin.so
  Expected in: flat namespace
 in /Users/wyselight/Downloads/gpyfft-master/gpyfft/gpyfftlib.cpython-38-darwin.so

Any idea ?

[discussion] Moving to rst for docs

Gregor,
I am not sure how to create discussions, so I'll try an "issue" and see how that goes.

What's your plan wrt rst documentation? Would you like me to add a sphinx document to the repository, and start adding docstrings to the classes that get pulled into the formal docs?

--Keith

Benchmark fails to run on ARM Mali platform

I have just installed gpyfft on my ODROID-XU4 and encountered this issue when I attempted to run the benchmark. I believe it may be a quirk of the ARM Platform implementation of OpenCL as I've encountered similar issues with casting when I have used Reikna on the same device. Below is the output from python when I attempt to run the benchmark.

Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gpyfft.benchmark
>>> gpyfft.benchmark.run()
Choose platform:
[0] <pyopencl.Platform 'ARM Platform' at 0x-4aea32d8>
[1] <pyopencl.Platform 'Portable Computing Language' at 0x-4bf3effc>
Choice [0]:0
Choose device(s):
[0] <pyopencl.Device 'Mali-T628' on 'ARM Platform' at 0x-4aed4f40>
[1] <pyopencl.Device 'Mali-T628' on 'ARM Platform' at 0x-4aed4de8>
Choice, comma-separated [0]:0
Set the environment variable PYOPENCL_CTX='0:0' to avoid being asked again.
out of place transforms (1024, 1024) complex64
axes         in out

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                ^

<source>:2036:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

<source>:2046:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                 ^

<source>:2066:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed
(-2, -1)     C   C 'INVALID_PROGRAM'
 0.00ms   0.00 Gflops
(-2, -1)     C   F  7.5e-04 80.18ms   1.31 Gflops

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                ^

<source>:2036:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

<source>:2046:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                 ^

<source>:2066:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed
(-2, -1)     F   C 'INVALID_PROGRAM'
 0.00ms   0.00 Gflops

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                ^

<source>:2036:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

<source>:2046:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                 ^

<source>:2066:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global float2 * restrict gb)
                                                ^

<source>:2042:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global float2 * restrict gb)
                                                 ^

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed
(-2, -1)     F   F 'INVALID_PROGRAM'
 0.00ms   0.00 Gflops

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                ^

<source>:2036:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

<source>:2046:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                 ^

<source>:2066:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global float2 * restrict gb)
                                                ^

<source>:2042:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global float2 * restrict gb)
                                                 ^

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed
(-1, -2)     C   C 'INVALID_PROGRAM'
 0.00ms   0.00 Gflops

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                ^

<source>:2036:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

<source>:2046:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                 ^

<source>:2066:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed
(-1, -2)     C   F 'INVALID_PROGRAM'
 0.00ms   0.00 Gflops
(-1, -2)     F   C  7.5e-04 78.19ms   1.34 Gflops

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                ^

<source>:2036:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

<source>:2046:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                 ^

<source>:2066:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed
(-1, -2)     F   F 'INVALID_PROGRAM'
 0.00ms   0.00 Gflops

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                ^

<source>:2036:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

<source>:2046:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                 ^

<source>:2066:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global float2 * restrict gb)
                                                ^

<source>:2042:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global float2 * restrict gb)
                                                 ^

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed
None         C   C 'INVALID_PROGRAM'
 0.00ms   0.00 Gflops

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                ^

<source>:2036:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

<source>:2046:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                 ^

<source>:2066:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed
None         C   F 'INVALID_PROGRAM'
 0.00ms   0.00 Gflops

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                ^

<source>:2036:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

<source>:2046:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                 ^

<source>:2066:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed
None         F   C 'INVALID_PROGRAM'
 0.00ms   0.00 Gflops

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                ^

<source>:2036:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

<source>:2046:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                 ^

<source>:2066:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global float2 * restrict gb)
                                                ^

<source>:2042:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global float2 * restrict gb)
                                                 ^

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed
None         F   F 'INVALID_PROGRAM'
 0.00ms   0.00 Gflops
in place transforms (1024, 1024) complex64

                        BUILD LOG
************************************************
<source>:1580:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2003:19: error: initializing '__global float4 *' with an expression of incompatible type '__global float2 *'
        __global float4 *buff4g = bufOut;
                         ^        ~~~~~~

<source>:2016:49: warning: unknown attribute 'max_constant_size' ignored
void fft_fwd(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                ^

<source>:2036:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

<source>:2046:50: warning: unknown attribute 'max_constant_size' ignored
void fft_back(__constant cb_t *cb __attribute__((max_constant_size(32))), __global const float2 * restrict gbIn, __global float2 * restrict gbOut)
                                                 ^

<source>:2066:8: warning: assigning to '__global float2 *' from 'const __global float2 *' discards qualifiers
        lwbIn = gbIn + iOffset;
              ^ ~~~~~~~~~~~~~~

error: Compiler frontend failed (error code 59)

************************************************
FFTGeneratedStockhamAction::compileKernels failed
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/odroid/Share/ResearchProject/gpyfft/gpyfft/gpyfft/benchmark.py", line 100, in run
    events = transform.enqueue()
  File "/home/odroid/Share/ResearchProject/gpyfft/gpyfft/gpyfft/fft.py", line 189, in enqueue
    return self.enqueue_arrays(forward=forward, data=self.data, result=self.result, wait_for_events=wait_for_events)
  File "/home/odroid/Share/ResearchProject/gpyfft/gpyfft/gpyfft/fft.py", line 221, in enqueue_arrays
    direction_forward = forward, temp_buffer = self.temp_buffer, wait_for_events = wait_for_events)
  File "gpyfft/gpyfftlib.pyx", line 621, in gpyfft.gpyfftlib.Plan.enqueue_transform
    errcheck(clfftEnqueueTransform(self.plan,
  File "gpyfft/gpyfftlib.pyx", line 55, in gpyfft.gpyfftlib.errcheck
    raise GpyFFT_Error(result)
gpyfft.gpyfftlib.GpyFFT_Error: 'INVALID_PROGRAM'

Cannot open include file: 'clFFT.h'

I'm currently trying to build this package in Windows 10, and getting the following error message:

gpyfft\gpyfftlib.cpp(642): fatal error C1083: Cannot open include file: 'clFFT.h': No such file or directory

I've searched the entire clFFT directory but found no files named clFFT.h. I built the clFFT package with CMake, and followed the instructions closely, though I didn't include any of the optional dependencies (FFTW, etc). Overall, it looks like the clFFT directory expected by setup.py is not the same as the directory that was built on my machine.

As a sidenote, I did make a few minor changes to setup.py so that it could find my clFFT .dll files and my openCL SDK (Intel instead of AMD). As far as I can tell, that shouldn't have affected this issue, but it might be worth noting just in case.

can't find libclFFT.so.2

Hi there,

I'm on Linux Mint 17.2 with fglrx as OpenCL platform. I installed gpyfft using prebuilt binaries from https://github.com/clMathLibraries/clFFT/releases. Gpyfft wouldn't find libclFFT.so.2. So I created a file called libclFFT.so.2.conf in ld.so.conf.d with the proper path to libclFFT.so.2. That did the trick when installing pyopencl_blas. Still won't work...
Anyone willing to help a newbie?

callback argument for the FFT class

Hi,

Is there an example for performing the callback using the FFT high-level interface ? Do I give pass the argument to the FFT high level callback as a part of the dict only ? If yes, what keyword does it look for there ?

Secondly, in a callback function, how to access a 2D array ?

Please guide !
sincerely,

Mugundhan

ubuntu install fails on import

I get the following error after installation then import of the gpyfft module:
ImportError: /home/amorgan/.local/lib/python2.7/site-packages/gpyfft-0.2.2-py2.7-linux-x86_64.egg/gpyfft/gpyfftlib.so: undefined symbol: clfftSetPlanCallback

Details:

I am trying to get gpyfft fired up on a gpu cluster for work (running under linux sl6). To this end I am testing at home under Ubuntu with a Haswell HD GPU installing as a 'user' with no root privileges. Anyway:
I downloaded the clFFT prebuilt binaries at /home/amorgan/Physics/2016/pyopencl/clFFT-Full-2.10.0-Linux-x64/
$ git clone https://github.com/geggo/gpyfft.git $ cd gpyfft $ export LDFLAGS="-L/home/amorgan/Physics/2016/pyopencl/clFFT-Full-2.10.0-Linux-x64/lib64 "
Then I set:
CLFFT_DIR = r'/home/amorgan/Physics/2016/pyopencl/clFFT-Full-2.10.0-Linux-x64' CL_INCL_DIRS = ['/home/amorgan/Physics/2016/pyopencl/clFFT-Full-2.10.0-Linux-x64/include']
in setup.py.
$ python setup.py build
This works with a single warning:
/home/amorgan/Physics/2016/pyopencl/clFFT-Full-2.10.0-Linux-x64/include/clFFT.h:257:2: warning: function declaration isn’t a prototype [-Wstrict-prototypes] CLFFTAPI clfftStatus clfftTeardown( );
Instillation works with no warnings:
$ python setup.py install --user $ cd ~ $ ipython

In [1]: import gpyfft

ImportError Traceback (most recent call last)
in ()
----> 1 import gpyfft

/home/amorgan/.local/lib/python2.7/site-packages/gpyfft-0.2.2-py2.7-linux->x86_64.egg/gpyfft/init.py in ()
8 raise RuntimeError("Do NOT use gpyfft from its sources: build it and use the built version")
9
---> 10 from .gpyfftlib import GpyFFT, GpyFFT_Error, Plan
11 from .fft import *

ImportError: /home/amorgan/.local/lib/python2.7/site-packages/gpyfft-0.2.2-py2.7-linux-x86_64.egg/gpyfft/gpyfftlib.so: undefined symbol: clfftSetPlanCallback

Windows 10 - errors in test_simple.py

Hello,
I'm using Visual Studio 2015, Python 3.5(Anaconda) and Windows 10 (64-bit).
gpyfft seems to build and install correctly but running simple_test.py reveals some errors.

This is the output upon running gpyfft.test.run():

ERROR: test_simple (gpyfft.test.test_simple.TestSimple)

Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\gpyfft-0.2.2-py3.5-win-amd64.egg\gpyfft\test\test_simple.py", line 28, in test_simple
self.simple(ctx)
File "C:\Anaconda3\lib\site-packages\gpyfft-0.2.2-py3.5-win-amd64.egg\gpyfft\test\test_simple.py", line 46, in simple
plan = self.G.create_plan(context, cl_data.shape)
File "gpyfft\gpyfftlib.pyx", line 117, in gpyfft.gpyfftlib.GpyFFT.create_plan (gpyfft\gpyfftlib.c:2441)
File "gpyfft\gpyfftlib.pyx", line 186, in gpyfft.gpyfftlib.Plan.init (gpyfft\gpyfftlib.c:2751)
OverflowError: Python int too large to convert to C long

Any assistance would be greatly appreciated.

Batch FFT Settings

I have a 3D data set that is formatted such that the fastest dimension is 1024 complex numbers single precision, the second fastest dimension is 256 and the third fastest is 13. I would like to run a batch of FFTs over the the 2nd dimension (size 256).
That would be a total of 1024*13 256-point FFTs.

If this were written in MATLAB it would be: fft(array,[],2); where size(array) is 1024 256 13

My question is how do I set this FFT operation up on gpyfft? It seems the FFT class might not be rich enough for this type of batch operation: https://github.com/geggo/gpyfft/blob/master/gpyfft/fft.py#L12

gpyfft working on macOS 10.11.6, but not for CPU

I got clFFT and gpyfft to build on my MacBook Pro. When running the benchmark, I noticed two things:

First, I assumed I could specify multiple devices to the OpenCL interface (which may have been incorrect) but I get a hard crash:

In [3]: gpyfft.benchmark.run()
Choose platform:
[0] <pyopencl.Platform 'Apple' at 0x7fff0000>
Choice [0]:
Choose device(s):
[0] <pyopencl.Device 'Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz' on 'Apple' at 0xffffffff>
[1] <pyopencl.Device 'Iris Pro' on 'Apple' at 0x1024500>
[2] <pyopencl.Device 'AMD Radeon R9 M370X Compute Engine' on 'Apple' at 0x1021c00>
Choice, comma-separated [0]:0,1,2
Set the environment variable PYOPENCL_CTX=':0,1,2' to avoid being asked again.
out of place transforms (4, 1024, 1024)
axes         in out
Trace/BPT trap: 5

Second, I can run the benchmarks individually on the Iris Pro and the Radeon (hooray!) but get an error when trying to run on the CPU:

In [2]: gpyfft.benchmark.run()
Choose platform:
[0] <pyopencl.Platform 'Apple' at 0x7fff0000>
Choice [0]:
Choose device(s):
[0] <pyopencl.Device 'Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz' on 'Apple' at 0xffffffff>
[1] <pyopencl.Device 'Iris Pro' on 'Apple' at 0x1024500>
[2] <pyopencl.Device 'AMD Radeon R9 M370X Compute Engine' on 'Apple' at 0x1021c00>
Choice, comma-separated [0]:0
Set the environment variable PYOPENCL_CTX=':0' to avoid being asked again.
out of place transforms (4, 1024, 1024)
axes         in out
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'
'INVALID_WORK_GROUP_SIZE'

in place transforms (4, 1024, 1024)
---------------------------------------------------------------------------
GpyFFT_Error                              Traceback (most recent call last)
<ipython-input-2-6ac2a5c11489> in <module>()
----> 1 gpyfft.benchmark.run()

/Users/jlong/homebrew/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gpyfft-0.2.2-py2.7-macosx-10.11-x86_64.egg/gpyfft/benchmark.pyc in run()
     85             tic = timeit.default_timer()
     86             for i in range(n_run):  # inplace transform fails for n_run > 1
---> 87                 events = transform.enqueue()
     88             for e in events:
     89                     e.wait()

/Users/jlong/homebrew/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gpyfft-0.2.2-py2.7-macosx-10.11-x86_64.egg/gpyfft/fft.pyc in enqueue(self, forward)
    106         else:
    107             events = self.plan.enqueue_transform((self.queue,), (self.data.data,),
--> 108                                         direction_forward = forward, temp_buffer = self.temp_buffer)
    109         return events
    110

gpyfft/gpyfftlib.pyx in gpyfft.gpyfftlib.Plan.enqueue_transform (gpyfft/gpyfftlib.c:7278)()

gpyfft/gpyfftlib.pyx in gpyfft.gpyfftlib.errcheck (gpyfft/gpyfftlib.c:2030)()

GpyFFT_Error: 'INVALID_WORK_GROUP_SIZE'

Module license

Can you reconsider the project's licensing? GPL isn't approved for a lot of commercial projects, whereas the MIT and LGPL licenses are.

Also I think we will increase the odds of AMD pointing people to the project if we make it friendly for use in commercial and non-commercial applications.

Batched FFT buggy

This issue is to remind me that the code for batched FFTs is still buggy.
clFFT supports only batching along a single non-transform axis, but in some cases it is possible to collapse several non-transform axes.

gpyfft might fail to properly collapse

  • if array contains dimensions of size 1: strides are non-increasing, sorting is ambiguous
  • batched 2d transforms: depending on memory layout, transformed array might get transposed

starting a QtGui app kills gpyfft

Thanks for the repository! In general it works great. I just found out one weird issue, though. If I create a transform plan after I created a QT application (it does not matter wether you take pyside of pyqt4), gpyfft fails with a horrible message. Please see the minimal working example below. Do you have any idea how to fix this?

Code

# from PyQt4 import QtGui
from PySide import QtGui  # it does not matter which backend we choose
import sys
import numpy as np
import gpyfft
import pyopencl.array as cl_array
import pyopencl as cl

ctx = cl.create_some_context(interactive=False)
queue = cl.CommandQueue(ctx)

# numpy data
np_data = np.random.rand(64, 64)
gpu_data = cl_array.to_device(queue, np_data)

print "Initializing transform before creating QT app"
transform = gpyfft.fft.FFT(ctx, queue, [gpu_data])

# creating a QT gui application
app = QtGui.QApplication(sys.argv)

print "Initializing the same transform after creating QT app"
np_data = np.random.rand(64, 64)
gpu_data = cl_array.to_device(queue, np_data)
transform = gpyfft.fft.FFT(ctx, queue, [gpu_data])
print "Successful"

print "Initializing a new with a different shape after creating QT app"
np_data = np.random.rand(64, 128)
gpu_data = cl_array.to_device(queue, np_data)
transform = gpyfft.fft.FFT(ctx, queue, [gpu_data])  # FAILS

last part of the error message:

        ^
<kernel>:80:47: error: invalid digit 'f' in decimal constant
(float2)(-0,9807852804032304305792422383092344f,     -0,1950903220161286089062713244857150f),
                                          ^
<kernel>:81:47: error: invalid digit 'f' in decimal constant
(float2)(-0,2902846772544632747425907837168779f, 0,9569403357322086023373231000732630f),
                                          ^
<kernel>:541:8: warning: assigning to '__global float2     *__attribute__((address_space(16776963)))' from 'const __global float2 *' discards qualifiers
    lwbIn = gbIn + iOffset;
          ^ ~~~~~~~~~~~~~~
<kernel>:570:8: warning: assigning to '__global float2  *__attribute__((address_space(16776963)))' from 'const __global float2 *' discards qualifiers
    lwbIn = gbIn + iOffset;
          ^ ~~~~~~~~~~~~~~

************************************************
Traceback (most recent call last):
   File "minimal_error.py", line 32, in <module>
 transform = gpyfft.fft.FFT(ctx, queue, [gpu_data])  # FAILS
 File "/home/dbs660/research_subjects/fresnel_imaging/dev/gpyfft/gpyfft/fft.py", line 51, in __init__
 plan.bake(self.queue)
 File "gpyfftlib.pyx", line 415, in gpyfft.gpyfftlib.Plan.bake (gpyfft/gpyfftlib.c:5008)
 File "gpyfftlib.pyx", line 47, in gpyfft.gpyfftlib.errcheck (gpyfft/gpyfftlib.c:1522)
 gpyfft.gpyfftlib.GpyFFT_Error: 'BUILD_PROGRAM_FAILURE'

could you integrate the benchmark in the gpyfft module

It would be really nice to be able to have this

python -m gpyfft.benchmark

This should allow peoples to test there implementation of opencl.

this should parse something on the command line in order to select the device and other goodies.

thanks

Build error in Windows

I see this error when I run python setup.py install. Looks like it cannot locate MS Visual Studio 2013 installed in the machine asking to install an older version. Is this necessary although I have already MS VS 2013 installed?

C:\Users\butterfly\Documents\GitHub\gpyfft>python setup.py install
copied clFFT.dll, StatTimer.dll
running install
running bdist_egg
running egg_info
writing Gpyfft.egg-info\PKG-INFO
writing top-level names to Gpyfft.egg-info\top_level.txt
writing dependency_links to Gpyfft.egg-info\dependency_links.txt
reading manifest file 'Gpyfft.egg-info\SOURCES.txt'
writing manifest file 'Gpyfft.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
copying gpyfft\clFFT.dll -> build\lib.win-amd64-2.7\gpyfft
copying gpyfft\StatTimer.dll -> build\lib.win-amd64-2.7\gpyfft
running build_ext
building 'gpyfft.gpyfftlib' extension
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get
it from http://aka.ms/vcpython27

No examples in documentation

I think the documentation could really do with some examples on how to actually use the library and what best practice is.

Thanks,

Matt

gpyfft not cythonizing with cython-0.20

gpyfftlib.pyx is not correctly cythonizing since cython version 0.20 and gives an error. The variable 'ndim' is not correctly typed apparently.

The following seemed to work for me:

cdef clfftDim ndim = <clfftDim> len(shape)

Cheers,
Gydo

gpyfft not working with pyopencl2013.2+

Hey Greggor,

Thanks for the wrapper. However its not working with pyopencl2013.2+. The Context.obj_ptr has been changed to Context.int_ptr. I have changed it in my fork and it seems to work.

Cheers,
Gydo

ImportError: DLL load failed

Hi
I managed (painfully) to have

pip install .

compile the whole thing without error, on Windows 10 with the latest Microsoft Build Tools. But importing gpyfft in python 3.7.6 raises the following error:

import gpyfft
Traceback (most recent call last):

  File "<ipython-input-2-3687f3cada1c>", line 1, in <module>
    import gpyfft

  File "C:\Users\Yves\Anaconda3\lib\site-packages\gpyfft\__init__.py", line 6, in <module>
    from .gpyfftlib import GpyFFT, GpyFFT_Error, Plan

ImportError: DLL load failed: La procédure spécifiée est introuvable.

(the specified procedure could not be found). Any idea of what could be happening?

[doc] errors during the sphinx doc generation

Hello, I put here the errors reported during the build process with sphinx

make[1]: Entering directory '/<<PKGBUILDDIR>>'
PYBUILD_SYSTEM=custom \
PYBUILD_BUILD_ARGS="cd docs && PYTHONPATH={build_dir} http_proxy='127.0.0.1:9' {interpreter} -m sphinx -N -bhtml source build/html" dh_auto_build  # HTML generator
I: pybuild base:184: cd docs && PYTHONPATH=/<<PKGBUILDDIR>>/.pybuild/pythonX.Y_2.7/build http_proxy='127.0.0.1:9' python2.7 -m sphinx -N -bhtml source build/html
Running Sphinx v1.4.9
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 7 source files that are out of date
updating environment: 7 added, 0 changed, 0 removed
reading sources... [ 14%] building
reading sources... [ 28%] code
reading sources... [ 42%] gpyfft
reading sources... [ 57%] gpyfft_error
reading sources... [ 71%] includeme
reading sources... [ 85%] index
reading sources... [100%] plan

/<<PKGBUILDDIR>>/docs/source/gpyfft.rst:4: WARNING: missing attribute foo1 in object gpyfft.GpyFFT
/<<PKGBUILDDIR>>/docs/source/gpyfft.rst:4: WARNING: missing attribute fn_with_sphinxy_docstring in object gpyfft.GpyFFT
docstring of gpyfft.GpyFFT:9: ERROR: Unknown directive type "autosummary".

.. autosummary::
   :toctree:

   create_plan
   get_version
docstring of gpyfft.GpyFFT.create_plan:25: WARNING: Block quote ends without a blank line; unexpected unindent.
docstring of gpyfft.GpyFFT_Error:9: ERROR: Unknown directive type "autosummary".

.. autosummary::
   :toctree:

   args
   message
/<<PKGBUILDDIR>>/docs/source/includeme.rst:1: SEVERE: Problems with "include" directive path:
InputError: [Errno 2] No such file or directory: '../README.rst'.
/<<PKGBUILDDIR>>/docs/source/plan.rst:4: WARNING: missing attribute get_dim in object gpyfft.Plan
docstring of gpyfft.Plan:28: ERROR: Unknown directive type "autosummary".

.. autosummary::
   :toctree:

   batch_size
   distances
   inplace
   layouts
   precision
   scale_backward
   scale_forward
   shape
   strides_in
   strides_out
   temp_array_size
   transpose_result
docstring of gpyfft.Plan:46: ERROR: Unknown directive type "autosummary".

.. autosummary::
   :toctree:

   bake
   enqueue_transform
   set_callback
docstring of gpyfft.Plan.__init__:28: WARNING: Block quote ends without a blank line; unexpected unindent.
looking for now-outdated files... none found

Cython errors in setup.py on Ubuntu

I'm on Ubuntu 16.04, with clFFT installed from source.

I modified setup.py in the following way:
CLFFT_DIR = r'/home/user/clFFT'
CLFFT_LIB_DIR = r'/usr/local/lib64'
CLFFT_INCL_DIRS = [os.path.join(CLFFT_DIR, 'src', 'include'), ]
CL_INCL_DIRS = ['/usr/include/CL']

This is where my libraries and sources and includes and headers are on my system. When setup.py goes to Cythonize the extension, however, the following errors occur:

~/gpyfft$ python setup.py install
Compiling gpyfft/gpyfftlib.pyx because it changed.
[1/1] Cythonizing gpyfft/gpyfftlib.pyx

Error compiling Cython file:
------------------------------------------------------------
...
    property precision:
        """the floating point precision of the FFT data"""    
        def __get__(self):
            cdef clfftPrecision precision
            errcheck(clfftGetPlanPrecision(self.plan, &precision))
            return clfftPrecision_(precision)
                                 ^
------------------------------------------------------------

gpyfft/gpyfftlib.pyx:215:34: 'clfftPrecision_' is not a constant, variable or function identifier

Error compiling Cython file:
------------------------------------------------------------
...
    property precision:
        """the floating point precision of the FFT data"""    
        def __get__(self):
            cdef clfftPrecision precision
            errcheck(clfftGetPlanPrecision(self.plan, &precision))
            return clfftPrecision_(precision)
                                 ^
------------------------------------------------------------

gpyfft/gpyfftlib.pyx:215:34: Calling non-function type 'clfftPrecision_'
Traceback (most recent call last):
  File "setup.py", line 94, in <module>
    ext_modules=cythonize(extensions),
  File "/usr/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 877, in cythonize
    cythonize_one(*args)
  File "/usr/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 997, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: gpyfft/gpyfftlib.pyx

I'm not familiar with Cython, but it looks like this is a wrapper to the underlying clFFT functions, where the function names with the underline are perhaps supposed to be loaded from the library? But it seems they are not being loaded and the function names with the underlines are undefined. Any tips for how I can correct this?

License file

Could a license file please be added to the repo? Also could it please be listed in the MANIFEST.in? Thanks.

When rinning simple_example.py - OverflowError: can't convert negative value to size_t

Hi,

I recently tried to use gpyfft on following setup:
CPU - ARMv7, 32bits
Debian: Linux tinkerboard 4.4.103+ #1 SMP Fri Jun 22 16:14:49 CST 2018 armv7l GNU/Linux
Python 3.5.3
Cython 0.29.15
Pyopencl 2019.1.2

I installed libclfft and build gpyfft in following way:
python3 setup.py build
python3 setup.py install

After that I tried to run simple_example.py from examples directory and I received:
Traceback (most recent call last):
File "simple_example.py", line 13, in
transform = FFT(context, queue, data_gpu, axes = (2, 1))
File "/usr/local/lib/python3.5/dist-packages/gpyfft-0.7.3-py3.5-linux-armv7l.egg/gpyfft/fft.py", line 93, in init
plan = GFFT.create_plan(context, t_shape)
File "gpyfft/gpyfftlib.pyx", line 142, in gpyfft.gpyfftlib.GpyFFT.create_plan
File "gpyfft/gpyfftlib.pyx", line 219, in gpyfft.gpyfftlib.Plan.init
OverflowError: can't convert negative value to size_t

Can you, please, help me to fix this problem ?

Thanks

[debian] test error during the build process

Hello, I try to create a debian package for gpyfft and I get this error message during the build process
Your library is a dependency of a project that I need to package

creating build/temp.linux-amd64-3.5/gpyfft
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURC
E=2 -fPIC -I/home/gregor/devel/clFFT/src/include -I/opt/AMDAPPSDK-3.0/include -I/usr/include/python3.5m -c gpyfft/gpyfftlib.c -o build/temp.linux-amd64-3.5/gpyfft/gpyfftlib.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
 -D_FORTIFY_SOURCE=2 build/temp.linux-amd64-3.5/gpyfft/gpyfftlib.o -L/usr/local/lib64 -lclFFT -o /<<PKGBUILDDIR>>/.pybuild/pythonX.Y_3.5/build/gpyfft/gpyfftlib.cpython-35m-x86_64-linux-gnu.so
   dh_auto_test -O--buildsystem=pybuild
I: pybuild base:184: cd /<<PKGBUILDDIR>>/.pybuild/pythonX.Y_2.7/build; python2.7 -m unittest discover -v 
test_1d_inplace (gpyfft.test.test_gpyfft.test_fft) ... ERROR
test_1d_inplace_double (gpyfft.test.test_gpyfft.test_fft) ... ERROR
test_1d_out_of_place (gpyfft.test.test_gpyfft.test_fft) ... ERROR
test_1d_real_to_complex (gpyfft.test.test_gpyfft.test_fft) ... ERROR
test_2d_real_to_complex (gpyfft.test.test_gpyfft.test_fft) ... ERROR
test_2d_real_to_complex_double (gpyfft.test.test_gpyfft.test_fft) ... ERROR
test_basic (gpyfft.test.test_gpyfftlib.test_basic) ... ok
test_create_plan (gpyfft.test.test_gpyfftlib.test_basic) ... ERROR
test_2d_in_4d_out_of_place (gpyfft.test.test_batched.test_fft_batched) ... ERROR
test_2d_out_of_place (gpyfft.test.test_batched.test_fft_batched) ... ERROR
test_callback_post (gpyfft.test.test_callback.TestCallbackPreMul) ... ok
test_callback_pre (gpyfft.test.test_callback.TestCallbackPreMul) ... ok

======================================================================
ERROR: test_1d_inplace (gpyfft.test.test_gpyfft.test_fft)
----------------------------------------------------------------------
TypeError: test_1d_inplace() takes exactly 2 arguments (1 given)

======================================================================
ERROR: test_1d_inplace_double (gpyfft.test.test_gpyfft.test_fft)
----------------------------------------------------------------------
TypeError: test_1d_inplace_double() takes exactly 2 arguments (1 given)

======================================================================
ERROR: test_1d_out_of_place (gpyfft.test.test_gpyfft.test_fft)
----------------------------------------------------------------------
TypeError: test_1d_out_of_place() takes exactly 2 arguments (1 given)

======================================================================
ERROR: test_1d_real_to_complex (gpyfft.test.test_gpyfft.test_fft)
----------------------------------------------------------------------
TypeError: test_1d_real_to_complex() takes exactly 2 arguments (1 given)

======================================================================
ERROR: test_2d_real_to_complex (gpyfft.test.test_gpyfft.test_fft)
----------------------------------------------------------------------
TypeError: test_2d_real_to_complex() takes exactly 2 arguments (1 given)
======================================================================
ERROR: test_2d_real_to_complex_double (gpyfft.test.test_gpyfft.test_fft)
----------------------------------------------------------------------
TypeError: test_2d_real_to_complex_double() takes exactly 2 arguments (1 given)

======================================================================
ERROR: test_create_plan (gpyfft.test.test_gpyfftlib.test_basic)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "gpyfft/test/test_gpyfftlib.py", line 24, in test_create_plan
    ctx = get_contexts()[0]
IndexError: list index out of range

======================================================================
ERROR: test_2d_in_4d_out_of_place (gpyfft.test.test_batched.test_fft_batched)
----------------------------------------------------------------------
TypeError: test_2d_in_4d_out_of_place() takes exactly 2 arguments (1 given)

======================================================================
ERROR: test_2d_out_of_place (gpyfft.test.test_batched.test_fft_batched)
----------------------------------------------------------------------
TypeError: test_2d_out_of_place() takes exactly 2 arguments (1 given)

----------------------------------------------------------------------
Ran 12 tests in 0.001s

FAILED (errors=9)
clFFT version: (2, 12, 2)

What is the proble, I worked with the lateste release 0.7.0

thanks for your help

Frederic

Broken Build on Windows

The build reports successful, but when I try to import, I receive:

import gpyfft
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-4b3d41c00a5a> in <module>()
----> 1 import gpyfft

C:\Users\Alex\Notebooks\Alex\build\bdist.win-amd64\egg\gpyfft\__init__.py in <module>()

C:\Users\Alex\Notebooks\Alex\build\bdist.win-amd64\egg\gpyfft\gpyfftlib.py in <module>()

C:\Users\Alex\Notebooks\Alex\build\bdist.win-amd64\egg\gpyfft\gpyfftlib.py in __bootstrap__()

ImportError: DLL load failed: The specified module could not be found.

Real->complex and complex->real

I have a question regarding complex<->real plans.

You can create a real<->complex plans using:

 ny, nx = 256, 280
 nx2 = nx //2 + 1
 d = np.arange(ny * nx).reshape((ny,nx)).astype(np.float32)
 cl_d = cla.to_device(queue=queue,ary=d.astype(np.float32))
 cl_d_ft = cla.zeros(queue=queue, shape=(ny, nx2), dtype=np.complex64)
 planr2c = gpyfft.FFT(ctx, queue, cl_d, cl_d_ft, axes=(-1,-2))
 planc2r = gpyfft.FFT(ctx, queue, cl_d_ft, cl_d, axes=(-1,-2), real=True)

... and cl_d_ft is a complex hermitian array - OK
However, to create a complex(half-hermitian array)->real plan, you need to use real=True keyword, but why is it needed ? Should it not be sufficient to detect that the input is complex and output real to trigger the creation of a complex-hermitian->real plan ? (it took me a while to find that keyword was needed, that's why I'm asking...)

Higher level api?

The README says that the higher level API is available. Am I missing something? It doesn't appear to be in the repository...

PyPI

Hi,

Wouldn't it make sense to declare gpyfft on PyPI and make it "pip-instalable" ?
Do you believe one could take clfft into the gpyfft into a "manylinux" wheel to ease the deplyment ? I know h5py is doing so for the HDF5 library.

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.