Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 33 additions & 14 deletions util/job_launching/get_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,26 @@ def millify(n):
specific_jobIds = {}

stats_to_pull = {}

# stat names without the regex
statnames_to_pull = {}

stats_yaml = yaml.load(open(options.stats_yml), Loader=yaml.FullLoader )
stats= {}
for stat in stats_yaml['collect_aggregate']:
stats_to_pull[stat] = re.compile(stat), "agg"
for statname_and_regex in stats_yaml['collect_aggregate']:
for statname,regex in statname_and_regex.items():
stats_to_pull[regex] = re.compile(regex), "agg"
statnames_to_pull[regex] = statname

for stat in stats_yaml['collect_abs']:
stats_to_pull[stat] = re.compile(stat), "abs"

for stat in stats_yaml['collect_rates']:
stats_to_pull[stat] = re.compile(stat), "rate"
for statname_and_regex in stats_yaml['collect_abs']:
for statname,regex in statname_and_regex.items():
stats_to_pull[regex] = re.compile(regex), "abs"
statnames_to_pull[regex] = statname

for statname_and_regex in stats_yaml['collect_rates']:
for statname,regex in statname_and_regex.items():
stats_to_pull[regex] = re.compile(regex), "rate"
statnames_to_pull[regex] = statname

if options.configs_list != "" and options.benchmark_list != "":
for app in common.gen_apps_from_suite_list(options.benchmark_list.split(",")):
Expand Down Expand Up @@ -274,7 +283,8 @@ def millify(n):
if existance_test != None:
stat_found.add(stat_name)
number = existance_test.group(1).strip()
stat_map["final_kernel" + app_and_args + config + stat_name] = number
stat_map["final_kernel" + app_and_args + config \
+ statnames_to_pull[stat_name]] = number
if len(stat_found) == len(stats_to_pull):
break
del lines
Expand All @@ -295,8 +305,10 @@ def millify(n):
if last_kernel_break:
print("NOTE::::: Found Max Insn reached in {0} - ignoring last kernel.".format(outfile), file=sys.stderr)
for stat_name in stats_to_pull.keys():
if current_kernel + app_and_args + config + stat_name in stat_map:
del stat_map[current_kernel + app_and_args + config + stat_name]
if current_kernel + app_and_args + config + \
statnames_to_pull[stat_name] in stat_map:
del stat_map[current_kernel + app_and_args + config \
+ statnames_to_pull[stat_name]]

kernel_match = re.match("kernel_name\s+=\s+(.*)", line);
if kernel_match:
Expand Down Expand Up @@ -326,15 +338,20 @@ def millify(n):
stat_found.add(stat_name)
number = existance_test.group(1).strip()
if statType != "agg":
stat_map[current_kernel + app_and_args + config + stat_name] = number
elif current_kernel + app_and_args + config + stat_name in stat_map:
stat_map[current_kernel + app_and_args + config + \
statnames_to_pull[stat_name]] = number
elif current_kernel + app_and_args + config + \
statnames_to_pull[stat_name] in stat_map:
stat_name = statnames_to_pull[stat_name];

if stat_name in raw_last:
stat_last_kernel = raw_last[stat_name]
else:
stat_last_kernel = 0.0
raw_last[ stat_name ] = float(number)
stat_map[current_kernel + app_and_args + config + stat_name] += ( float(number) - stat_last_kernel )
else:
stat_name = statnames_to_pull[stat_name];
if last_kernel + app_and_args + config + stat_name in stat_map:
stat_last_kernel = raw_last[stat_name]
else:
Expand All @@ -356,10 +373,12 @@ def millify(n):
common.print_stat( "Accel-Sim-build", all_kernels, apps_and_args, configs, stat_map, options.configs_as_rows, options.do_averages )
common.print_stat( "GPGPU-Sim-build", all_kernels, apps_and_args, configs, stat_map, options.configs_as_rows, options.do_averages )

