Box#

class nvmath.distributed.distribution.Box(
lower: Sequence[int],
upper: Sequence[int],
)[source]#

Box distribution

Methods

__init__(
lower: Sequence[int],
upper: Sequence[int],
)[source]#
copy() Distribution[source]#

This is a common implementation for those distributions that only require a shallow copy.

shape(
rank: int,
global_shape: Sequence[int] | None = None,
) tuple[int, ...][source]#

Get the local shape of data on the given rank according to this distribution.

Parameters:
  • rank – the process rank for which to calculate the local shape.

  • global_shape – Global shape of data. Required if the distribution is not bound to a global shape, otherwise not required.

to(cls, /, *, ndim=None, copy=False)[source]#

Convert this distribution object to an equivalent distribution of the given type.

Parameters:
  • cls – the target distribution type.

  • ndim – dimensionality of the target distribution. Must be compatible with the dimensionality of the source distribution. This may be required if the source distribution doesn’t have associated dimensionality.

  • copy – Returns a copy if the source and target type are the same.

Raises:

ConvertDistributionError – if the conversion is not possible.

Attributes

lower#

Box lower coordinates

ndim#
upper#

Box upper coordinates