localuf.sim.runtime

Module for emulating runtime for Macar, Actis, Snowflake.

Available functions:

  • batch

  • frugal

Functions

batch(ds, noise_levels, n, noise[, ...])

Make runtime data of Local UF decoder under batch decoding scheme.

forward(ds, noise_levels, n, noise[, ...])

Make runtime data of Macar under forward decoding scheme.

frugal(ds, noise_levels, n, code_class, noise)

Make runtime data Snowflake.

localuf.sim.runtime.batch(ds, noise_levels, n, noise, decoder_class=<class 'localuf.decoders.luf.Macar'>, validate_only=True, **kwargs_for_Surface)[source]

Make runtime data of Local UF decoder under batch decoding scheme.

Parameters:
  • ds (Iterable[int]) – an iterable of surface code distances.

  • noise_levels (Iterable[float]) – an iterable of noise levels.

  • n (int) – sample count.

  • noise (Literal['code capacity', 'phenomenological', 'circuit-level']) – noise model.

  • decoder_class (Type[Macar | Actis]) – the class of the decoder.

  • validate_only – whether to time only syndrome validation or the full decoding cycle.

  • kwargs_for_Surface – passed to Surface.

Return data:

A DataFrame where each column a (stage, distance, probability); row, a runtime sample. Stage is either SV or BP which stand for ‘syndrome validation’ and ‘burning & peeling’.

localuf.sim.runtime.forward(ds, noise_levels, n, noise, get_commit_height=None, get_buffer_height=None, **kwargs_for_Surface)[source]

Make runtime data of Macar under forward decoding scheme.

Use this function to analyse throughput. Latency can be analysed using sim.runtime.batch, since the final decoding window of a memory experiment resembles that of a batch decoding window.

Parameters:
  • ds (Iterable[int]) – same as for batch.

  • noise_levels (Iterable[float]) – same as for batch.

  • n (int) – same as for batch.

  • noise (Literal['phenomenological', 'circuit-level']) – same as for batch.

  • kwargs_for_Surface – same as for batch.

  • get_commit_height (Callable[[int], int] | None) – a function with input d that outputs commit height e.g. lambda d: 2*(d//2). If None, commit height is d.

  • get_buffer_height (Callable[[int], int] | None) – a function with input d that outputs buffer height. If None, buffer height is d.

Returns:

Same as for batch where validate_only=True.

localuf.sim.runtime.frugal(ds, noise_levels, n, code_class, noise, time_only='merging', get_commit_height=None, get_buffer_height=None, **kwargs_for_Snowflake)[source]

Make runtime data Snowflake.

Parameters:
  • ds (Iterable[int]) – an iterable of surface code distances.

  • noise_levels (Iterable[float]) – an iterable of noise levels.

  • n (int) – sample count.

  • code_class (Type[Code]) – the class of the code.

  • noise (Literal['phenomenological', 'circuit-level']) – the noise model.

  • time_only (Literal['all', 'merging', 'unrooting']) – whether runtime includes a timestep for each drop, each grow, and each merging step (‘all’); each merging step only (‘merging’); or each unrooting step only (‘unrooting’).

  • get_commit_height (Callable[[int], int] | None) – a function with input d that outputs commit height. If None, commit height is 1.

  • get_buffer_height (Callable[[int], int] | None) – a function with input d that outputs buffer height. If None, buffer height is 2*(d//2).

  • kwargs_for_Snowflake – passed to Snowflake e.g. merger decides whether Snowflake’s nodes flood before syncing (fast) or vice versa (slow) in a merging step.

Output: data a DataFrame where each column a (distance, probability); row, a runtime sample.