2 parfor loops and gathering/distributing cell array
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements 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!