필터 지우기
필터 지우기

How MATLAB scheduler is doing the parallelization between the workers in one computer ?

조회 수: 5 (최근 30일)
Dear all,
Please, I have a question: I read about the parallel toolbox in MATLAB and how to use some functions and iteration loops like parfor and spmd. I implement some examples from the documents which are very useful and let me understand how to use these tools.
My question is: How MATLAB scheduler is doing the parallelisation for us ? in other words, when we write our parallel code (this code contain parfor or spmd) how MATLAB divide and copy the code and send it to all workers ?
Kind regards Ammar

채택된 답변

Edric Ellis
Edric Ellis 2017년 5월 17일
For spmd, the model is simple: each worker executes the body of the block simultaneously.
For parfor, the iterations of the loop are split up into "intervals", and these are sent out to workers. The aim of the parfor scheduler is to divide the work in such a way as to minimise overheads, while minimising "stragglers". There is no way as a user of parfor to influence the way the work is divided.
  댓글 수: 2
Ammar
Ammar 2017년 5월 17일
Dear Edric, I would like to thank you for this answer. Really it is useful. Please, can I ask: Can I use the pmode tool for implement the same code and get the same results with the same execution time as parfor ? i.e. in pmode tool designated a number of iterations for each worker using (if labindex==...) and collect the results using (labSend, labRecieve, labBroadcast).
Regards Ammar
Edric Ellis
Edric Ellis 2017년 5월 18일
You can't use parfor together with pmode. The commands that you enter at the P>> prompt are essentially executed as if they were inside an spmd block. However, you can use the for-drange loop there.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by