InputArrays
- class cubie.batchsolving.arrays.BatchInputArrays.InputArrays(precision: type = <class 'numpy.float32'>, chunks: int = 0, stream_group: str = 'default', memory_proportion: float | None = None, memory_manager: MemoryManager = MemoryManager(totalmem=8589934592, registry={}, stream_groups=StreamGroups(groups={}, streams={}), _mode='passive', _allocator=<class 'cubie.cuda_simsafe.FakeNumbaCUDAMemoryManager'>, _auto_pool=[], _manual_pool=[], _queued_allocations={}), num_runs: int = 1, sizes: BatchInputSizes | None = NOTHING, host: InputArrayContainer = NOTHING)[source]
Bases:
BaseArrayManagerManage allocation and transfer of batch input arrays.
- Parameters:
_sizes (cubie.outputhandling.output_sizes.BatchInputSizes | None) – Size specifications for the input arrays.
host (cubie.batchsolving.arrays.BatchInputArrays.InputArrayContainer) – Container for host-side arrays.
device (cubie.batchsolving.arrays.BatchInputArrays.InputArrayContainer) – Container for device-side arrays.
Notes
Instances are configured from
BatchSolverKernelmetadata. Updates request memory through the shared manager, ensure array heights match solver expectations, and attach received buffers prior to device transfers.- device: InputArrayContainer
- property device_driver_coefficients: ndarray[Any, dtype[_ScalarType_co]] | FakeCUDAArray | None
Device driver coefficients array.
- property device_initial_values: ndarray[Any, dtype[_ScalarType_co]] | FakeCUDAArray | None
Device initial values array.
- property device_parameters: ndarray[Any, dtype[_ScalarType_co]] | FakeCUDAArray | None
Device parameters array.
- property driver_coefficients: ndarray[Any, dtype[_ScalarType_co]] | FakeCUDAArray | None
Host driver coefficients array.
- classmethod from_solver(solver_instance: BatchSolverKernel) InputArrays[source]
Create an InputArrays instance from a solver.
Creates an empty instance from a solver instance, importing the heights of the parameters, initial values, and driver arrays from the ODE system for checking inputs against. Does not allocate host or device arrays.
- Parameters:
solver_instance – The solver instance to extract configuration from.
- Returns:
A new InputArrays instance configured for the solver.
- Return type:
- host: InputArrayContainer
- property initial_values: ndarray[Any, dtype[_ScalarType_co]] | FakeCUDAArray | None
Host initial values array.
- initialise(chunk_index: int) None[source]
Copy a batch chunk of host data to device buffers.
- Parameters:
chunk_index – Indices for the chunk being initialized.
- Returns:
Host slices are staged into device arrays in place.
- Return type:
None
Notes
For chunked mode, pinned buffers are acquired from the pool for staging data before H2D transfer. Buffers are stored in _active_buffers and released after the H2D transfer completes. For non-chunked mode, pinned buffers are allocated directly.
- property parameters: ndarray[Any, dtype[_ScalarType_co]] | FakeCUDAArray | None
Host parameters array.
- release_buffers() None[source]
Release all active buffers back to the pool.
Should be called after H2D transfer completes to return pooled pinned buffers for reuse by subsequent chunks.
- update(solver_instance: BatchSolverKernel, initial_values: ndarray[Any, dtype[_ScalarType_co]], parameters: ndarray[Any, dtype[_ScalarType_co]], driver_coefficients: ndarray[Any, dtype[_ScalarType_co]] | None) None[source]
Set host arrays and request device allocations.
- Parameters:
solver_instance – The solver instance providing configuration and sizing information.
initial_values – Initial state values for each integration run.
parameters – Parameter values for each integration run.
driver_coefficients – Horner-ordered driver interpolation coefficients.
- Returns:
This method updates internal references and enqueues allocations.
- Return type:
None
- update_from_solver(solver_instance: BatchSolverKernel) None[source]
Refresh size, precision, and chunk axis from the solver.
- Parameters:
solver_instance – The solver instance to update from.
- Return type:
None