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_func: Callable | None = None, update_summaries_func: Callable | None = None, save_summaries_func: Callable | None = None, step_controller_fn: Callable | None = None, step_function: Callable | None = None, evaluate_driver_at_t: Callable | None = None, evaluate_observables: Callable | None = None, **kwargs)[source]

Bases: CUDAFactory

Factory 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_func – Device function that writes state and observable snapshots.

  • update_summaries_func – Device function that accumulates summary statistics.

  • save_summaries_func – Device function that commits summary statistics to output buffers.

  • step_controller_fn – Device function that updates the timestep and accept flag.

  • step_function – Device function that advances the solution by one tentative step.

  • evaluate_driver_at_t – Device function that evaluates drivers for a given time.

  • evaluate_observables – Device function that computes observables for proposed states.

  • **kwargs – Optional parameters passed to ODELoopConfig. Available parameters include dt0, 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_func: Callable | None = None, update_summaries_func: Callable | None = None, save_summaries_func: Callable | None = None, step_controller_fn: Callable | None = None, step_function: Callable | None = None, evaluate_driver_at_t: Callable | None = None, evaluate_observables: 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_summary_buffer_height – Height of state summary buffer.

  • observable_summary_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_func – Device function that writes state and observable snapshots.

  • update_summaries_func – Device function that accumulates summary statistics.

  • save_summaries_func – Device function that commits summary statistics to output buffers.

  • step_controller_fn – Device function that updates the timestep and accept flag.

  • step_function – Device function that advances the solution by one tentative step.

  • evaluate_driver_at_t – Device function that evaluates drivers for a given time.

  • evaluate_observables – Device function that computes observables for proposed states.

  • **kwargs – Optional parameters passed to ODELoopConfig. See ODELoopConfig for available parameters including dt0, is_adaptive, and buffer location parameters (state_location, proposed_state_location, etc.). None values are ignored.

build() Callable[source]

Compile the CUDA device loop.

Returns:

Compiled device function that executes the integration loop.

Return type:

Callable

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 dt0: float | None

Return the initial step size provided to the loop.

property evaluate_driver_at_t: Callable | None

Return the driver evaluation device function used by the loop.

property evaluate_observables: Callable | None

Return the observables device function used by the loop.

property is_adaptive: bool | None

Return whether the loop operates in adaptive mode.

register_buffers() None[source]

Register buffers according to locations in compile settings.

property sample_summaries_every: float | None

Return the summary sampling interval, or None if not configured.

property save_every: float | None

Return the save interval, or None if not configured.

property save_state_fn: Callable | None

Return the cached state saving device function.

property save_summaries_fn: Callable | None

Return the cached summary saving device function.

property step_controller_fn: Callable | None

Return the device function implementing step control.

property step_function: Callable | None

Return the algorithm step device function used by the loop.

property summarise_every: float | None

Return the summary interval, or None if not configured.

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:

set

property update_summaries_fn: Callable | None

Return the cached summary update device function.