Slow indexing into local parts of distributed cell arrays in parallel computing toolbox
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!