mpi4py.MPI.memory

class mpi4py.MPI.memory(buf)

Bases: object

Memory buffer

Parameters

buf (Buffer) –

Return type

memory

static __new__(cls, buf)
Parameters

buf (Buffer) –

Return type

memory

Methods Summary

allocate(nbytes[, clear])

Memory allocation

fromaddress(address, nbytes[, readonly])

Memory from address and size in bytes

frombuffer(obj[, readonly])

Memory from buffer-like object

release()

Release the underlying buffer exposed by the memory object

tobytes([order])

Return the data in the buffer as a byte string

toreadonly()

Return a readonly version of the memory object

Attributes Summary

address

Memory address

format

A string with the format of each element

itemsize

The size in bytes of each element

nbytes

Memory size (in bytes)

obj

The underlying object of the memory

readonly

Boolean indicating whether the memory is read-only

Methods Documentation

static allocate(nbytes, clear=False)

Memory allocation

Parameters
  • nbytes (int) –

  • clear (bool) –

Return type

memory

static fromaddress(address, nbytes, readonly=False)

Memory from address and size in bytes

Parameters
  • address (int) –

  • nbytes (int) –

  • readonly (bool) –

Return type

memory

static frombuffer(obj, readonly=False)

Memory from buffer-like object

Parameters
  • obj (Buffer) –

  • readonly (bool) –

Return type

memory

release()

Release the underlying buffer exposed by the memory object

Return type

None

tobytes(order=None)

Return the data in the buffer as a byte string

Parameters

order (Optional[str]) –

Return type

bytes

toreadonly()

Return a readonly version of the memory object

Return type

memory

Attributes Documentation

address

Memory address

format

A string with the format of each element

itemsize

The size in bytes of each element

nbytes

Memory size (in bytes)

obj

The underlying object of the memory

readonly

Boolean indicating whether the memory is read-only