tinygrad runtime.ops_disk
Note
You likely want the upstream tinygrad, not tinygrab. Tinygrab contains AI generated docstrings for a tinygrad snapshot. Upstream: https://tinygrad.org
- class tinygrad.runtime.ops_disk.DiskAllocator(device)[source]
Bases:
Allocator
DiskAllocator class for allocating disk space.
- device
The device to be used for allocation.
- Type:
str
- as_buffer(src: DiskBuffer)[source]
Returns the underlying buffer of a DiskBuffer object.
- Parameters:
src (DiskBuffer) – The DiskBuffer object to get the buffer from.
- Returns:
The underlying buffer of the DiskBuffer object.
- Return type:
- copyin(dest: DiskBuffer, src: memoryview)[source]
Copies data from a memoryview object to a DiskBuffer object.
- Parameters:
dest (DiskBuffer) – The destination DiskBuffer object.
src (memoryview) – The source memoryview object.
- copyout(dest: memoryview, src: DiskBuffer)[source]
Copies data from a DiskBuffer object to a memoryview object.
- Parameters:
dest (memoryview) – The destination memoryview object.
src (DiskBuffer) – The source DiskBuffer object.
- class tinygrad.runtime.ops_disk.DiskBuffer(ud: ~tinygrad.runtime.ops_disk.UnderlyingDiskBuffer, size: int, dtype: ~tinygrad.helpers.DType = (2, 1, 'unsigned char', <class 'numpy.uint8'>, 1), offset=0)[source]
Bases:
object
Class for handling disk buffer operations.
- ud
Underlying disk buffer.
- Type:
- size
Size of the buffer.
- Type:
int
- offset
Offset in the buffer. Default is 0.
- Type:
int
- as_strided(arg)[source]
Create a view of the original buffer with new dimensions and strides.
- Parameters:
arg – A tuple containing the new shape, calculated strides and an offset.
- Returns:
A new DiskBuffer with the reshaped data.
- Return type:
- class tinygrad.runtime.ops_disk.DiskDevice(device)[source]
Bases:
Interpreted
Initialize a new DiskDevice object.
- Parameters:
device (str) – The device identifier for the disk to be allocated.
- super
Inherit from the Interpreted class.
- Type:
- DiskAllocator
Initialize a new DiskAllocator object with the given device.
- Type:
- disk_fxn_for_op
The function to be used for performing operations on the disk.
- Type:
function
- class tinygrad.runtime.ops_disk.UnderlyingDiskBuffer(fd, mem)[source]
Bases:
object
This class represents an underlying disk buffer. It is initialized with a file descriptor (fd) and memory (mem).
- fd
The file descriptor of the disk buffer.
- Type:
file descriptor
- mem
The in-memory data associated with the disk buffer.
- Type:
memory