Architecture in ScotchPy

Architectures are implemented in ScotchPy with the Arch class.

The Arch class

class Arch(init=True)

The graph constructor itself calls libscotch’s archAlloc function, and usually archInit is called too.

Parameters:

init – If True, the architecture allocation is followed by the init. If not, the init() method needs to be called before build/build0(), build2() or load().


init()

This routine is included in a class call with init=True. Mandatory before calling either build() or load(), or after calling exit().


exit()

This routine cleans-up all fields of the instance. Is the opposite of the init() routine. Called automatically when the object is destroyed. Calling explicitly this method is only required when an init() call follows.


load(stream)

This routine builds the architecture from the data included in the given file or stream.

Parameters:

stream (Either a file object (result of an open(), don’t forget to close it) or a filename, as a string or as a bytes object (such as b"file/name").) – Input file or stream to read from.


save(stream)

This routine saves the architecture to the given file or stream in the form of a text string.

Parameters:

stream (Either a file object (result of an open(), don’t forget to close it) or a filename, as a string or as a bytes object (such as b"file/name").) – Input file or stream to read from.


name()

This routine gives the name of the architecture.

Returns:

The name of the architecture.

Return type:

String


size()

This routine gives the size of the architecture.

Returns:

The size of the architecture.

Return type:

Integer


build/build0 (graf, listtab, strat)

These two routines (as of now) fill the contents of the given opaque target structure with the data provided by the user. The source graph provided on input is turned into the deco 1 decomposition-defined target architecture.

Parameters:
  • graf (Graph) – The source graph.

  • listtab (Numpy array or list of integers) – Restricts the vertices to be considered for the architecture.

  • strat (a Strat instance) – Bi-partitioning strategy to be used.


build2(graf, listtab)

This routines fill the contents of the given opaque target structure with the data provided by the user. The source graph provided on input is turned into the deco 1 decomposition-defined target architecture.

Parameters:
  • graf (Graph) – The source graph.

  • listtab (Numpy array or list of integers) – Restricts the vertices to be considered for the architecture.


cmplt(vertnbr)

This routine fills the contents of the given opaque target structure with the description of a complete graph architecture with vertnbr processors.

Parameters:

vertnbr (Integer) – Number of processors that can be used as input.


cmpltw(velotab)

This routine fills the contents of the given opaque target structure with the description of a weighted graph architecture with length of velotab processors.

Parameters:

velotab (Numpy array or list of integers) – Array of processor weights.


hcub(hdimval)

This routine fills the contents of the given opaque target structure with the description of a hypercube graph architecture of dimension hdimval.

Parameters:

hdimval (Integer) – Dimension of the hypercube.


ltLeaf(sizetab, linktab, permtab)

This routine fills the contents of the given opaque target structure with the description of a labeled tree-shaped, hierarchical graph architecture.

Parameters:
  • sizetab (Numpy array or list of integers) – Array of numbers of childs at level (i+1) for each node at level i.

  • linktab (A1ny iterable of integers) – Array of costs of communication between processors the first of which belongs to this level i.

  • permtab (Numpy array or list of integers) – Numpy array or list of integers


mesh(*args)

This routine is generalized version of mesh2(), mesh3() and meshX() - it’s almost meshX(), but the integers don’t have to be wrapped in an iterable and must be given ore after the other.

Parameters:

args (Numpy array or list of integers) – Number of processors in each dimension.


mesh2(xdimval, ydimval)

This routine fills the contents of the given opaque target structure with the description of a 2D mesh architecture with xdimval X ydimval processors.

Parameters:
  • xdimval (Integer) – Number of processors in the X dimension.

  • ydimval (Integer) – Number of processors in the Y dimension.


mesh3(xdimval, ydimval, zdimval)

This routine fills the contents of the given opaque target structure with the description of a 3D mesh architecture with xdimval X ydimval X zdimval processors.

Parameters:
  • xdimval (Integer) – Number of processors in the X dimension.

  • ydimval (Integer) – Number of processors in the Y dimension.

  • zdimval (Integer) – Number of processors in the Z dimension.


meshX(dimntab)

This routine fills the contents of the given opaque target structure with the description of a mesh architecture with length of dimntab- dimension and the product of all elements of dimntab processors.

Parameters:

dimntab (Numpy array or list of integers) – Array of numbers of processors in each dimension.


sub(orgarch, vnumtab)

This routine fills the contents of the given opaque target structure with the description of a subset of the orgarch architecture, restricted to the vertnbr processors which are listed in vnumtab.

Parameters:
  • orgarch (Arch) – Original architecture.

  • vnumtab (Numpy array or list of integers) – Array with processor ranks to be included in the sub-architecture.


tLeaf(sizetab, linktab)

This routine fills the contents of the given opaque target structure with the description of a tree-shaped, hierarchical graph architecture with the sum of all of sizetab processors.

Parameters:
  • sizetab (Numpy array or list of integers) – Array of numbers of childs at level (i+1) for each node at level i.

  • linktab (Numpy array or list of integers) – Array of costs of communication between processors the first of which belongs to this level i.


torus(*args)

This routine is generalized version of torus2(), torus3() and torusX() - it’s almost torusX(), but the integers don’t have to be wrapped in an iterable and must be given ore after the other.

Parameters:

args (Numpy array or list of integers) – Number of processors in each dimension.


torus2(xdimval, ydimval)

This routine fills the contents of the given opaque target structure with the description of a 2D torus architecture with xdimval X ydimval processors.

Parameters:
  • xdimval (Integer) – Number of processors in the X dimension.

  • ydimval (Integer) – Number of processors in the Y dimension.


torus3(xdimval, ydimval, zdimval)

This routine fills the contents of the given opaque target structure with the description of a 3D torus architecture with xdimval X ydimval X zdimval processors.

Parameters:
  • xdimval (Integer) – Number of processors in the X dimension.

  • ydimval (Integer) – Number of processors in the Y dimension.

  • zdimval (Integer) – Number of processors in the Z dimension.


torusX(dimntab)

This routine fills the contents of the given opaque target structure with the description of a torus architecture with length of dimntab- dimension and the product of all elements of dimntab processors.

Parameters:

dimntab (Numpy array or list of integers) – Array of numbers of processors in each dimension.


vhcub():

This routine fills the contents of the given opaque target structure with the description of a ‘variable-sized’ hypercube architecture.


vcmplt():

This routine fills the contents of the given opaque target structure with the description of a ‘variable-sized’ complete graph architecture.


Various functions are defined as wrappers of Arch operations:


arch_alloc()

Recreates the archAlloc function, returning a non-initialized Arch instance. It will need the init() method to be called before the instance be built or loaded upon.