Filter löschen
Filter löschen

2 parfor loops and gathering/distributing cell array

1 Ansicht (letzte 30 Tage)
Siva
Siva am 18 Jun. 2015
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

Antworten (0)

Kategorien

Mehr zu Parallel for-Loops (parfor) finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by