Does Parfor make a difference without Parallel Computing toolbox

조회 수: 68 (최근 30일)
cr
cr 2011년 8월 11일
댓글: Walter Roberson 2017년 2월 23일
Hi, I've been running some experiment to see how parfor behaves. I dont have parallel computing toolbox (PCT) so I cant create workers. I found parfor giving no time-advantage. Is that expected? I'm on a MAC 64-bit core2duo machine.
Also, sometimes on PC (32bit XP core2duo) I open up task manager to see only one of the cores is being used while matlab is busy computing. Why is that? Wouldn't it be faster using both? Can I someway distribute jobs to different cores using parfor without PCT?
Thanks, cK.

채택된 답변

Titus Edelhofer
Titus Edelhofer 2011년 8월 11일
Hi,
just adding a comment for parfor: parfor does something "meaningful" for you in the sense of distributing execution only when you have the PCT. The reason you can use parfor within pure MATLAB at all is that you don't have to change the code when running on MATLAB without PCT... So: the answer is "yes, that is expected" ;-).
Titus

추가 답변 (4개)

Thomas
Thomas 2011년 10월 11일
Parfor without having a matlabpool open in slower than the comparative for loop so I guess it should be doing something different.
E.g.:
tic parfor i=1:10000*1024
A(i) = sin(i*2*pi/1024);
end toc
Output: Elapsed time is 25.464860 seconds.
Same code without the parfor
tic for i=1:10000*1024
A(i) = sin(i*2*pi/1024);
end toc
Output: Elapsed time is 1.121148 seconds.
However with the matlabpool open the same parfor loop was much faster matlabpool open local 8
>> MyWave
Elapsed time is 4.462031 seconds.
(FYI I have a dual processor quad core machine with 16GB of ram)

Friedrich
Friedrich 2011년 8월 11일
Hi,
parfor will run the loop in the reverse order if you dont have Parallel Computing Toolbox.
  댓글 수: 3
Konrad Malkowski
Konrad Malkowski 2011년 11월 17일
As far as I can remember (2008b or so), PARFOR always run the loop in reverse order.
This is by design.
Konrad Malkowski
Konrad Malkowski 2011년 11월 17일
As far as I can remember (2008b or so), PARFOR always run the loop in reverse order.
This is by design.

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


Arnaud Miege
Arnaud Miege 2011년 8월 11일
I think that if you don't have the Parallel Computing Toolbox, parfor will behave as a normal for loop. Similarly, you can only distribute jobs to different cores with the Parallel Computing Toolbox.
HTH,
Arnaud
  댓글 수: 2
Hayatullahi Adeyemo
Hayatullahi Adeyemo 2017년 2월 23일
Please I need clarification. Can I use Parallel Computing Toolbox to execute two different scripts at the same time on MATLAB? Hayatullah
Walter Roberson
Walter Roberson 2017년 2월 23일
Hayatullahi Adeyemo:
No, not exactly. You can run two functions at the same time but not two scripts. Scripts violate transparency. I think you could run() the files that contain the scripts because run() is actually a function call.
That said: the majority of the time when I see people asking to run two scripts at the same time, they want some kind of connection between the scripts that the parallel computing facility does not provide. For example there is no access to graphics in any worker of parfor or spmd.

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


cr
cr 2011년 8월 12일
Thanks for taking time to answer guys. More experiments corroborated what you said and like Friedrich commented, parfor makes the order reversed without PCT - as tested on 2010a.

카테고리

Help CenterFile Exchange에서 MATLAB Parallel Server에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by