legate.core.Runtime.create_store_from_buffer#
- Runtime.create_store_from_buffer(self, Type dtype, shape: Shape | Collection[int], data, bool read_only) LogicalStore #
Creates a Legate store from a Python object implementing the Python buffer protocol.
- Parameters:
dtype (Type) – Type of the store’s elements
shape (Shape | Collection[int]) – Shape of the store
data (object) – A Python object that implements the Python buffer protocol
read_only (bool) – Whether the buffer of the passed object should be treated read-only or not. If
False
, any changes made to the store will also be visible via the Python object.
- Returns:
Logical store attached to the buffer of the passed object
- Return type:
LogicalStore
- Raises:
BufferError – If the passed object does not implement the Python buffer protocol
Notes
It’s the callers’ responsibility to make sure that buffers passed to this function are never partially aliased; i.e., Python objects
A
andB
passed to this function must be backed by either the exact same buffer or two non-overlapping buffers. The code will exhibit undefined behavior in the presence of partial aliasing.