User`s guide
5 Math with Codistributed Arrays
5-6
end
Lab 1: This lab stores D(:,1:250).
Lab 2: This lab stores D(:,251:500).
Lab 3: This lab stores D(:,501:750).
Lab 4: This lab stores D(:,751:1000).
Each worker has access to all segments of the array. Access to the local segment is
faster than to a remote segment, because the latter requires sending and receiving data
between workers and thus takes more time.
How MATLAB Displays a Codistributed Array
For each worker, the MATLAB Parallel Command Window displays information about
the codistributed array, the local portion, and the codistributor. For example, an 8-by-8
identity matrix codistributed among four workers, with two columns on each worker,
displays like this:
>> spmd
II = eye(8,'codistributed')
end
Lab 1:
This lab stores II(:,1:2).
LocalPart: [8x2 double]
Codistributor: [1x1 codistributor1d]
Lab 2:
This lab stores II(:,3:4).
LocalPart: [8x2 double]
Codistributor: [1x1 codistributor1d]
Lab 3:
This lab stores II(:,5:6).
LocalPart: [8x2 double]
Codistributor: [1x1 codistributor1d]
Lab 4:
This lab stores II(:,7:8).
LocalPart: [8x2 double]
Codistributor: [1x1 codistributor1d]
To see the actual data in the local segment of the array, use the getLocalPart function.
How Much Is Distributed to Each Worker
In distributing an array of N rows, if N is evenly divisible by the number of workers,
MATLAB stores the same number of rows (N/numlabs) on each worker. When this