MATLAB PARALLEL COMPUTING TOOLBOX - S Guía de usuario Pagina 77

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 656
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 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
Vista de pagina 76
1 2 ... 72 73 74 75 76 77 78 79 80 81 82 ... 655 656

Comentarios a estos manuales

Sin comentarios