taufactor.benchmark

Benchmark helpers for TauFactor convergence studies.

Functions

append_row_to_file(row[, outfile])

Format a benchmark result row and append it to the output file.

resolve_solver(solver)

Resolve a solver provided either as class object or string name.

resolve_structure(structure, N[, features])

Resolve a benchmark structure from a predefined name or custom callable.

run_benchmark_case(N, device, conv_crit[, ...])

Run a single structure benchmark case.

run_benchmark_study([Ns, devices, ...])

Run a convergence benchmark on synthetic structures.

write_header_if_missing([outfile])

Create output file and write header if it does not exist.

taufactor.benchmark.append_row_to_file(row: dict, outfile: str = 'taufactor_benchmark_results.txt') None[source]

Format a benchmark result row and append it to the output file.

taufactor.benchmark.resolve_solver(solver: str | type | None) type[source]

Resolve a solver provided either as class object or string name.

taufactor.benchmark.resolve_structure(structure: str | Callable, N: int, features: int | None = None) tuple[source]

Resolve a benchmark structure from a predefined name or custom callable.

taufactor.benchmark.run_benchmark_case(N: int, device: str, conv_crit: float, structure: str | Callable = 'fcc', features: int | None = None, iter_limit: int = 10000, solver: str | type | None = None, solver_kwargs: dict | None = None, solve_kwargs: dict | None = None) dict[source]

Run a single structure benchmark case.

Parameters:

structure – Either one of the predefined keys in STRUCTURE_REGISTRY or a custom callable hook returning a structure array.

taufactor.benchmark.run_benchmark_study(Ns: list[int] | tuple[int, ...] = (100, 128, 200, 256, 300, 384, 400), devices: list[str] | tuple[str, ...] = ('cuda',), conv_crit_values: list[float] | tuple[float, ...] = (0.001,), structure: str | Callable = 'fcc', features: int = 1, outfile: str = 'taufactor_benchmark_results.txt', write_file: bool = True, iter_limit: int = 10000, solver: str | type | None = None, solver_kwargs: dict | None = None, solve_kwargs: dict | None = None) list[dict][source]

Run a convergence benchmark on synthetic structures.

Parameters:

structure – Either a predefined structure name (fcc, blocks, diagonal2d, zigzag, diagonal3d) or a custom callable hook. Custom hooks should accept N or Nx and can optionally accept features.

taufactor.benchmark.write_header_if_missing(outfile: str = 'taufactor_benchmark_results.txt') None[source]

Create output file and write header if it does not exist.