Slow indexing into local parts of distributed cell arrays in parallel computing toolbox
Show older comments
I have a code similar in structure to the following example:
p = 3;
N = p*10000;
if ~matlabpool('size'),matlabpool('open','local',p);end
spmd,
dist = codistributor('1d',1);
XX = codistributed.cell(N,1,dist);
g_indices = globalIndices(XX,1);
end
tic
spmd,
for k=drange(1:N),
% perform some work
XX(k,1) = {1};
end
end
toc
tic
spmd,
for k = g_indices,
% work
XX(k,1) = {1};
end
end
toc
on my computer i get the following output:
Elapsed time is 26.234271 seconds.
Elapsed time is 30.065625 seconds.
I am aware that there is significant overhead associated with spmd, and distributed arrays, but this performance is far worse than I personally expected. Am I doing this indexing wrong, or is there some reason why this is so slow? The reason I expected this to be faster is that I am only indexing the local parts of each array. (Unless I there is an error somewhere?)
I would greatly appreciate all input, or any suggestions on this.
Regards, Anders
Accepted Answer
More Answers (0)
Categories
Find more on Dates and Time in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!