I am running my codes based on PyFFTW wrapper for FFTW3 library. In the plan function call of PyFFTW, there is a parameter "thread" to specify the number of threads to use. I use a fundamental judge, Activity Monitor, to tell whether multithreading works or not. It turns out that the following code runs on one CPU even when I specify thread=4. My laptop is a Mac with 8 cores. Here is my code.
import pyfftw
n_cpu = 4
flags = ('FFTW_MEASURE','FFTW_DESTROY_INPUT')
x_buffer = pyfftw.n_byte_align_empty((8192,8192,), 16, 'complex128')
f_buffer = pyfftw.n_byte_align_empty((8192,8192,), 16, 'complex128')
fftObj = pyfftw.FFTW(x_buffer, f_buffer, axes=(-2,-1), direction='FFTW_FORWARD', flags=flags, thread=n_cpu)
fftObj()
When I run fftObj(), the computer seems to run on one CPU (CPU usage 99% whereas the expected should be 400%). What I want is to have the FFT task distributed among CPUs my laptop has.
Other than trying pyfftw, I have tried writing some other codes in C with OpenMP, and I see from the Activity Monitor that the CPU usage is above 100%. It means that the C code runs on multiple CPUs and my machine does have the multicore feature.
Is there anything that I missed to turn on the multithreading of pyfftw? Or do I misunderstand the meaning of the parameter?
There is a related problem.
The argument is threads
not thread
. Superfluous and invalid arguments should probably be picked up. Fancy going and leaving an issue on github?