I wonder if there is a way to use CuFFT
directly on StructArrays{<:Complex}
. Currently, if I write e.g.
using CUDA, StructArrays
x_re = rand(Float32, 10);
x_im = rand(Float32, 10);
x = StructArray{ComplexF32}((x_re,x_im));
x_gpu = replace_storage(CuArray, x);
F = CUFFT.plan_fft!(x_gpu); # throws an error
The main problem is that StructArrays
are subtypes of AbstractArrays
, which is too obscure to be passed to the functions in CUFFT
(and the same happens with FFTW.jl
, i.e. FFTW.plan_fft!(x)
will throw an error).
I think that making a wrapper for x_gpu
would be a possible solution, but I have no idea on that wrapper. Another solution would be to directly pass x_gpu
to ccall
-ed CUDA
libraries but I have no idea on this too. Could you give me a suggestion?