nvalchemi.dynamics.DataSink#

class nvalchemi.dynamics.DataSink[source]#

Abstract base class for local storage of Batch data.

DataSink provides a unified interface for storing and retrieving batched atomic data. Implementations can target different storage backends such as GPU memory, CPU memory, or disk.

capacity#

Maximum number of samples that can be stored.

Type:

int

write(batch)[source]#

Store a batch of data.

read()[source]#

Retrieve all stored data as a Batch.

drain()[source]#

Read all stored data and clear the sink.

zero()[source]#

Clear all stored data.

__len__()[source]#

Return the number of samples currently stored.

Examples

>>> sink = HostMemory(capacity=100)
>>> sink.write(batch)
>>> len(sink)
2
>>> retrieved = sink.read()
__init__()#

Methods

__init__()

drain()

Read all stored samples and clear the sink.

read()

Retrieve all stored data as a single Batch.

write(batch[, mask])

Store a batch of atomic data.

zero()

Clear all stored data and reset the buffer.

Attributes

capacity

Return the maximum storage capacity.

global_rank

Return the global rank of this data sink.

is_full

Check if the buffer has reached capacity.

local_rank

Return the local rank of this data sink.