Candidate comparison
- class cubie.batchsolving.comparison.ComparisonRunner(solver: Any, inits: Any = None, params: Any = None, duration: float = 0.0, settling_time: float = 0.0, t0: float = 0.0, verbose: bool = False, max_parallel: int = 4)[source]
Bases:
objectSwitch one solver between candidates and time each on one batch.
The batch stays on the device; candidates apply over the configuration at
open(), whichclose()restores.- Parameters:
solver – The solver whose settings the candidates vary.
inits – The
(variable, run)grid to time on;Nonecompiles only.params – The
(variable, run)grid to time on;Nonecompiles only.duration – Integration window of the timed solves.
settling_time – Integration window of the timed solves.
t0 – Integration window of the timed solves.
verbose – Print progress lines.
max_parallel – Maximum compilations to run in parallel.
- _compile_in_pool(candidates: Sequence[Candidate]) None[source]
Compile
candidatesinto the kernel cache in spawned workers.
- _launch_blocks(blocksize: int | None, runs: int | None) Tuple[int, int][source]
Return blocks per SM and runs per block of the current launch.
- compile(candidates: Sequence[Candidate]) List[Candidate][source]
Compile the candidates, pooled if cheaper than serially; return the accepted ones, a rejected one keeps its error.
- concurrent_runs(blocksize: int | None = None) int[source]
Runs the current candidate’s launch executes at once.
- fit_batch(measured: float, target_ms: float, grow: bool, shrink: bool) float[source]
Move the batch once toward
target_ms, up withinbatch_cap()ifgrow, down to the floor ifshrink; return the kernel time at the staged batch.
- geometry(blocksize: int | None) Tuple[int, float][source]
Return blocks per SM and waves of the current launch.
- rejection(candidate: Candidate) str[source]
Return why
candidatewas rejected; empty when it was not.
- set_batch(runs: int | None = None) None[source]
Stage
runsgrid columns on the device, cycling if short.
- size_batch(candidates: Sequence[Candidate], waves: int) None[source]
Stage the tail-safe batch at
wavesof the most concurrent candidate; keep the counts forfit_batch().
- solve_ms(blocksize: int | None = None) float[source]
Solve the staged batch once; return its kernel milliseconds.
- property staged_bytes: int
Device bytes of the staged grid.
- time(candidates: Sequence[Candidate]) List[CandidateTiming][source]
Time every candidate on the staged batch, forward then back.
Every candidate solves
SOLVES_PER_ROUNDtimes in each ofROUNDSrounds; the second round reverses the order. A rejected or failing candidate carries the error and no times.
- cubie.batchsolving.comparison.rank_timings(timings: Sequence[CandidateTiming]) List[CandidateTiming][source]
Order timed candidates: the top success tier by time, then the rest.
The top tier holds every candidate whose success rate is at least
SUCCESS_TIER_FRACTIONof the best success rate.
- class cubie.batchsolving.comparison.Candidate(label: str, settings: Dict[str, Any] = NOTHING, blocksize: int | None = None, resident_blocks: int | None = None)[source]
Bases:
objectOne configuration and launch to time.
- Parameters:
- label: str
- class cubie.batchsolving.comparison.CandidateTiming(candidate: Candidate, times_ms: Tuple[float, ...] = (), failures: int = 0, runs: int = 0, blocks_per_sm: int = 0, waves: float = 0.0, error: str = '')[source]
Bases:
objectMeasured outcome of one candidate.
- Parameters:
candidate (cubie.batchsolving.comparison.Candidate) – The configuration timed.
times_ms (Tuple[float, ...]) – Kernel milliseconds of every timed solve.
failures (int) – Runs with a nonzero status code in the last solve read.
runs (int) – Trajectories each solve integrated.
blocks_per_sm (int) – Resident blocks per SM the driver reported for the launch.
waves (float) – Occupancy waves the batch filled at the launch.
error (str) – Why the candidate could not be timed, empty when it was.
- property best_ms: float
Lowest kernel time,
infwhen never timed.
- blocks_per_sm: int
- candidate: Candidate
- error: str
- failures: int
- runs: int
- property success_rate: float
Share of the batch that integrated without a status flag.
- property timed: bool
Whether the candidate has a time.
- waves: float