Smpd - Slower than Serial

Hi everybody,
I am new to parallel computing. Therefore the solution to the problem might be easy.
I have a grid and I need to evaluate a function at each grid point. Therefore I wanted to assign some part of the grid to different workers in order to have speedup. However when I run the code in parallel I cannot see a difference in the computation time compared to serial computation. I also tested the case while changing the number of workers. In order to avoid overhead computations I run the code long enough. So what is my mistake?
My code is like this:
matlabpool ( 'open' , 4 )
Xpos = 10:0.1:25;
Ypos = 1:0.1:10;
n_x = length(Xpos);
n_y = length(Ypos);
spmd
i_x=codistributed(1:n_x);
i_y=codistributed(1:n_y);
end
tic;
for i_x = 1:n_x
for i_y = 1:n_y
output = myfunction(Xpos(i_x),Ypos(i_y));
end
end
Time=toc;
matlabpool('close')

댓글 수: 2

Jill Reese
Jill Reese 2013년 5월 8일
What operations are you performing on the Xpos and Ypos variables within myfunction?
Jason Ross
Jason Ross 2013년 5월 8일
편집: Jason Ross 2013년 5월 8일
Which scheduler are you using? (I assume "local")
How many compute cores (not hyperthreaded cores) does your machine have? (I assume 4)
How much RAM does your machine have? Do you use it all up and go to swap?
What is "long enough"? Seconds? Minutes? Hours? Days?

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

질문:

2013년 5월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by