multithreading - Simple FFT in C# as single core, multi core and OpenCL versions? -
i searched web , stack overflow fft versions in c# , asked several times , answers given, but...
- all of fft versions found optimized speed hard understand.
- almost of iterative versions, not optimized multi core systems.
- opencl versions optimized gpu models.
as working on case study single core, multi core, opencl comparison of algorithms, looking simple , free c# / opencl versions of fft, working on float[] (real, complex not needed), forward , inverse optional great. if work on array-length. has stumbled upon such?
this sample source brahma (my open-source project) has both c# implementation , linq implementation (opencl) of this fft paper microsoft research.
the kernels automagically generated brahma are:
the fft kernel
__kernel void brahmakernel(int fftsize,__global float* a,__global float* ib,__global float* c,__global float* id,int size) { int x = get_global_id(0); int b = ((floor(convert_float((x / fftsize))) * fftsize) / ((int)2)); int offset = (x % (fftsize / ((int)2))); int x0 = (b + offset); int x1 = (x0 + (size / ((int)2))); float val0a = a[x0]; float val0b = ib[x0]; float val1a = a[x1]; float val1b = ib[x1]; float angle = (((float)-6.283185) * (convert_float(x) / convert_float(fftsize))); float ta = native_cos(angle); float tb = native_sin(angle); (c[x] = ((val0a + (ta * val1a)) - (tb * val1b)));(id[x] = ((val0b + (tb * val1a)) + (ta * val1b))); } conjugate , scale kernel
__kernel void brahmakernel(float scale,__global float* a,__global float* ib) { int x = get_global_id(0); (a[x] = (a[x] * scale));(ib[x] = (-(ib[x]) * scale));; } hope helps!
Comments
Post a Comment