ODELoopConfig

class cubie.integrators.loops.ode_loop_config.ODELoopConfig(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], n_states: int = 0, 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, state_location: str = 'local', proposed_state_location: str = 'local', parameters_location: str = 'local', drivers_location: str = 'local', proposed_drivers_location: str = 'local', observables_location: str = 'local', proposed_observables_location: str = 'local', error_location: str = 'local', counters_location: str = 'local', state_summary_location: str = 'local', observable_summary_location: str = 'local', dt_location: str = 'local', accept_step_location: str = 'local', proposed_counters_location: str = 'local', compile_flags: OutputCompileFlags = NOTHING, save_every: float | None = None, summarise_every: float | None = None, sample_summaries_every: float | None = None, save_last: bool = False, save_regularly: bool = False, summarise_regularly: bool = False, 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_function: Callable | None = None, evaluate_driver_at_t: Callable | None = None, evaluate_observables: Callable | None = None, dt: float | None = 0.01, is_adaptive: bool | None = False)[source]

Bases: CUDAFactoryConfig

Compile-critical settings for an integrator loop.

Parameters:
  • n_states (int) – Number of state variables.

  • n_parameters (int) – Number of parameters.

  • n_drivers (int) – Number of driver variables.

  • n_observables (int) – Number of observable variables.

  • n_error (int) – Number of error elements (typically equals n_states for adaptive methods).

  • n_counters (int) – Number of counter elements.

  • state_summaries_buffer_height (int) – Height of state summary buffer.

  • observable_summaries_buffer_height (int) – Height of observable summary buffer.

  • compile_flags (cubie.outputhandling.output_config.OutputCompileFlags) – Output configuration governing save and summary cadence.

  • save_every – Interval between accepted saves, or None when auto-derived.

  • summarise_every – Interval between summary accumulations, or None when auto-derived.

  • sample_summaries_every – Interval between summary metric updates, or None when auto-derived.

  • save_last (bool) – When True, the loop saves the final state regardless of save_every alignment.

  • save_regularly (bool) – When True, state saves occur at save_every intervals.

  • summarise_regularly (bool) – When True, summary accumulations occur at summarise_every intervals.

  • save_state_fn (Callable | None) – Device function that records state and observable snapshots.

  • update_summaries_fn (Callable | None) – Device function that accumulates summary statistics.

  • save_summaries_fn (Callable | None) – Device function that writes summary statistics to output buffers.

  • step_controller_fn (Callable | None) – Device function that updates the timestep and acceptance flag.

  • step_function (Callable | None) – Device function that advances the solution by one tentative step.

  • evaluate_driver_at_t (Callable | None) – Device function that evaluates driver signals for a given time.

  • evaluate_observables (Callable | None) – Device function that evaluates observables for the current state.

  • dt – Initial timestep prior to controller feedback.

  • is_adaptive (bool | None) – Whether the loop operates with an adaptive controller.

  • state_location – Memory location for the corresponding buffer ('local' or 'shared').

  • proposed_state_location – Memory location for the corresponding buffer ('local' or 'shared').

  • parameters_location – Memory location for the corresponding buffer ('local' or 'shared').

  • drivers_location – Memory location for the corresponding buffer ('local' or 'shared').

  • proposed_drivers_location – Memory location for the corresponding buffer ('local' or 'shared').

  • observables_location – Memory location for the corresponding buffer ('local' or 'shared').

  • proposed_observables_location – Memory location for the corresponding buffer ('local' or 'shared').

  • error_location – Memory location for the corresponding buffer ('local' or 'shared').

  • counters_location – Memory location for the corresponding buffer ('local' or 'shared').

  • state_summary_location – Memory location for the corresponding buffer ('local' or 'shared').

  • observable_summary_location – Memory location for the corresponding buffer ('local' or 'shared').

  • dt_location – Memory location for the corresponding buffer ('local' or 'shared').

  • accept_step_location – Memory location for the corresponding buffer ('local' or 'shared').

  • proposed_counters_location – Memory location for the corresponding buffer ('local' or 'shared').

accept_step_location: str
compile_flags: OutputCompileFlags
counters_location: str
drivers_location: str
property dt: float

Return the initial timestep.

dt_location: str
error_location: str
evaluate_driver_at_t: Callable | None
evaluate_observables: Callable | None
is_adaptive: bool | None
n_counters: int
n_drivers: int
n_error: int
n_observables: int
n_parameters: int
n_states: int
observable_summaries_buffer_height: int
observable_summary_location: str
observables_location: str
parameters_location: str
proposed_counters_location: str
proposed_drivers_location: str
proposed_observables_location: str
proposed_state_location: str
property sample_summaries_every: float | None

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

property samples_per_summary

Return the number of update samples per summary interval.

When both summarise_every and sample_summaries_every are set, the ratio must be close to an integer. A small deviation (≤ 0.01) is accepted with a warning; larger deviations raise ValueError.

Returns:

Number of samples per summary, or 0 when either timing parameter is None.

Return type:

int

Raises:

ValueError – If summarise_every is not an integer multiple of sample_summaries_every.

property save_every: float | None

Return the output save interval, or None if not configured.

save_last: bool
save_regularly: bool
save_state_fn: Callable | None
save_summaries_fn: Callable | None
state_location: str
state_summaries_buffer_height: int
state_summary_location: str
step_controller_fn: Callable | None
step_function: Callable | None
property summarise_every: float | None

Return the summary interval, or None if not configured.

summarise_regularly: bool
update_summaries_fn: Callable | None