Reputation: 1
I produce a .dll file that contains Fourier function of FFTW3 library. I cannot implement multithreading due to variable dependency in the .dll. I'm using Fourier and take variables, doing some works on them, and calculate Fourier again. Here my FFT (for DST calculation) function part in .dll.
void dst(fftwf_complex* x, size_t n)
{
fftwf_complex* y = fftwf_alloc_complex(size_t);
ffywf_plan plan =
fftwf_plan_dft_1d(size_t,y,y,FFTW_FORWARD,FFTW_ESTIMATE);
// write x to y
fftwf_execute(plan);
fftwf_destroy_plan(plan);
fftwf_cleanup();
// write y to x again
fftwf_free(y);
}
Code goes to above code many time (also there is a IDST function), after some processes between them.
So when I want to use .dll with multithread for different cases, FFTW3 library gave me some errors.
double Class::Function1(Class& Inputs, int x, int y, int z)
{
dllFunction(Inputs.a, Inputs.b, Inputs.c, x, y, z);
return Inputs.z;
}
void Class::Function2(Class& Inputs)
{
#pragma omp parallel
{
#pragma omp for
for (int i=0;i<5;i++)
{
Inputs.z = Obj.Function1(Inputs,x,y,z);
}
}
}
When I try this it gives error in dllFunction() .cpp file dst function. Error is "access violation reading location". (// write x to y part) (located different directory, I don't know how it can find .cpp file).
Shortly, I want to use multithread with .dll not in .dll. What is the problem with FFTW3? Can't I run .dll with threads? I hope i was able to explain.
Annotation 1: I use DFT function for DST calculation so i do some process in dst function. Also I know there is a dst function in FFTW3 but it's very slow for big calculations. So I use fft instead.
Upvotes: 0
Views: 57