mlonmcu.session package

Subpackages

Submodules

mlonmcu.session.run module

Definition of a MLonMCU Run which represents a single benchmark instance for a given set of options.

class mlonmcu.session.run.Run(idx=None, model=None, framework=None, frontends=None, backend=None, target=None, platforms=None, features=None, config=None, postprocesses=None, archived=False, session=None, comment='')[source]

Bases: object

A run is single model/backend/framework/target combination with a given set of features and configs.

DEFAULTS = {'export_optional': False, 'stage_subdirs': False, 'target_optimized_layouts': False, 'target_optimized_schedules': False, 'target_to_backend': True, 'tune_enabled': False}
FEATURES = {'autotune', 'target_optimized'}
OPTIONAL = {}
REQUIRED = {}
add_backend(backend)[source]

Setter for the backend instance.

add_backend_by_name(backend_name, context=None)[source]

Helper function to initialize and configure a backend by its name.

add_feature(feature, append=True)[source]

Setter for a feature instance.

add_feature_by_name(feature_name, append=True, context=None)[source]

Helper function to initialize and configure a feature by its name.

add_features(features, append=False)[source]

Setter for the list of features.

add_features_by_name(feature_names, append=False, context=None)[source]

Helper function to initialize and configure features by their names.

add_framework(framework)[source]

Setter for the framework instance.

add_frontend(frontend, append=True)[source]

Setter for the frontend instance.

add_frontend_by_name(frontend_name, context=None)[source]

Helper function to initialize and configure a frontend by its name.

add_frontends(frontends, append=False)[source]

Setter for the list of frontends.

add_frontends_by_name(frontend_names, context=None)[source]

Helper function to initialize and configure frontends by their names.

add_model(model)[source]

Setter for the model instance.

add_model_by_name(model_name, context=None)[source]

Helper function to initialize and configure a model by its name.

add_platform(platform, append=True)[source]

Setter for the platform instance.

add_platform_by_name(platform_name, context=None)[source]

Helper function to initialize and configure a platform by its name.

add_platforms(platforms, append=False)[source]

Setter for the list of platforms.

add_platforms_by_name(platform_names, context=None)[source]

Helper function to initialize and configure platforms by their names.

add_postprocess(postprocess, append=True)[source]

Setter for a postprocess instance.

add_postprocess_by_name(postprocess_name, append=True, context=None)[source]

Helper function to initialize and configure a postprocesses by its name.

add_postprocesses(postprocesses, append=False)[source]

Setter for the list of postprocesses.

add_postprocesses_by_name(postprocess_names, append=False, context=None)[source]

Helper function to initialize and configure postprocesses by their names.

add_target(target)[source]

Setter for the target instance.

add_target_by_name(target_name, context=None)[source]

Helper function to initialize and configure a target by its name.

property artifacts
build()[source]

Process the run using the choosen backend.

property build_platform

Get platform for build stage.

compile()[source]

Compile the target software for the run.

property compile_platform

Get platform for compile stage.

copy()[source]

Create a new run based on this instance.

export(path=None, optional=False)[source]

Write a run configuration to a disk.

property export_optional

Get export_optional property.

export_stage(stage, optional=False)[source]

Export stage artifacts of this run to its directory.

classmethod from_file(path)[source]

Restore a run object which was written to the disk.

property frontend
get_all_configs(omit_paths=False, omit_defaults=False, omit_globals=False)[source]

Return dict with component-specific and global configuration for this run.

get_all_feature_names(only_used=True)[source]

Return list of feature names for this run.

get_all_postprocess_names()[source]

Return list of postprocess names for this run.

get_all_sub_artifacts(sub, stage=None)[source]
get_frontend_name()[source]

Return frontend name(s) for this run.

get_platform_name()[source]

Return platform name(s) for this run.

get_reason_text()[source]
get_report()[source]

Returns teh complete report of this run.

has_stage(stage)[source]

Returns true if the given stage is available for this run.

init_component(component_cls, context=None)[source]

Helper function to create and configure a MLonMCU component instance for this run.

init_directory()[source]

Initialize the temporary directory for this run.

property last_stage

Determines the next not yet completed stage. Returns RunStage.DONE if already completed.

load()[source]

Load the model using the given frontend.

lock()[source]

Aquire a mutex to lock the current run.

property next_stage

Determines the next not yet completed stage. Returns RunStage.DONE if already completed.

postprocess()[source]

Postprocess the ‘run’.

property prefix

Get prefix property.

process(until=RunStage.RUN, skip=None, export=False)[source]

Process the run until a given stage.

process_features(features)[source]

Utility which handles postprocess_features.

run()[source]

Run the ‘run’ using the defined target.

property stage_subdirs
property target_optimized_layouts

Get target_optimized_layouts property.

property target_optimized_schedules

Get target_optimized_schedules property.

property target_platform

Get platform for run stage.

property target_to_backend

Get target_to_backend property.

toDict()[source]

Utility not implemented yet. (TODO: remove?)

tune()[source]

Tune the run using the choosen backend (if supported).

property tune_enabled

Get tune_enabled property.

property tune_platform

Get platform for tune stage.

unlock()[source]

Release a mutex to unlock the current run.

write_run_file()[source]

Create a run.txt file which contains information used to reconstruct the run based on its properties at a later point in time.

class mlonmcu.session.run.RunStage(value)[source]

Bases: IntEnum

Type describing the stages a run can have.

BUILD = 3
COMPILE = 4
DONE = 7
LOAD = 1
NOP = 0
POSTPROCESS = 6
RUN = 5
TUNE = 2
mlonmcu.session.run.add_any(new, base=None, append=True)[source]

mlonmcu.session.session module

Definition of a MLonMCU Run which represents a set of benchmarks in a session.

class mlonmcu.session.session.Session(label='', idx=None, archived=False, dir=None, config=None)[source]

Bases: object

A session which wraps around multiple runs in a context.

DEFAULTS = {'report_fmt': 'csv'}
property active

Get active property.

close(err=None)[source]

Close this run.

create_run(*args, **kwargs)[source]

Factory method to create a run and add it to this session.

discard()[source]

Discard a run and remove its directory.

enumerate_runs()[source]

Update run indices.

property failing

Get failng property.

get_reports()[source]

Returns a full report which includes all runs in this session.

open()[source]

Open this run.

property prefix

get prefix property.

process_runs(until=RunStage.DONE, per_stage=False, print_report=False, num_workers=1, progress=False, export=False, context=None)[source]

Process a runs in this session until a given stage.

property report_fmt

get report_fmt property.

request_run_idx()[source]

Return next free run index.

property runs_dir
class mlonmcu.session.session.SessionStatus(value)[source]

Bases: Enum

Status type for a session.

CLOSED = 2
CREATED = 0
ERROR = 3
OPEN = 1

Module contents