필터 지우기
필터 지우기

Questions about the parfor function

조회 수: 1 (최근 30일)
ma Jack
ma Jack 2022년 7월 4일
댓글: Walter Roberson 2022년 7월 5일
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