codistributor2dbc - 2-D block-cyclic distribution scheme for codistributed array - MATLAB (original) (raw)

2-D block-cyclic distribution scheme for codistributed array

Description

A codistributor2dbc object defines the two-dimensional block-cyclic distribution scheme for a codistributed array object. The 2-D block-cyclic codistributor can distribute only two-dimensional matrices. It distributes matrices along two subscripts over a rectangular computational grid of workers in a blocked, cyclic manner. For a complete description of 2-D block-cyclic distribution, default parameters, and the relationship between block size and worker grid, see 2-Dimensional Distribution. The parallel matrix computation software library ScaLAPACK uses the 2-D block-cyclic codistributor.

Creation

Syntax

Description

`codist` = codistributor2dbc creates a two-dimensional block-cyclic codistributed2dbc codistributor object using the default worker grid and block size.

example

`codist` = codistributor2dbc(`WorkerGrid`) creates a two-dimensional block-cyclic codistributor object with a specified[WorkerGrid](codistributor2dbc.html#mw%5Ff627b729-5b29-4682-83cc-5ae53b7e495e) value and default block size.

`codist` = codistributor2dbc(`WorkerGrid`,`BlockSize`) creates a two-dimensional block-cyclic codistributor object with the specified[WorkerGrid](codistributor2dbc.html#mw%5Ff627b729-5b29-4682-83cc-5ae53b7e495e) and [BlockSize](codistributor2dbc.html#mw%5F3adc209d-6e36-468c-95ed-c0b99a532a61) values.

`codist` = codistributor2dbc(`WorkerGrid`,`BlockSize`,`Orientation`) also specifies the [Orientation](codistributor2dbc.html#mw%5F94f41776-ba57-4d49-a571-f3d4b1d9c2cf) property.

The resulting codistributor of any of the above syntaxes is incomplete because its global size is not specified. Use a codistributor constructed this way as an argument to other functions as a template codistributor when creating codistributed arrays.

`codist` = codistributor2dbc(`WorkerGrid`,`BlockSize`,`Orientation`,[gsize](#mw%5Ff604ff93-cf34-4cfe-bd09-d65f50e82cd1)) creates a codistributor object with the global size gsize.

The resulting codistributor object is complete. Use a codistributor constructed this way to build a codistributed array from its local parts with the codistributed.build function. To use the default values for each argument, specify WorkerGrid ascodistributor2dbc.defaultWorkerGrid, BlockSize as codistributor2dbc.defaultBlockSize, andOrientation ascodistributor2dbc.defaultOrientation.

example

Input Arguments

expand all

Global size of the codistributed array, specified as an integer.

Properties

expand all

Worker grid of the codistributor2dbc object, specified as a two-element vector defining the rows and columns of the worker grid. The number of rows multiplied by the number of columns must equal the number of workers for the codistributed array.

Block size of the codistributor2dbc object, specified as a positive integer. This property is the ScaLAPACK block size associated with thecodistributor2dbc object.

Orientation of the codistributor2dbc object, specified as one of these values:

Data Types: char

Object Functions

codistributed.cell Create codistributed cell array
codistributed.colon Distributed colon operation
codistributed.spalloc Allocate space for sparse codistributed matrix
codistributed.speye Create codistributed sparse identity matrix
codistributed.sprand Create codistributed sparse array of uniformly distributed pseudo-random values
codistributed.sprandn Create codistributed sparse array of normally distributed pseudo-random values
codistributor2dbc.defaultWorkerGrid Default computational grid for 2-D block-cyclic distributed arrays
eye Create codistributed identity matrix
false Create codistributed array of logical 0 (false)
globalIndices Global indices for local part of codistributed array
Inf Create codistributed array of all Inf values
isComplete True if codistributor object is complete
NaN Create codistributed array of all NaN values
ones Create codistributed array of all ones
rand Create codistributed array of uniformly distributed random numbers
randn Create codistributed array of normally distributed random numbers
sparse Create codistributed sparse matrix
true Create codistributed array of logical 1 (true)
zeros Create codistributed array of all zeros

Examples

collapse all

Use a codistributor2dbc object to create anN-by-N matrix of ones.

N = 1000; spmd codistr = codistributor2dbc;
D = ones(N,codistr); end

Use a fully specified codistributor2dbc object to create a N-by-N codistributed matrix from its local parts.

Use the default values for the worker grid and block size, and specify the orientation and the grid size of the worker grid.

spmd codistr = codistributor2dbc(... codistributor2dbc.defaultWorkerGrid, ... codistributor2dbc.defaultBlockSize, ... 'row',[N,N]); end

Use the globalIndices method on the codistributor object to get the global indices for the local part of the codistributed array before creating the array itself. Use length to get the length of the largest global index and set it as the size of the local part of the codistributed array. Create the codistributed array with the codistributed.build function.

spmd myLocalSize = [length(globalIndices(codistr,1)), ... length(globalIndices(codistr,2))]; myLocalPart = spmdIndex*ones(myLocalSize); D = codistributed.build(myLocalPart,codistr); end

Then use the spy function to visualize which elements are stored on worker 2.

The sparsity pattern shows the distribution of the elements of array D stored on worker 2.

Version History

Introduced in R2009b