cubie.memory.stream_groups
Stream group management for organizing instances and CUDA streams.
This module provides functionality to group instances together and assign them to shared CUDA streams for coordinated memory operations and kernel execution.
Classes
|
Container for organizing instances into groups with shared CUDA streams. |
- class cubie.memory.stream_groups.StreamGroups(groups: dict[str, list[int]] | None = NOTHING, streams: dict[str, FakeStream | int] = NOTHING)[source]
Bases:
object
Container for organizing instances into groups with shared CUDA streams.
- Parameters:
Notes
Each group has an associated CUDA stream that all instances in the group share for coordinated operations. The ‘default’ group is created automatically.
- add_instance(instance, group)[source]
Add an instance to a stream group.
- Parameters:
- Raises:
ValueError – If the instance is already in a stream group.
Notes
If the group doesn’t exist, it will be created with a new CUDA stream.
- change_group(instance, new_group)[source]
Move an instance to another stream group.
- Parameters:
Notes
If the new group doesn’t exist, it will be created with a new CUDA stream.
- get_group(instance)[source]
Get the stream group associated with an instance.
- Parameters:
instance (object or int) – The instance to find the group for, or its ID.
- Returns:
Name of the group containing the instance.
- Return type:
- Raises:
ValueError – If the instance is not in any stream groups.