|
"Juliette Salexa" <juliette.physicist@gmail.com> wrote in message <h603fc$oq7$1@fred.mathworks.com>...
> Also, the variability in your performance could have to do with you running other programs in the background. When I use the PCT, matlab will take up 100% of my CPU's resources unless other things are running in the backgorund, in which case it will take up whatever's left. Try running your code with nothing in the background.
Thanks for replying. After running several times, the results get stable. Also, the spmd does not work well as parfor. The code is showed as below:
clear;
clc;
tic
matlabpool open 2
A=zeros(10000000,1);
B=A;
spmd
for i=1:size(A,1) %or using parfor
B(i)=A(i)+i;
end
end
matlabpool close
toc
|