MATLAB PARALLEL COMPUTING TOOLBOX - S Guia do Utilizador Página 118

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
Vista de página 117
5 Math with Codistributed Arrays
5-4
Codistributed Arrays
With replicated and variant arrays, the full content of the array is stored in the
workspace of each worker. Codistributed arrays, on the other hand, are partitioned into
segments, with each segment residing in the workspace of a different worker. Each
worker has its own array segment to work with. Reducing the size of the array that
each worker has to store and process means a more efficient use of memory and faster
processing, especially for large data sets.
This example distributes a 3-by-10 replicated array A across four workers. The resulting
array D is also 3-by-10 in size, but only a segment of the full array resides on each
worker.
spmd
A = [11:20; 21:30; 31:40];
D = codistributed(A);
getLocalPart(D)
end
WORKER 1 WORKER 2 WORKER 3 WORKER 4
| | |
11 12 13 | 14 15 16 | 17 18 | 19 20
21 22 23 | 24 25 26 | 27 28 | 29 30
31 32 33 | 34 35 36 | 37 38 | 39 40
For more details on using codistributed arrays, see “Working with Codistributed Arrays”
on page 5-5.
Vista de página 117
1 2 ... 113 114 115 116 117 118 119 120 121 122 123 ... 655 656

Comentários a estes Manuais

Sem comentários