Products & Services Solutions Academia Support User Community Company

Learn more about Parallel Computing Toolbox   

codistributed - Create codistributed array from replicated local data

Syntax

C = codistributed(X)
C = codistributed(X, codist)
C = codistributed(X, codist, lab)
C = codistributed(C1, codist)

Description

C = codistributed(X) distributes a replicated X using the default codistributor. X must be a replicated array, that is, it must have the same value on all labs. size(C) is the same as size(X).

C = codistributed(X, codist) distributes a replicated X using the codistributor codist. X must be a replicated array, namely it must have the same value on all labs. size(C) is the same as size(X). For information on constructing codistributor objects, see the reference pages for codistributor1d and codistributor2dbc.

C = codistributed(X, codist, lab) distributes a local array X that resides on the lab identified by lab, using the codistributor codist. Local array X must be defined on all labs, but only the value from lab is used to construct C. size(C) is the same as size(X).

C = codistributed(C1, codist) where the input array C1 is already a codistributed array, redistributes the array C1 according to the distribution scheme defined by codistributor codist. This is the same as calling C = redistribute(C1, codist).

Remarks

gather essentially performs the inverse of codistributed.

Examples

Create a 1000-by-1000 codistributed array C1 using the default distribution scheme.

spmd
    N = 1000;
    X = magic(N);          % Replicated on every lab
    C1 = codistributed(X); % Partitioned among the labs
end
 

Create a 1000-by-1000 codistributed array C2, distributed by rows (over its first dimension).

spmd
    N = 1000;
    X = magic(N);
    C2 = codistributed(X, codistributor1d(1));
end

See Also

codistributor1d, codistributor2dbc, gather, globalIndices, getLocalPart, redistribute, size, subsasgn, subsref

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS