mpi4py.MPI.Datatype

class mpi4py.MPI.Datatype(datatype=None)

Bases: object

Datatype object

Parameters

datatype (Optional[Datatype]) –

Return type

Datatype

static __new__(cls, datatype=None)
Parameters

datatype (Optional[Datatype]) –

Return type

Datatype

Methods Summary

Commit()

Commit the datatype

Create_contiguous(count)

Create a contiguous datatype

Create_darray(size, rank, gsizes, distribs, ...)

Create a datatype representing an HPF-like distributed array on Cartesian process grids

Create_f90_complex(p, r)

Return a bounded complex datatype

Create_f90_integer(r)

Return a bounded integer datatype

Create_f90_real(p, r)

Return a bounded real datatype

Create_hindexed(blocklengths, displacements)

Create an indexed datatype with displacements in bytes

Create_hindexed_block(blocklength, displacements)

Create an indexed datatype with constant-sized blocks and displacements in bytes

Create_hvector(count, blocklength, stride)

Create a vector (strided) datatype

Create_indexed(blocklengths, displacements)

Create an indexed datatype

Create_indexed_block(blocklength, displacements)

Create an indexed datatype with constant-sized blocks

Create_keyval([copy_fn, delete_fn, nopython])

Create a new attribute key for datatypes

Create_resized(lb, extent)

Create a datatype with a new lower bound and extent

Create_struct(blocklengths, displacements, ...)

Create an datatype from a general set of block sizes, displacements and datatypes

Create_subarray(sizes, subsizes, starts[, order])

Create a datatype for a subarray of a regular, multidimensional array

Create_vector(count, blocklength, stride)

Create a vector (strided) datatype

Delete_attr(keyval)

Delete attribute value associated with a key

Dup()

Duplicate a datatype

Free()

Free the datatype

Free_keyval(keyval)

Free an attribute key for datatypes

Get_attr(keyval)

Retrieve attribute value by key

Get_contents()

Retrieve the actual arguments used in the call that created a datatype

Get_envelope()

Return information on the number and type of input arguments used in the call that created a datatype

Get_extent()

Return lower bound and extent of datatype

Get_name()

Get the print name for this datatype

Get_size()

Return the number of bytes occupied by entries in the datatype

Get_true_extent()

Return the true lower bound and extent of a datatype

Match_size(typeclass, size)

Find a datatype matching a specified size in bytes

Pack(inbuf, outbuf, position, comm)

Pack into contiguous memory according to datatype.

Pack_external(datarep, inbuf, outbuf, position)

Pack into contiguous memory according to datatype, using a portable data representation (external32).

Pack_external_size(datarep, count)

Return the upper bound on the amount of space (in bytes) needed to pack a message according to datatype, using a portable data representation (external32).

Pack_size(count, comm)

Return the upper bound on the amount of space (in bytes) needed to pack a message according to datatype.

Set_attr(keyval, attrval)

Store attribute value associated with a key

Set_name(name)

Set the print name for this datatype

Unpack(inbuf, position, outbuf, comm)

Unpack from contiguous memory according to datatype.

Unpack_external(datarep, inbuf, position, outbuf)

Unpack from contiguous memory according to datatype, using a portable data representation (external32).

decode()

Convenience method for decoding a datatype

f2py(arg)

py2f()

Attributes Summary

combiner

datatype combiner

contents

datatype contents

envelope

datatype envelope

extent

is_named

is a named datatype

is_predefined

is a predefined datatype

lb

lower bound

name

datatype name

size

true_extent

true extent

true_lb

true lower bound

true_ub

true upper bound

ub

upper bound

Methods Documentation

Commit()

Commit the datatype

Return type

Datatype

Create_contiguous(count)

Create a contiguous datatype

Parameters

count (int) –

Return type

Datatype

Create_darray(size, rank, gsizes, distribs, dargs, psizes, order=ORDER_C)

Create a datatype representing an HPF-like distributed array on Cartesian process grids

Parameters
  • size (int) –

  • rank (int) –

  • gsizes (Sequence[int]) –

  • distribs (Sequence[int]) –

  • dargs (Sequence[int]) –

  • psizes (Sequence[int]) –

  • order (int) –

Return type

Datatype

classmethod Create_f90_complex(p, r)

Return a bounded complex datatype

Parameters
Return type

Datatype

classmethod Create_f90_integer(r)

Return a bounded integer datatype

Parameters

r (int) –

Return type

Datatype

classmethod Create_f90_real(p, r)

Return a bounded real datatype

Parameters
Return type

Datatype

Create_hindexed(blocklengths, displacements)

Create an indexed datatype with displacements in bytes

Parameters
  • blocklengths (Sequence[int]) –

  • displacements (Sequence[int]) –

Return type

Datatype

Create_hindexed_block(blocklength, displacements)

Create an indexed datatype with constant-sized blocks and displacements in bytes

Parameters
  • blocklength (int) –

  • displacements (Sequence[int]) –

Return type

Datatype

Create_hvector(count, blocklength, stride)

Create a vector (strided) datatype

Parameters
  • count (int) –

  • blocklength (int) –

  • stride (int) –

Return type

Datatype

Create_indexed(blocklengths, displacements)

Create an indexed datatype

Parameters
  • blocklengths (Sequence[int]) –

  • displacements (Sequence[int]) –

Return type

Datatype

Create_indexed_block(blocklength, displacements)

Create an indexed datatype with constant-sized blocks

Parameters
  • blocklength (int) –

  • displacements (Sequence[int]) –

Return type

Datatype

classmethod Create_keyval(copy_fn=None, delete_fn=None, nopython=False)

Create a new attribute key for datatypes

Parameters
Return type

int

Create_resized(lb, extent)

Create a datatype with a new lower bound and extent

Parameters
  • lb (int) –

  • extent (int) –

Return type

Datatype

classmethod Create_struct(blocklengths, displacements, datatypes)

Create an datatype from a general set of block sizes, displacements and datatypes

Parameters
  • blocklengths (Sequence[int]) –

  • displacements (Sequence[int]) –

  • datatypes (Sequence[Datatype]) –

Return type

Datatype

Create_subarray(sizes, subsizes, starts, order=ORDER_C)

Create a datatype for a subarray of a regular, multidimensional array

Parameters
  • sizes (Sequence[int]) –

  • subsizes (Sequence[int]) –

  • starts (Sequence[int]) –

  • order (int) –

Return type

Datatype

Create_vector(count, blocklength, stride)

Create a vector (strided) datatype

Parameters
  • count (int) –

  • blocklength (int) –

  • stride (int) –

Return type

Datatype

Delete_attr(keyval)

Delete attribute value associated with a key

Parameters

keyval (int) –

Return type

None

Dup()

Duplicate a datatype

Return type

Datatype

Free()

Free the datatype

Return type

None

classmethod Free_keyval(keyval)

Free an attribute key for datatypes

Parameters

keyval (int) –

Return type

int

Get_attr(keyval)

Retrieve attribute value by key

Parameters

keyval (int) –

Return type

Optional[Union[int, Any]]

Get_contents()

Retrieve the actual arguments used in the call that created a datatype

Return type

Tuple[List[int], List[int], List[Datatype]]

Get_envelope()

Return information on the number and type of input arguments used in the call that created a datatype

Return type

Tuple[int, int, int, int]

Get_extent()

Return lower bound and extent of datatype

Return type

Tuple[int, int]

Get_name()

Get the print name for this datatype

Return type

str

Get_size()

Return the number of bytes occupied by entries in the datatype

Return type

int

Get_true_extent()

Return the true lower bound and extent of a datatype

Return type

Tuple[int, int]

classmethod Match_size(typeclass, size)

Find a datatype matching a specified size in bytes

Parameters
  • typeclass (int) –

  • size (int) –

Return type

Datatype

Pack(inbuf, outbuf, position, comm)

Pack into contiguous memory according to datatype.

Parameters
  • inbuf (BufSpec) –

  • outbuf (BufSpec) –

  • position (int) –

  • comm (Comm) –

Return type

int

Pack_external(datarep, inbuf, outbuf, position)

Pack into contiguous memory according to datatype, using a portable data representation (external32).

Parameters
  • datarep (str) –

  • inbuf (BufSpec) –

  • outbuf (BufSpec) –

  • position (int) –

Return type

int

Pack_external_size(datarep, count)

Return the upper bound on the amount of space (in bytes) needed to pack a message according to datatype, using a portable data representation (external32).

Parameters
  • datarep (str) –

  • count (int) –

Return type

int

Pack_size(count, comm)

Return the upper bound on the amount of space (in bytes) needed to pack a message according to datatype.

Parameters
Return type

int

Set_attr(keyval, attrval)

Store attribute value associated with a key

Parameters
  • keyval (int) –

  • attrval (Any) –

Return type

None

Set_name(name)

Set the print name for this datatype

Parameters

name (str) –

Return type

None

Unpack(inbuf, position, outbuf, comm)

Unpack from contiguous memory according to datatype.

Parameters
  • inbuf (BufSpec) –

  • position (int) –

  • outbuf (BufSpec) –

  • comm (Comm) –

Return type

int

Unpack_external(datarep, inbuf, position, outbuf)

Unpack from contiguous memory according to datatype, using a portable data representation (external32).

Parameters
  • datarep (str) –

  • inbuf (BufSpec) –

  • position (int) –

  • outbuf (BufSpec) –

Return type

int

decode()

Convenience method for decoding a datatype

Return type

Tuple[Datatype, str, Dict[str, Any]]

classmethod f2py(arg)
Parameters

arg (int) –

Return type

Datatype

py2f()
Return type

int

Attributes Documentation

combiner

datatype combiner

contents

datatype contents

envelope

datatype envelope

extent
is_named

is a named datatype

is_predefined

is a predefined datatype

lb

lower bound

name

datatype name

size
true_extent

true extent

true_lb

true lower bound

true_ub

true upper bound

ub

upper bound