Products & Services Solutions Academia Support User Community Company

Learn more about Parallel Computing Toolbox   

codistributor - Create codistributor object for codistributed arrays

Syntax

codist = codistributor()
codist = codistributor('1d')
codist = codistributor('1d', dim)
codist = codistributor('1d', dim, part)
codist = codistributor('2d')
codist = codistributor('2d', lbgrid)
codist = codistributor('2d', lbgrid, blksize)

Description

There are two schemes for distributing arrays. The scheme denoted by the string '1d' distributes an array along a single specified subscript, the distribution dimension, in a noncyclic, partitioned manner. The scheme denoted by '2d', employed by the parallel matrix computation software ScaLAPACK, applies only to two-dimensional arrays, and varies both subscripts over a rectangular computational grid of labs in a blocked, cyclic manner.

codist = codistributor(), with no arguments, returns a default codistributor object with zero-valued or empty parameters, which can then be used as an argument to other functions to indicate that the function is to create a codistributed array if possible with default distribution. For example,

Z = zeros(..., codistributor())
R = randn(..., codistributor())

codist = codistributor('1d') is the same as codist = codistributor().

codist = codistributor('1d', dim) also forms a codistributor object with codist.Dimension = dim and default partition.

codist = codistributor('1d', dim, part) also forms a codistributor object with codist.Dimension = dim and codist.Partition = part.

codist = codistributor('2d') forms a '2d' codistributor object. For more information about '2d' distribution, see 2-Dimensional Distribution.

codist = codistributor('2d', lbgrid) forms a '2d' codistributor object with the lab grid defined by lbgrid and with default block size.

codist = codistributor('2d', lbgrid, blksize) forms a '2d' codistributor object with the lab grid defined by lbgrid and with a block size defined by blksize.

codist = getCodistributor(D) returns the codistributor object of codistributed array D.

Examples

Create a 3-dimensional array with distribution along the second dimension, and partition scheme [1 2 1 2 ...].

spmd
    if mod(labindex, 2)
        L = rand(2,1,4)
    else
        L = rand(2,2,4)
    end
    A = codistributed(L, codistributor())
end

On four labs, create a 20-by-5 codistributed array A, distributed by rows (over its first dimension) with a uniform partition scheme.

spmd
    L = magic(5) + labindex;
    dim = 1; % dimension of distribution
    A = codistributed(L, codistributor('1d', dim));
end

See Also

codistributed, getLocalPart, redistribute

  


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