MATLAB PARALLEL COMPUTING TOOLBOX - S Guide de l'utilisateur Page 77

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 656
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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
Vue de la page 76
1 2 ... 72 73 74 75 76 77 78 79 80 81 82 ... 655 656

Commentaires sur ces manuels

Pas de commentaire