diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-10-11 14:40:48 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-10-11 14:40:48 +0200 |
commit | a2adf6a90246110fcae4e6a6dcc049d8d69fcb48 (patch) | |
tree | ec94d9e77e067e2e168467947f5fd390ed66c569 /bin | |
parent | 2a75bc679e2970f9ae938a418af5acea9106e61d (diff) |
add helper functions for co-dependent parameter detection
Diffstat (limited to 'bin')
-rwxr-xr-x[-rw-r--r--] | bin/analyze-archive.py | 10 | ||||
-rwxr-xr-x | bin/analyze-timing.py | 23 |
2 files changed, 27 insertions, 6 deletions
diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py index 47fabd4..685ce92 100644..100755 --- a/bin/analyze-archive.py +++ b/bin/analyze-archive.py @@ -311,10 +311,10 @@ if __name__ == '__main__': '', param, model.stats.param_dependence_ratio(state, 'power', param))) - if model.depends_on_param(state, 'power', param) and len(model.stats.stats[state]['power']['param_data'][param]['codependent_parameters']): - print('{:24s} co-dependencies: {:s}'.format('', ', '.join(model.stats.stats[state]['power']['param_data'][param]['codependent_parameters']))) - for combi, depends in model.stats.stats[state]['power']['param_data'][param]['depends_for_codependent_value'].items(): - print('{} -> {}'.format(combi, depends)) + if model.stats.has_codependent_parameters(state, 'power', param): + print('{:24s} co-dependencies: {:s}'.format('', ', '.join(model.stats.codependent_parameters(state, 'power', param)))) + for param_dict in model.stats.codependent_parameter_value_dicts(state, 'power', param): + print('{:24s} parameter-aware for {}'.format('', param_dict)) for trans in model.transitions(): # Mean power is not a typical transition attribute, but may be present for debugging or analysis purposes @@ -377,6 +377,8 @@ if __name__ == '__main__': )) if 'param' in show_models or 'all' in show_models: + if not model.stats.can_be_fitted(): + print('[!] measurements have insufficient distinct numeric parameters for fitting. A parameter-aware model is not available.') for state in model.states(): for attribute in model.attributes(state): if param_info(state, attribute): diff --git a/bin/analyze-timing.py b/bin/analyze-timing.py index 659a3d7..6c84a67 100755 --- a/bin/analyze-timing.py +++ b/bin/analyze-timing.py @@ -21,6 +21,9 @@ Options: parameters. Also plots the corresponding measurements. If gplearn function is set, it is plotted using dashed lines. +--param-info + Show parameter names and values + --show-models=<static|paramdetection|param|all|tex> static: show static model values as well as parameter detection heuristic paramdetection: show stddev of static/lut/fitted model @@ -77,7 +80,8 @@ import re import sys from dfatool import AnalyticModel, TimingData, pta_trace_to_aggregate from dfatool import soft_cast_int, is_numeric, gplearn_to_function -from dfatool import CrossValidator, filter_aggregate_by_param +from dfatool import CrossValidator +from utils import filter_aggregate_by_param from parameters import prune_dependent_parameters import utils @@ -151,7 +155,7 @@ if __name__ == '__main__': 'ignored-trace-indexes= discard-outliers= function-override= ' 'filter-param= ' 'cross-validate= ' - 'corrcoef ' + 'corrcoef param-info ' 'with-safe-functions hwmodel= export-energymodel=' ) raw_opts, args = getopt.getopt(sys.argv[1:], "", optspec.split(' ')) @@ -216,6 +220,12 @@ if __name__ == '__main__': if xv_method: xv = CrossValidator(AnalyticModel, by_name, parameters, arg_count) + if 'param-info' in opts: + for state in model.names: + print('{}:'.format(state)) + for param in model.parameters: + print(' {} = {}'.format(param, model.stats.distinct_values[state][param])) + if 'plot-unparam' in opts: for kv in opts['plot-unparam'].split(';'): state_or_trans, attribute, ylabel = kv.split(':') @@ -228,6 +238,15 @@ if __name__ == '__main__': if 'static' in show_models or 'all' in show_models: for trans in model.names: print('{:10s}: {:.0f} µs'.format(trans, static_model(trans, 'duration'))) + for param in model.parameters: + print('{:10s} dependence on {:15s}: {:.2f}'.format( + '', + param, + model.stats.param_dependence_ratio(trans, 'duration', param))) + if model.stats.has_codependent_parameters(trans, 'duration', param): + print('{:24s} co-dependencies: {:s}'.format('', ', '.join(model.stats.codependent_parameters(trans, 'duration', param)))) + for param_dict in model.stats.codependent_parameter_value_dicts(trans, 'duration', param): + print('{:24s} parameter-aware for {}'.format('', param_dict)) if xv_method == 'montecarlo': static_quality = xv.montecarlo(lambda m: m.get_static(), xv_count) |