I am using two Boost threads, each of which uses different FFTW plan (example: thread 1 uses 'plan_fft' and thread 2 uses 'plan_ifft'). When I run only one thread (thread 2), it works perfectly, but when I run both threads, then I am getting a segmentation fault. I think it may be because of creation plan is not thread safe. It would be great help for me if someone provides solution to "how to use two different fftw_plans (each in one thread) in two threads in a parallel manner".
I forgot to mention one thing as solutions provided by FFTW multithreading developers:
- using semaphore locks
- creating all the plans in the one thread
I implemented the 2nd one (i.e created all the plans in main program and then called two threads from the main program). When I do so, there are no errors and segmentation fault, but I am not getting the result.
Please note: these two threads are independent and not sharing any common data, so I think a semaphore lock won't work for my case.
My doubt: can we create (and destroy) plans in the main program and execute these two different plans in two different threads?