I have a code similar in structure to the following example:
p = 3;N = p*10000;if ~matlabpool('size'),matlabpool('open','local',p);endspmd, dist = codistributor('1d',1); XX = codistributed.cell(N,1,dist); g_indices = globalIndices(XX,1);endticspmd, for k=drange(1:N), % perform some work
XX(k,1) = {1}; endendtocticspmd, for k = g_indices, % work
XX(k,1) = {1}; endendtoc
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
Best Answer