modules.core.Core

class Core(name: str = None)

Bases: ABC

Core Module for QUARK, used by all other Modules that are part of a benchmark process.

__init__(name: str = None)

Constructor method.

Parameters:

name -- Name used to identify this QUARK module. If not specified class name will be used as default.

Methods

__init__([name])

Constructor method.

get_available_submodule_options()

Gets the list of available options.

get_available_submodules(option)

If the module has submodules depending on certain options, this method should adjust the submodule_options accordingly.

get_default_submodule(option)

Given an option string by the user, this returns a submodule.

get_depending_parameters(option, config)

If the module has parameters depending on certain options, this method should return the parameters for the given option.

get_parameter_options()

Returns the parameters for a given module.

get_requirements()

Returns the required pip packages for this module.

get_submodule(option)

Submodule is instantiated according to the information given in self.sub_options.

postprocess(input_data, config, **kwargs)

Essential Method for the benchmarking process.

preprocess(input_data, config, **kwargs)

Essential method for the benchmarking process.

final get_available_submodule_options() list

Gets the list of available options.

Returns:

List of module options

get_available_submodules(option: list) list

If the module has submodules depending on certain options, this method should adjust the submodule_options accordingly.

Parameters:

option -- List of chosen options

Returns:

List of available submodules

abstract get_default_submodule(option: str) Core

Given an option string by the user, this returns a submodule.

Parameters:

option -- String with the chosen submodule

Returns:

Module of type Core

get_depending_parameters(option: str, config: dict) dict

If the module has parameters depending on certain options, this method should return the parameters for the given option.

Parameters:
  • option -- The chosen option

  • config -- Current config dictionary

Returns:

The parameters for the given option

abstract get_parameter_options() dict

Returns the parameters for a given module.

Should always be in this format:

{
   "parameter_name":{
      "values":[1, 2, 3],
      "description":"How many nodes do you need?"
   },
    "parameter_name_2":{
      "values":["x", "y"],
      "description":"Which type of problem do you want?"
   }
}
Returns:

Available settings for this application

static get_requirements() list

Returns the required pip packages for this module. Optionally, version requirements can be added.

Returns:

List of dictionaries

final get_submodule(option: str) Core

Submodule is instantiated according to the information given in self.sub_options. If self.sub_options is None, get_default_submodule is called as a fallback.

Parameters:

option -- String with the options

Returns:

Instance of a module

postprocess(input_data: any, config: dict, **kwargs) tuple[any, float]

Essential Method for the benchmarking process. Is always executed after the submodule is finished. The data by this method is passed up to the parent module.

Parameters:
  • input_data -- Input data comes from the submodule if that exists

  • config -- Config for the module

  • kwargs -- Optional keyword arguments

Returns:

The output of the postprocessing and the time it took to postprocess

preprocess(input_data: any, config: dict, **kwargs) tuple[any, float]

Essential method for the benchmarking process. This is always executed before traversing down to the next module, passing the data returned by this function.

Parameters:
  • input_data -- Data for the module, comes from the parent module if that exists

  • config -- Config for the module

  • kwargs -- Optional keyword arguments

Returns:

The output of the preprocessing and the time it took to preprocess