• Types of Distribution
  • Block Distribution
  • Cyclic Distribution
  • Block-Cyclic Distribution
  • Uneven Distribution

Types of Distribution

The types of distribution available for templates are given below. The appropriate distribution is selected based on the application. Here P is the number of nodes and N is the size of the template, and their declarations are as follows:

  • Fortran
!$xmp nodes nd(P)
!$xmp template tp(N)
  • C
#pragma xmp nodes nd(P)
#pragma xmp template tp(0:N-1)

Block Distribution

  • Fortran
!$xmp distribute tp(block) onto nd
  • C
#pragma xmp distribute tp(block) onto nd

This is the most often used distribution. It is suitable for computations that involve many references to neighboring elements, such as the finite difference method. The block width for making an assignment to each node is calculated by,

block-width.pngThe result is left justified.

  • Fortran
!$xmp nodes nd(3)
!$xmp template tp(0:21)
!$xmp distribute tp(block) onto p
  • C
#pragma xmp nodes nd(3)
#pragma xmp template tp(0:21)
#pragma xmp distribute tp(block) onto p

block-width2.png

Cyclic Distribution

  • Fortran
!$xmp distribute tp(cyclic) onto nd
  • C
#pragma xmp distribute tp(cyclic) onto nd

This distribution can be used when the computation load is biased or dispersed irregularly.

  • Fortran
!$xmp nodes nd(3)
!$xmp template tp(0:21)
!$xmp distribute tp(cyclic) onto p
  • C
#pragma xmp nodes nd(3)
#pragma xmp template tp(0:21)
#pragma xmp distribute tp(cyclic) onto p

cyclic.png

Block-Cyclic Distribution

  • Fortran
!$xmp distribute tp(cyclic(w)) onto nd
  • C
#pragma xmp distribute tp(cyclic(w)) onto nd

This is a distribution that is between the block and cyclic distributions. This distribution can be used when block distribution causes the load to become uneven, while the cyclic distribution increases communication for referencing neighboring elements. The user specifies the block width. When w = 1, this becomes the same as the cyclic distribution.

  • Fortran
!$xmp nodes nd(3)
!$xmp template tp(0:21)
!$xmp distribute tp(cyclic(3)) onto p
  • C
#pragma xmp nodes nd(3)
#pragma xmp template tp(0:21)
#pragma xmp distribute tp(cyclic(3)) onto p

block-cyclic.png

Uneven Distribution

  • Fortran
!$xmp distribute tp(gblock(W)) onto nd
  • C
#pragma xmp tp(gblock(W)) onto nd

W is called the mapping array and is a vector of size P. W(k) is the length assigned to node nd(k). This is used when we know in advance of execution that there will be a bias in the computation load, such as with triangular matrices.

  • Fortran
!$xmp nodes nd(3)
!$xmp template tp(0:21)
integer,parameter :: W(3)=(/6,11,5/)
!$xmp distribute tp(gblock(W)) onto p
  • C
#pragma xmp nodes nd(3)
#pragma xmp template tp(0:21)
int W[3]={6,11,5};
#pragma xmp distribute tp(gblock(W)) onto p

gblock.png