User`s guide
3 Single Program Multiple Data (spmd)
3-10
Distribute Arrays
In this section...
“Distributed Versus Codistributed Arrays” on page 3-10
“Create Distributed Arrays” on page 3-10
“Create Codistributed Arrays” on page 3-11
Distributed Versus Codistributed Arrays
You can create a distributed array in the MATLAB client, and its data is stored on the
workers of the open parallel pool. A distributed array is distributed in one dimension,
along the last nonsingleton dimension, and as evenly as possible along that dimension
among the workers. You cannot control the details of distribution when creating a
distributed array.
You can create a codistributed array by executing on the workers themselves, either
inside an spmd statement, in pmode, or inside a communicating job. When creating a
codistributed array, you can control all aspects of distribution, including dimensions and
partitions.
The relationship between distributed and codistributed arrays is one of perspective.
Codistributed arrays are partitioned among the workers from which you execute code
to create or manipulate them. Distributed arrays are partitioned among workers in the
parallel pool. When you create a distributed array in the client, you can access it as a
codistributed array inside an spmd statement. When you create a codistributed array
in an spmd statement, you can access is as a distributed array in the client. Only spmd
statements let you access the same array data from two different perspectives.
Create Distributed Arrays
You can create a distributed array in any of several ways:
• Use the distributed function to distribute an existing array from the client
workspace to the workers of a parallel pool.
• Use any of the overloaded distributed object methods to directly construct a
distributed array on the workers. This technique does not require that the
array already exists in the client, thereby reducing client workspace memory