codistributor2dbc.defaultWorkerGrid - Default computational grid for 2-D block-cyclic distributed arrays - MATLAB
Main Content
Default computational grid for 2-D block-cyclic distributed arrays
Syntax
Description
returns a vector defining a computational grid of grid = codistributor2dbc.defaultWorkerGridnrow-by-ncol workers
such that the product is the number of workers running in the current spmd block or communicating job. To get the number of workers running in the
current spmd block, use the spmdSize
function. The grid defined by codistributor2dbc.defaultWorkerGrid is as
close to a square as possible. The following rules define the nrow and
ncol of the grid:
If the number of workers running in the current
spmdblock is a perfect square,nrow = ncol = sqrt(.spmdSize)If the number of workers running in the current
spmdblock is an odd power of 2, thennrow = ncol/2 = sqrt(.spmdSize/2)nrow <= ncol.If the number of workers running in the current
spmdblock is a prime number,nrow = 1,ncol =.spmdSizenrowis the greatest integer less than or equal tosqrt(for whichspmdSize)ncol =is also an integer.spmdSize/nrow
Examples
collapse all
Use codistributor2dbc.defaultWorkerGrid to get
the layout of the default computational grid for 2-D block-cyclic distributed arrays in an
spmd block.
Create a parallel pool with four workers.
When you execute an spmd block after creating a parallel pool, by
default, all available workers in the pool run the code inside the spmd block.
View the computational grid layout of the default distribution scheme for the
current spmd block.
spmd grid = codistributor2dbc.defaultWorkerGrid end
Worker 3:
grid =
2 2
Worker 4:
grid =
2 2
Worker 1:
grid =
2 2
Worker 2:
grid =
2 2
Output Arguments
collapse all
Default computational grid for 2-D block-cyclic distributed arrays in an
spmd block, returned as a vector of nrow-by-ncol
workers. The product of nrow*nrow is the number of
workers running the current spmd block or communicating job.
Version History
Introduced in R2009b
expand all
The codistributor2dbc.defaultLabGrid function is now called
codistributor2dbc.defaultWorkerGrid. The behavior remains the same.
There are no plans to remove support for
codistributor2dbc.defaultLabGrid.