Quantcast

Documentation Center

  • Trial Software
  • Product Updates

distributed

Create distributed array from data in client workspace

Syntax

D = distributed(X)

Description

D = distributed(X) creates a distributed array from X. X is an array stored on the MATLAB client, and D is a distributed array stored in parts on the workers of the open parallel pool.

Constructing a distributed array from local data this way is appropriate only if the MATLAB client can store the entirety of X in its memory. To construct large distributed arrays, use one of the constructor methods such as ones(___,'distributed'), zeros(___,'distributed'), etc.

If the input argument is already a distributed array, the result is the same as the input.

Tips

  • A distributed array is created on the workers of the existing parallel pool. If no pool exists, distributed will start a new parallel pool, unless the automatic starting of pools is disabled in your parallel preferences. If there is no parallel pool and distributed cannot start one, the result is the full array in the client workspace.

Examples

Create a small array and distribute it:

Nsmall = 50;
D1 = distributed(magic(Nsmall));

Create a large distributed array directly, using a build method:

Nlarge = 1000;
D2 = rand(Nlarge,'distributed');
Was this topic helpful?