IVPLoop
- class cubie.integrators.IVPLoop(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], n_states: int, compile_flags: OutputCompileFlags, n_parameters: int = 0, n_drivers: int = 0, n_observables: int = 0, n_error: int = 0, n_counters: int = 0, state_summaries_buffer_height: int = 0, observable_summaries_buffer_height: int = 0, save_every: float | None = None, summarise_every: float | None = None, sample_summaries_every: float | None = None, save_state_fn: Callable | None = None, update_summaries_fn: Callable | None = None, save_summaries_fn: Callable | None = None, step_controller_fn: Callable | None = None, step_fn: Callable | None = None, drivers_fn: Callable | None = None, observables_fn: Callable | None = None, **kwargs)[source]
Bases:
CUDAFactoryFactory for CUDA device loops that advance an IVP integration.
- Parameters:
precision – Precision used for state and observable updates.
n_states – Number of state variables.
compile_flags – Output configuration that drives save and summary behaviour.
n_parameters – Number of parameters.
n_drivers – Number of driver variables.
n_observables – Number of observable variables.
n_error – Number of error elements (typically equals n_states for adaptive).
n_counters – Number of counter elements.
state_summaries_buffer_height – Height of state summary buffer.
observable_summaries_buffer_height – Height of observable summary buffer.
save_every – Interval between accepted saves. Defaults to None (auto-configured).
summarise_every – Interval between summary accumulations. Defaults to None (auto-configured).
sample_summaries_every – Interval between summary metric updates. Must be an integer divisor of
summarise_every. Defaults to None (auto-configured).save_state_fn – Device function that writes state and observable snapshots.
update_summaries_fn – Device function that accumulates summary statistics.
save_summaries_fn – Device function that commits summary statistics to output buffers.
step_controller_fn – Device function that updates the timestep and accept flag.
step_fn – Device function that advances the solution by one tentative step.
drivers_fn – Device function that evaluates drivers for a given time.
observables_fn – Device function that computes observables for proposed states.
**kwargs – Optional parameters passed to ODELoopConfig. Available parameters include dt, is_adaptive, and buffer location parameters (state_location, proposed_state_location, parameters_location, drivers_location, proposed_drivers_location, observables_location, proposed_observables_location, error_location, counters_location, state_summary_location, observable_summary_location, dt_location, accept_step_location). None values are ignored.
- __init__(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], n_states: int, compile_flags: OutputCompileFlags, n_parameters: int = 0, n_drivers: int = 0, n_observables: int = 0, n_error: int = 0, n_counters: int = 0, state_summaries_buffer_height: int = 0, observable_summaries_buffer_height: int = 0, save_every: float | None = None, summarise_every: float | None = None, sample_summaries_every: float | None = None, save_state_fn: Callable | None = None, update_summaries_fn: Callable | None = None, save_summaries_fn: Callable | None = None, step_controller_fn: Callable | None = None, step_fn: Callable | None = None, drivers_fn: Callable | None = None, observables_fn: Callable | None = None, **kwargs) None[source]
Initialise the IVP loop configuration.
- Parameters:
precision – Precision used for state and observable updates.
n_states – Number of state variables.
compile_flags – Output configuration that drives save and summary behaviour.
n_parameters – Number of parameters.
n_drivers – Number of driver variables.
n_observables – Number of observable variables.
n_error – Number of error elements (typically equals n_states for adaptive).
n_counters – Number of counter elements.
state_summaries_buffer_height – Height of state summary buffer.
observable_summaries_buffer_height – Height of observable summary buffer.
save_every – Interval between accepted saves. Defaults to None (auto-configured).
summarise_every – Interval between summary accumulations. Defaults to None (auto-configured).
sample_summaries_every – Interval between summary metric updates. Must be an integer divisor of
summarise_every. Defaults to None (auto-configured).save_state_fn – Device function that writes state and observable snapshots.
update_summaries_fn – Device function that accumulates summary statistics.
save_summaries_fn – Device function that commits summary statistics to output buffers.
step_controller_fn – Device function that updates the timestep and accept flag.
step_fn – Device function that advances the solution by one tentative step.
drivers_fn – Device function that evaluates drivers for a given time.
observables_fn – Device function that computes observables for proposed states.
**kwargs – Optional parameters passed to ODELoopConfig. See ODELoopConfig for available parameters including dt, is_adaptive, and buffer location parameters (state_location, proposed_state_location, etc.). None values are ignored.
- build() IVPLoopCache[source]
Compile the CUDA device loop.
- Returns:
Cache containing the compiled loop device function.
- Return type:
IVPLoopCache
- property compile_flags: OutputCompileFlags
Return the output compile flags associated with the loop.
- property device_function
Return the compiled CUDA loop function.
- Returns:
Compiled CUDA device function.
- Return type:
callable
- property drivers_fn: Callable | None
Return the driver evaluation device function used by the loop.
- property sample_summaries_every: float | None
Return the summary sampling interval, or None if not configured.
- settings_keys: frozenset | None = frozenset({'accept_step_location', 'afn', 'arcp', 'contract', 'counters_location', 'drivers_location', 'dt', 'dt_location', 'error_location', 'ftz', 'is_adaptive', 'lineinfo', 'lto', 'nsz', 'observable_summary_location', 'observables_location', 'parameters_location', 'proposed_counters_location', 'proposed_drivers_location', 'proposed_observables_location', 'proposed_state_location', 'sample_summaries_every', 'save_every', 'save_last', 'save_regularly', 'state_location', 'state_summary_location', 'summarise_every', 'summarise_regularly', 'unroll_accumulator', 'unroll_krylov_exits', 'unroll_newton_exits', 'unroll_norms', 'unroll_other_small', 'unroll_solver_element', 'unroll_stage', 'unroll_step_element'})
Loose keys the factory accepts;
Noneaccepts every field.
- update(updates_dict: dict[str, object] | None = None, silent: bool = False, **kwargs: object) Set[str][source]
Update compile settings through the CUDAFactory interface.
- Parameters:
updates_dict – Mapping of configuration names to replacement values.
silent – When True, suppress warnings about unrecognized parameters.
**kwargs – Additional configuration updates applied as keyword arguments.
- Returns:
Set of parameter names that were recognized and updated.
- Return type: