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
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
Return the maximum storage capacity.
global_rankReturn the global rank of this data sink.
is_fullCheck if the buffer has reached capacity.
local_rankReturn the local rank of this data sink.