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:
CUDAFactoryConfigCompile-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_statesfor 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
Nonewhen auto-derived.summarise_every – Interval between summary accumulations, or
Nonewhen auto-derived.sample_summaries_every – Interval between summary metric updates, or
Nonewhen auto-derived.save_last (bool) – When
True, the loop saves the final state regardless ofsave_everyalignment.save_regularly (bool) – When
True, state saves occur atsave_everyintervals.summarise_regularly (bool) – When
True, summary accumulations occur atsummarise_everyintervals.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
- 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_everyandsample_summaries_everyare set, the ratio must be close to an integer. A small deviation (≤ 0.01) is accepted with a warning; larger deviations raiseValueError.- Returns:
Number of samples per summary, or
0when either timing parameter isNone.- Return type:
- Raises:
ValueError – If
summarise_everyis not an integer multiple ofsample_summaries_every.
- save_last: bool
- save_regularly: bool
- state_location: str
- state_summaries_buffer_height: int
- state_summary_location: str
- summarise_regularly: bool