plumed_bench_pp.types

Classes

BenchmarkRow(cycles, total, average, ...)

A class representing a single row in the benchmark table.

BenchmarkRun(settings, runs, ...)

A class representing a benchmark run.

BenchmarkSettings(kernels, inputs, steps, ...)

A class representing the settings for benchmarking.

KernelBenchmark(kernel, input, compare, rows)

A class representing a benchmark for a kernel-input pair.

class plumed_bench_pp.types.BenchmarkRow(cycles: int, total: float, average: float, minimum: float, maximum: float)

Bases: object

A class representing a single row in the benchmark table.

Parameters:
  • cycles (int) – The number of benchmark cycles.

  • total (float) – The total time in seconds.

  • average (float) – The average time in seconds.

  • minimum (float) – The minimum time in seconds.

  • maximum (float) – The maximum time in seconds.

__init__(cycles: int, total: float, average: float, minimum: float, maximum: float) None
as_list() list

A method to return the BenchmarkRow attributes as a list.

static from_dict(data: dict) BenchmarkRow

Creates a new instance of the BenchmarkRow class from a dictionary containing the necessary data.

Parameters:

data (dict) – A dictionary with the following keys: “Cycles”, “Total”, “Average”, “Minimum”, and “Maximum”.

Returns:

A new instance of the BenchmarkRow class initialized with the data from the dictionary.

Return type:

BenchmarkRow

static from_re_match(result: re.Match) BenchmarkRow

A method to create a BenchmarkRow instance from a regex match result.

Parameters:

result (re.Match) – The regex match result containing the required groups.

Returns:

A BenchmarkRow instance initialized with the extracted data.

Return type:

BenchmarkRow

class plumed_bench_pp.types.BenchmarkRun(settings: ~plumed_bench_pp.types.BenchmarkSettings = <factory>, runs: dict[str, ~plumed_bench_pp.types.KernelBenchmark] = <factory>)

Bases: object

A class representing a benchmark run.

It contains the settings as a BenchmarkSettings and the results of each kernel-input file combination as a KernelBenchmark dictionary.

__init__(settings: ~plumed_bench_pp.types.BenchmarkSettings = <factory>, runs: dict[str, ~plumed_bench_pp.types.KernelBenchmark] = <factory>) None
extract_rows(rows: list, keys: list[str] | None = None) dict[str, dict[str, list]]

Extracts the specified rows from the given data dictionary. Works with the results of plumed_bench_pp.parser.parse_benchmark_output

Parameters:
  • rows (list) – The list of rows to extract.

  • keys (list or None) – The keys to access, otherwise iterate on everithing

Returns:

A dictionary of the simulations.

Return type:

dict[str, dict[str,list]]

class plumed_bench_pp.types.BenchmarkSettings(kernels: list = <factory>, inputs: list = <factory>, steps: int = -1, atoms: int = -1, maxtime: float = -1.0, sleep: float = 0.0, atom_distribution: str = 'line', shuffled: bool = False, domain_decomposition: bool = False)

Bases: object

A class representing the settings for benchmarking.

__init__(kernels: list = <factory>, inputs: list = <factory>, steps: int = -1, atoms: int = -1, maxtime: float = -1.0, sleep: float = 0.0, atom_distribution: str = 'line', shuffled: bool = False, domain_decomposition: bool = False) None
atom_distribution: str = 'line'

The type of atom distribution as specified in the command line

atoms: int = -1

The number of atoms in the system as specified in the command line

domain_decomposition: bool = False

The domain decomposition option, as specified in the command line

inputs: list

The list of input files as specified in the command line

kernels: list

The list of kernels as specified in the command line

maxtime: float = -1.0

The maximum time in seconds as specified in the command line

shuffled: bool = False

The shuffled option, as specified in the command line

sleep: float = 0.0

The time in seconds to sleep between benchmark steps as specified in the command line

steps: int = -1

The number of benchmark steps as specified in the command line

class plumed_bench_pp.types.KernelBenchmark(kernel: str = '', input: str = '', compare: dict = <factory>, rows: dict = <factory>)

Bases: object

A class representing a benchmark for a kernel-input pair.

kernel

The name of the kernel.

Type:

str

input

The name of the input file.

Type:

str

compare

A dictionary containing the fraction and error of the benchmark.

Type:

dict

rows

A dictionary containing the benchmark rows.

Type:

dict

__init__(kernel: str = '', input: str = '', compare: dict = <factory>, rows: dict = <factory>) None