MATLAB PARALLEL COMPUTING TOOLBOX - S Guida Utente Pagina 468

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
Vedere la pagina 467
11 Functions — Alphabetical List
11-124
Examples
Create a 2-by-22 codistributed array among four workers, and view the global indices on
each lab:
spmd
C = zeros(2,22,codistributor1d(2,[6 6 5 5]));
if labindex == 1
K = globalIndices(C,2) % returns K = 1:6.
elseif labindex == 2
[E,F] = globalIndices(C,2) % returns E = 7, F = 12.
end
K = globalIndices(C,2,3) % returns K = 13:17.
[E,F] = globalIndices(C,2,4) % returns E = 18, F = 22.
end
Use globalIndices to load data from a file and construct a codistributed array
distributed along its columns, i.e., dimension 2. Notice how globalIndices makes the
code not specific to the number of workers and alleviates you from calculating offsets or
partitions.
spmd
siz = [1000,1000];
codistr = codistributor1d(2,[],siz);
% Use globalIndices to figure out which columns
% each worker should load.
[firstCol,lastCol] = globalIndices(codistr,2);
% Call user-defined function readRectangleFromFile to
% load all the values that should go into
% the local part for this worker.
labLocalPart = readRectangleFromFile(fileName, ...
1,siz(1),firstCol,lastCol);
% With the local part and codistributor,
% construct the corresponding codistributed array.
C = codistributed.build(labLocalPart,codistr);
end
See Also
getLocalPart | labindex
Vedere la pagina 467
1 2 ... 463 464 465 466 467 468 469 470 471 472 473 ... 655 656

Commenti su questo manuale

Nessun commento

Anthem A2 manuály

Uživatelské manuály a uživatelské příručky pro Přijímače a zesilovače Anthem A2.
Poskytujeme 1 manuály pdf Anthem A2 ke stažení zdarma podle typů dokumentů: Uživatelský manuál






Další produkty a příručky pro Přijímače a zesilovače Anthem

Modely Typ Dokumentu
P5 Uživatelský manuál   Anthem P5 User Manual, 10 stránky
PVA 8 Uživatelský manuál   Anthem PVA 8 User Manual, 12 stránky
MRX 710 Uživatelský manuál   Anthem MRX 710 User Manual, 60 stránky
MRX 710 Uživatelský manuál   Anthem MRX 710 Manuel d'utilisation, 60 stránky
BLX 200 Uživatelský manuál   Anthem BLX 200 User Manual, 46 stránky