for stat_name in ( stats_yaml['collect_aggregate'] +\
for statname_and_regex in ( stats_yaml['collect_aggregate'] +\
stats_yaml['collect_abs'] +\
stats_yaml['collect_rates'] ):
common.print_stat( stat_name, all_named_kernels, apps_and_args, configs, stat_map, options.configs_as_rows, options.do_averages )
for stat_name,regex in statname_and_regex.items():
common.print_stat( stat_name, all_named_kernels, apps_and_args, configs, stat_map, \
options.configs_as_rows, options.do_averages )

duration = time.time() - start_time

Expand Down
60 changes: 36 additions & 24 deletions util/job_launching/stats/example_stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,50 @@
# Here is a handy regex tester that helps get the thing right faster without re-running stuff:
# http://www.regexpal.com/

# Please specify each metric in the following form:
# - {<metric name to display>:<regular expression to fetch the metric's value>}
# The display metric name may be customized as it is outside the regex

# These stats are continuously aggregated - even between kerenels and should
# be diff'd to get the per-kernel stats
collect_aggregate:
- 'gpu_tot_sim_insn\s*=\s*(.*)'
- 'gpgpu_simulation_time\s*=.*\(([0-9]+) sec\).*'
- 'gpu_tot_sim_cycle\s*=\s*(.*)'
- '\s+L2_cache_stats_breakdown\[GLOBAL_ACC_R\]\[HIT\]\s*=\s*(.*)'
- '\s+L2_cache_stats_breakdown\[GLOBAL_ACC_R\]\[TOTAL_ACCESS\]\s*=\s*(.*)'
- '\s+L2_cache_stats_breakdown\[GLOBAL_ACC_W\]\[HIT\]\s*=\s*(.*)'
- '\s+L2_cache_stats_breakdown\[GLOBAL_ACC_W\]\[TOTAL_ACCESS\]\s*=\s*(.*)'
- '\s+Total_core_cache_stats_breakdown\[GLOBAL_ACC_R\]\[TOTAL_ACCESS\]\s*=\s*(.*)'
- '\s+Total_core_cache_stats_breakdown\[GLOBAL_ACC_R\]\[HIT\]\s*=\s*(.*)'
- '\s+Total_core_cache_stats_breakdown\[GLOBAL_ACC_W\]\[HIT\]\s*=\s*(.*)'
- '\s+Total_core_cache_stats_breakdown\[GLOBAL_ACC_W\]\[TOTAL_ACCESS\]\s*=\s*(.*)'
- '\s+Total_core_cache_stats_breakdown\[GLOBAL_ACC_R\]\[MSHR_HIT\]\s*=\s*(.*)'
- 'gpgpu_n_tot_w_icount\s*=\s*(.*)'
- 'total dram reads\s*=\s*(.*)'
- 'total dram writes\s*=\s*(.*)'
- 'kernel_launch_uid\s*=\s*(.*)'

- {'gpu_tot_sim_insn':'gpu_tot_sim_insn\s*=\s*(.*)'}
- {'gpgpu_simulation_time':'gpgpu_simulation_time\s*=.*\(([0-9]+) sec\).*'}
- {'gpu_tot_sim_cycle':'gpu_tot_sim_cycle\s*=\s*(.*)'}
- {'L2_cache_stats_breakdown[GLOBAL_ACC_R][HIT]':
'\s+L2_cache_stats_breakdown\[GLOBAL_ACC_R\]\[HIT\]\s*=\s*(.*)'}
- {'L2_cache_stats_breakdown[GLOBAL_ACC_R][TOTAL_ACCESS]':
'\s+L2_cache_stats_breakdown\[GLOBAL_ACC_R\]\[TOTAL_ACCESS\]\s*=\s*(.*)'}
- {'L2_cache_stats_breakdown[GLOBAL_ACC_W][HIT]':
'\s+L2_cache_stats_breakdown\[GLOBAL_ACC_W\]\[HIT\]\s*=\s*(.*)'}
- {'L2_cache_stats_breakdown[GLOBAL_ACC_W][TOTAL_ACCESS]':
'\s+L2_cache_stats_breakdown\[GLOBAL_ACC_W\]\[TOTAL_ACCESS\]\s*=\s*(.*)'}
- {'Total_core_cache_stats_breakdown[GLOBAL_ACC_R][TOTAL_ACCESS]':
'\s+Total_core_cache_stats_breakdown\[GLOBAL_ACC_R\]\[TOTAL_ACCESS\]\s*=\s*(.*)'}
- {'Total_core_cache_stats_breakdown[GLOBAL_ACC_R][HIT]':
'\s+Total_core_cache_stats_breakdown\[GLOBAL_ACC_R\]\[HIT\]\s*=\s*(.*)'}
- {'Total_core_cache_stats_breakdown[GLOBAL_ACC_W][HIT]':
'\s+Total_core_cache_stats_breakdown\[GLOBAL_ACC_W\]\[HIT\]\s*=\s*(.*)'}
- {'Total_core_cache_stats_breakdown[GLOBAL_ACC_W][TOTAL_ACCESS]':
'\s+Total_core_cache_stats_breakdown\[GLOBAL_ACC_W\]\[TOTAL_ACCESS\]\s*=\s*(.*)'}
- {'Total_core_cache_stats_breakdown[GLOBAL_ACC_R][MSHR_HIT]':
'\s+Total_core_cache_stats_breakdown\[GLOBAL_ACC_R\]\[MSHR_HIT\]\s*=\s*(.*)'}
- {'gpgpu_n_tot_w_icount':'gpgpu_n_tot_w_icount\s*=\s*(.*)'}
- {'total_dram_reads':'total dram reads\s*=\s*(.*)'}
- {'total_dram_writes':'total dram writes\s*=\s*(.*)'}
- {'kernel_launch_uid':'kernel_launch_uid\s*=\s*(.*)'}

# These stats are reset each kernel and should not be diff'd
# They cannot be used is only collecting the final_kernel stats
collect_abs:
- 'gpu_ipc\s*=\s*(.*)'
- 'gpu_occupancy\s*=\s*(.*)%'
- 'L2_BW\s*=\s*(.*)+GB\/Sec'
- {'gpu_ipc':'gpu_ipc\s*=\s*(.*)'}
- {'gpu_occupancy':'gpu_occupancy\s*=\s*(.*)%'}
- {'L2_BW':'L2_BW\s*=\s*(.*)+GB\/Sec'}

# These stats are rates that aggregate - but cannot be diff'd
# Only valid as a snapshot and most useful for the final kernel launch
collect_rates:
- 'gpgpu_simulation_rate\s+=\s+(.*)\s+\(inst\/sec\)'
- 'gpgpu_simulation_rate\s+=\s+(.*)\s+\(cycle\/sec\)'
- 'gpgpu_silicon_slowdown\s*=\s*(.*)x'
- 'gpu_tot_ipc\s*=\s*(.*)'
- {'gpgpu_simulation_rate(inst/sec)':'gpgpu_simulation_rate\s+=\s+(.*)\s+\(inst\/sec\)'}
- {'gpgpu_simulation_rate(cycle/sec)':'gpgpu_simulation_rate\s+=\s+(.*)\s+\(cycle\/sec\)'}
- {'gpgpu_silicon_slowdown':'gpgpu_silicon_slowdown\s*=\s*(.*)x'}
- {'gpu_tot_ipc':'gpu_tot_ipc\s*=\s*(.*)'}
Loading