Questions about the parfor function

2 次查看(过去 30 天)
Hi all,
Is there a way to make the parfor function faster here? My cpu has six physical cores, but it is 12 threads, every parallel calculation matlab shows is connected to 6 works, is there any way to make it connected to 12 works?I want the program to become faster.

采纳的回答

Rik
Rik 2022-7-4
You can change your settings as described on this doc page. You can also explicitly call the parpool function.
Note that it might not actually speed up your code, as each worker increases overhead and hyperthreaded cores are not always 'complete' cores (so the actual circuitry required for the calculation might be shared by two threads).
It is also not a guarantee that your code will actually be faster with a parfor loop. For more about this point, see this doc page.
  2 个评论
ma Jack
ma Jack 2022-7-5
Thank you sir, I will verify it after a while
Walter Roberson
Walter Roberson 2022-7-5
hyperthreads work well when a process needs to do I/O: when a process volunteers to give up the CPU then another process is immediately ready to take over.
However, except in very limited circumstances, only one of the two hyperthreads per core can compute anything at a time, and the process executing has to volunteer to give up the core for the other hyperthread to proceed. In compute-heavy cases such as MATLAB computation, hyperthreads can end up slowing down computation.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Parallel Computing Fundamentals 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by