-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds Performance Counter and user defined Scale Factor options to Python Speech Sample #6650
Adds Performance Counter and user defined Scale Factor options to Python Speech Sample #6650
Conversation
if args.performance_counter: | ||
plugin_config['PERF_COUNT'] = 'YES' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the option enabled only for GNA device?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this aligns with the current C++ implementation.
if args.performance_counter: | ||
pc = perf_counters[i] | ||
total_cycles = int(pc["1.1 Total scoring time in HW"]["real_time"]) | ||
stall_cycles = int(pc["1.2 Stall scoring time in HW"]["real_time"]) | ||
active_cycles = total_cycles - stall_cycles | ||
frequency = 10**6 | ||
if args.arch == "CORE": | ||
frequency *= 400 | ||
else: | ||
frequency *= 200 | ||
total_inference_time = total_cycles/frequency | ||
active_time = active_cycles/frequency | ||
stall_time = stall_cycles/frequency | ||
print("\nPerformance Statistics of GNA Hardware") | ||
print(" Total Inference Time: " + str(total_inference_time * 1000) + " ms") | ||
print(" Active Time: " + str(active_time * 1000) + " ms") | ||
print(" Stall Time: " + str(stall_time * 1000) + " ms\n") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works only on harware GNA, on software it always shows 0.0ms.
@dorloff Do we need to get a per-layer report as in C++ version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's expected that it's 0.0 on SW emulation mode.
I think we can have a per-layer report, but don't need to do it in this PR.
|
||
|
||
if args.arch: | ||
if args.arch not in ("CORE", "ARCH"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
combine two ifs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed - handling in argparser choices as mentioned below. :)
|
||
if args.arch: | ||
if args.arch not in ("CORE", "ARCH"): | ||
log.error('The architectuer argument only accepts CORE or ARCH') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can add such a check via argparser choices option, it will be tracked automatically
total_inference_time = total_cycles/frequency | ||
active_time = active_cycles/frequency | ||
stall_time = stall_cycles/frequency | ||
print("\nPerformance Statistics of GNA Hardware") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use logger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change made
if args.arch == "CORE": | ||
frequency *= 400 | ||
else: | ||
frequency *= 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
define magic numbers via global variables and add comments
@generalova-kate - thanks for your feedback! Made the changes requested. |
@generalova-kate - does this PR look ready to merge? |
@dorloff - fyi in case you want to close on this |
Three new cmd line arguments:
-a/--arch is a complimentary argument for when -pc is used to allow for correct interpretation of the performance counter values returned.