필터 지우기
필터 지우기

parfor using

조회 수: 1 (최근 30일)
N. Yildirim
N. Yildirim 2012년 3월 3일
Hi everybody, i have a question about parfor using. I tried a classical example for parfor on my PC but i couldn't get gainly results. How ?
nmax=1000;
y = zeros(nmax,1);
tic
parfor n = 1:nmax
z = randn(n);
y(n) = max(svd(z));
end
toc
Results:
(nmax, pool size, time)
(500, 0, 12.51) (500, 2, 8.71) (500, 4, 5.16) That's OK.
(750, 0, 46.03) (750, 2, 38.65) (750, 4, 30.32) Maybe OK.
(1000, 0, 141.40) (1000, 2, 156.19) (1000, 4, 174.81) Why ?
Thanks for replies.

채택된 답변

Laurens Bakker
Laurens Bakker 2012년 3월 7일
Hi Yildirim,
There is considerable overhead in gathering the data back into a single variable. I removed the assignments and that improves the situation.
nmax=1000;
y = zeros(nmax,1);
tic
parfor n = 1:nmax
max( svd( randn(n) ));
end
toc
Cheers,
Laurens

추가 답변 (1개)

N. Yildirim
N. Yildirim 2012년 3월 17일
Hi Laurens,
thanks a lot for your reply. It's also very logical to me. But I havent still time saving. Nothing has changed :(
Cheers, Yildirim

카테고리

Help CenterFile Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by