How can I adjust the number of threads for functions based on fftw?

3 Ansichten (letzte 30 Tage)
현탁 박
현탁 박 am 15 Feb. 2024
Kommentiert: Angelo Yeo am 15 Feb. 2024
As far as I know, embadded matlab function 'dct' is based on fftw library, and it supports 'Thread-based Environment'.
And I noticed MATLAB proccess automatically use CPU about ~1000% when I use dct function, in thread-based parallel environment, without any other instruction.
How can the function decide the proper number of threads in fft ?
Can I set the number of threads manually to improve the performance?
Thanks.

Antworten (1)

Angelo Yeo
Angelo Yeo am 15 Feb. 2024
You can determine the maximum number of threads with the function "maxNumCompThreads".
See the doc below for more information.
  2 Kommentare
현탁 박
현탁 박 am 15 Feb. 2024
Thanks.
But I want to know how to set 'exact' threads which the dct function used, not the maximum threads.
When I use fftw in c code, I have to set the number of threads manually via
void fftw_plan_with_nthreads(int nthreads);
And FFTW team suggest that test various trial nthreads to find a effective thread number.
I want to follow that routine, but I cannot even configure the exact threads fftw used, and that's the problem.
Angelo Yeo
Angelo Yeo am 15 Feb. 2024
@현탁 박: Would you try to set the number of workers for thread environment with the following commands?
numWorkers = 2;
parpool("Threads", numWorkers)
Note that this feature was introduced from R2022b, and details can be found in the link below.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Audio Processing Algorithm Design finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by