paidiverpy.utils.benchmark.benchmark_test#

This module contains functions to run the benchmark test.

Functions#

benchmark_task(→ tuple[float, float])

Run the benchmark task.

plot_results(→ None)

Plot the benchmark results.

update_yaml(→ str | pathlib.Path)

Update the YAML file with new benchmarking parameters and save it.

benchmark_threads(→ list[dict[str, Any]])

Handle the benchmark test for LocalCluster.

benchmark_local(→ list[dict[str, Any]])

Handle the benchmark test for LocalCluster.

benchmark_handler(→ None)

Handle the benchmark test.

Module Contents#

paidiverpy.utils.benchmark.benchmark_test.benchmark_task(configuration_file: str | pathlib.Path, logger: logging.Logger) tuple[float, float][source]#

Run the benchmark task.

Parameters:
  • configuration_file (str) – The path to the configuration file.

  • logger (logging.Logger) – The logger to log messages.

paidiverpy.utils.benchmark.benchmark_test.plot_results(results: list[dict[str, Any]], cluster_type: str, filename: str) None[source]#

Plot the benchmark results.

Parameters:
  • results (list) – The list of benchmark results.

  • cluster_type (str) – The cluster type.

  • filename (str) – The filename to save the plot.

paidiverpy.utils.benchmark.benchmark_test.update_yaml(file_path: str | pathlib.Path, cluster_type: str | None, output_file: str | pathlib.Path, n_jobs: int, **kwargs: dict[str, Any]) str | pathlib.Path[source]#

Update the YAML file with new benchmarking parameters and save it.

Parameters:
  • file_path (str) – The path to the configuration file.

  • cluster_type (str) – The cluster type.

  • output_file (str) – The output file path.

  • n_jobs (int) – The number of jobs.

  • **kwargs – The benchmarking parameters. It should be a dictionary with the following: For LocalCluster: - workers (int): The number of workers. - threads (int): The number of threads. - memory (int): The memory limit. For SLURM: - cores (int): The number of cores. - processes (int): The number of processes. - memory (int): The memory limit. - walltime (str): The walltime. - queue (str): The queue name.

Returns:

The output file path.

Return type:

str

paidiverpy.utils.benchmark.benchmark_test.benchmark_threads(benchmark_params: dict[str, Any], configuration_file: str | pathlib.Path, logger: logging.Logger) list[dict[str, Any]][source]#

Handle the benchmark test for LocalCluster.

Parameters:
  • benchmark_params (dict) – The benchmark parameters.

  • configuration_file (str | Path) – The path to the configuration files.

  • logger (logging.Logger) – The logger to log messages.

Returns:

The benchmark results.

Return type:

list

paidiverpy.utils.benchmark.benchmark_test.benchmark_local(benchmark_params: dict[str, Any], configuration_file: str | pathlib.Path, logger: logging.Logger) list[dict[str, Any]][source]#

Handle the benchmark test for LocalCluster.

Parameters:
  • benchmark_params (dict) – The benchmark parameters.

  • configuration_file (str | Path) – The path to the configuration files.

  • logger (logging.Logger) – The logger to log messages.

Returns:

The benchmark results.

Return type:

list

paidiverpy.utils.benchmark.benchmark_test.benchmark_handler(benchmark_params: dict[str, Any], configuration_file: str | pathlib.Path, logger: logging.Logger) None[source]#

Handle the benchmark test.

Parameters:
  • benchmark_params (dict) – The benchmark parameters.

  • configuration_file (str) – The path to the configuration files.

  • logger (logging.Logger) – The logger to log messages.