2 parfor loops and gathering/distributing cell array
1 次查看(过去 30 天)
显示 更早的评论
I have a question about timing in the following minimal code. It appears that between the first and second parfor loops, time is spent gathering components of the cell array from the workers and then redistributing them to the workers. Is there any way to avoid this while still using parfor and not spmd/distributed arrays. Also, I need to do this in two stages with two parfor loops, I cannot do it with one parfor loop.
Kcell = cell(numNodes,1);
parfor n = 1:numNodes
Kcell{n} = rand(3,3*numNodes);
end
parfor n = 1:numNodes
Kcell{n}(:,1) = 1; % some other operation on Kcell{n}
end
K = cell2mat(Kcell);
% do something with K like a linear solve
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!