MATLAB PARALLEL COMPUTING TOOLBOX - S Betriebsanweisung Seite 77

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 656
  • Inhaltsverzeichnis
  • FEHLERBEHEBUNG
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 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
Seitenansicht 76
1 2 ... 72 73 74 75 76 77 78 79 80 81 82 ... 655 656

Kommentare zu diesen Handbüchern

Keine Kommentare