Access elements of distributed arrays from client
You can also create a distributed array explicitly from the client with any of several MATLAB functions, shown in the table.
|
|
|
|
| distributed.cell |
| distributed.spalloc |
| distributed.speye |
| distributed.sprand |
| distributed.sprandn |
|
Distributed arrays represent those arrays which are partitioned out among the workers in a parallel pool. A distributed array resembles a normal MATLAB array in the way you index and manipulate its elements, but none of its elements exists on the client.
Codistributed arrays that you create inside spmd
statements are accessible as distributed
arrays from the client.
Use the gather
function
to retrieve distributed arrays into the client work space.
Inf | Array of infinity |
NaN | Array of Not-a-Numbers |
classUnderlying | Class of elements within gpuArray or distributed array |
distributed.cell | Create distributed cell array |
distributed.spalloc | Allocate space for sparse distributed matrix |
distributed.speye | Create distributed sparse identity matrix |
distributed.sprand | Create distributed sparse array of uniformly distributed pseudo-random values |
distributed.sprandn | Create distributed sparse array of normally distributed pseudo-random values |
eye | Identity matrix |
false | Array of logical 0 (false) |
gather | Transfer distributed array or gpuArray to local workspace |
isaUnderlying | True if distributed array's underlying elements are of specified class |
isdistributed | True for distributed array |
ones | Array of ones |
rand | Array of rand values |
randi | Array of random integers |
randn | Array of randn values |
sparse | Create sparse distributed or codistributed matrix |
true | Array of logical 1 (true) |
write | Write distributed data to an output location |
zeros | Array of zeros |
The methods for distributed arrays are too numerous to list here. Most resemble and behave the same as built-in MATLAB functions. See Using MATLAB Functions on Distributed Arrays.
Also among the methods are several for examining the characteristics of the array itself. Most behave like the MATLAB functions of the same name:
Function | Description |
---|---|
| Class (data type) of the elements in the array |
isdistributed | Indication if array is distributed |
isreal | Indication if array elements are real |
length | Length of vector or largest array dimension |
ndims | Number of dimensions in the array |
size | Size of array dimensions |