MATLAB PARALLEL COMPUTING TOOLBOX - S Podręcznik Użytkownika Strona 77

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
Przeglądanie stron 76
Convert Nested for-Loops to parfor
2-49
M1 = magic(5);
for a = 1:5
parfor b = 1:5
M2(a,b) = a*10 + b + M1(a,b)/10000;
end
end
M2
In this case, each iteration of the outer loop in MATLAB, initiates a parfor-loop. That
is, this code creates five parfor-loops. There is generally more overhead to a parfor-
loop than a for-loop, so you might find that this approach does not perform optimally.
More About
“Nesting and Flow in parfor-Loops” on page 2-15
Przeglądanie stron 76
1 2 ... 72 73 74 75 76 77 78 79 80 81 82 ... 655 656

Komentarze do niniejszej Instrukcji

Brak uwag