Skip to content

Commit

Permalink
Correct Relay->VTA data parsing, simplify time reporting (#46)
Browse files Browse the repository at this point in the history
* Ignore timestamp fields in relay->VTA summarize and visualize

* Simplify duration reporting
  • Loading branch information
slyubomirsky authored Nov 8, 2019
1 parent ac362b6 commit 56721b1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
3 changes: 2 additions & 1 deletion experiments/relay_to_vta/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

SIM_TARGETS = {'sim', 'tsim'}
PHYS_TARGETS = {'pynq'}
METADATA_KEYS = {'timestamp', 'tvm_hash'}
METADATA_KEYS = {'timestamp', 'tvm_hash',
'start_time', 'end_time', 'time_delta'}

def main(data_dir, config_dir, output_dir):
config, msg = validate(config_dir)
Expand Down
3 changes: 2 additions & 1 deletion experiments/relay_to_vta/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
'arm_cpu': 'Mobile CPU',
'vta': 'Mobile CPU w/ FPGA'
}
METADATA_KEYS = {'timestamp', 'tvm_hash'}
METADATA_KEYS = {'timestamp', 'tvm_hash',
'start_time', 'end_time', 'time_delta'}

def generate_arm_vta_comparisons(data, output_prefix):
comparison_dir = os.path.join(output_prefix, 'comparison')
Expand Down
6 changes: 1 addition & 5 deletions shared/python/slack_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@ def generate_ping_list(user_ids):
return ', '.join(['<@{}>'.format(user_id) for user_id in user_ids])


def build_field(title='', value='', tm_start=None, tm_end=None, duration=None, short=False):
def build_field(title='', value='', short=False):
ret = {'value': value, 'short': short}
if title != '':
ret['title'] = title
if tm_start and tm_end and duration:
ret['value'] = f'_Starts at: {tm_start}_ \n _Ends at: {tm_end}_ \n _Duration: {duration}_\n\n' + ret['value']
else:
ret['value'] = f'*No Timing Info Recorded*\n' + ret['value']
return ret


Expand Down
27 changes: 18 additions & 9 deletions subsystem/exp_results/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,24 @@
build_field, build_attachment, build_message,
post_message)

def failed_experiment_field(exp, stage_statuses, stage, start_time=None, end_time=None, duration=None, notify=None):
def attach_duration(message, duration=None):
if duration is None:
return message
return '_Duration: {}_\n\n{}'.format(duration, message)


def failed_experiment_field(exp, stage_statuses, stage, duration=None, notify=None):
message = 'Failed at stage {}:\n{}'.format(
stage,
textwrap.shorten(stage_statuses[stage]['message'], width=280))

if duration is not None:
message += '\nTime to failure: {}'.format(duration)

if notify is not None:
message += '\nATTN: {}'.format(generate_ping_list(notify))

return build_field(title=exp, value=message, tm_start=start_time, tm_end=end_time, duration=duration)
return build_field(title=exp, value=message)


def main(config_dir, home_dir, output_dir):
Expand Down Expand Up @@ -50,7 +59,7 @@ def main(config_dir, home_dir, output_dir):

exp_conf = info.read_exp_config(exp_name)
exp_status = info.exp_status_dir(exp_name)
run_status = validate_json(exp_status, 'start_time', 'end_time', 'time_delta', filename='run.json')
run_status = validate_json(exp_status, 'time_delta', filename='run.json')

exp_title = exp_name if 'title' not in exp_conf else exp_conf['title']
notify = exp_conf['notify']
Expand All @@ -67,10 +76,9 @@ def main(config_dir, home_dir, output_dir):
if not stage_statuses[stage]['success']:
failed_experiments.append(
failed_experiment_field(exp_title, stage_statuses,
stage, start_time=run_status.get('start_time'),
end_time=run_status.get('end_time'),
duration=run_status.get('time_delta'),
notify=notify))
stage,
duration=run_status.get('time_delta'),
notify=notify))
failure = True
break

Expand All @@ -85,8 +93,9 @@ def main(config_dir, home_dir, output_dir):

summary = info.read_exp_summary(exp_name)
successful_experiments.append(
build_field(summary['title'], summary['value'], run_status.get('start_time'),\
run_status.get('end_time'), run_status.get('time_delta')))
build_field(summary['title'],
attach_duration(summary['value'],
run_status.get('time_delta'))))

# produce messages
attachments = []
Expand Down

0 comments on commit 56721b1

Please sign in to comment.