Skip to content

Commit 53da63a

Browse files
authored
rename command line argument with - (#164)
* rename command line argument with - * minor ajustment
1 parent 5dde671 commit 53da63a

File tree

2 files changed

+41
-10
lines changed

2 files changed

+41
-10
lines changed

onnx_diagnostic/_command_lines_parser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,13 +718,13 @@ def get_parser_agg() -> ArgumentParser:
718718
"peak_gpu_torch,peak_gpu_nvidia,n_node_control_flow,"
719719
"n_node_constant,n_node_shape,n_node_expand,"
720720
"n_node_function,n_node_initializer,n_node_scatter,"
721-
"time_export_unbiased",
721+
"time_export_unbiased,onnx_n_nodes_no_cst,n_node_initializer_small",
722722
help="Columns to compute after the aggregation was done.",
723723
)
724724
parser.add_argument(
725725
"--views",
726726
default="agg-suite,agg-all,disc,speedup,time,time_export,err,cmd,"
727-
"bucket-speedup,raw-short,counts,peak-gpu",
727+
"bucket-speedup,raw-short,counts,peak-gpu,onnx",
728728
help="Views to add to the output files.",
729729
)
730730
parser.add_argument(
@@ -734,13 +734,13 @@ def get_parser_agg() -> ArgumentParser:
734734
)
735735
parser.add_argument("-v", "--verbose", type=int, default=0, help="verbosity")
736736
parser.add_argument(
737-
"--filter_in",
737+
"--filter-in",
738738
default="",
739739
help="adds a filter to filter in data, syntax is\n"
740740
'``"<column1>:<value1>;<value2>/<column2>:<value3>"`` ...',
741741
)
742742
parser.add_argument(
743-
"--filter_out",
743+
"--filter-out",
744744
default="",
745745
help="adds a filter to filter out data, syntax is\n"
746746
'``"<column1>:<value1>;<value2>/<column2>:<value3>"`` ...',

onnx_diagnostic/helpers/log_helper.py

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def apply_excel_style(
317317
co: Dict[int, int] = {}
318318
sizes: Dict[int, int] = {}
319319
cols = set()
320-
for i in range(1, n_rows):
320+
for i in range(1, n_rows + 1):
321321
for j, cell in enumerate(sheet[i]):
322322
if j > n_cols:
323323
break
@@ -335,7 +335,7 @@ def apply_excel_style(
335335
c = get_column_letter(k)
336336
sheet.column_dimensions[c].width = 15
337337

338-
for i in range(1, n_rows):
338+
for i in range(1, n_rows + 1):
339339
for j, cell in enumerate(sheet[i]):
340340
if j > n_cols:
341341
break
@@ -516,13 +516,14 @@ def _to_images_bar(
516516
df = self.df.T if self.orientation == "row" else self.df
517517
title_suffix = f"\n{title_suffix}" if title_suffix else ""
518518

519-
nn = len(df.columns) // 2
520-
nn += nn % 2
521-
fig, axs = plt.subplots(nn, 2, figsize=(12, nn * df.shape[0] / 4))
519+
n_cols = 3
520+
nn = df.shape[1] // n_cols
521+
nn += int(df.shape[1] % n_cols != 0)
522+
fig, axs = plt.subplots(nn, n_cols, figsize=(6 * n_cols, nn * df.shape[0] / 5))
522523
pos = 0
523524
imgs = []
524525
for c in self._make_loop(df.columns, verbose):
525-
ax = axs[pos // 2, pos % 2]
526+
ax = axs[pos // n_cols, pos % n_cols]
526527
(
527528
df[c].plot.barh(title=f"{c}{title_suffix}", ax=ax)
528529
if self.kind == "barh"
@@ -1427,9 +1428,11 @@ def __init__(
14271428
"n_node_scatter",
14281429
"n_node_function",
14291430
"n_node_initializer",
1431+
"n_node_initializer_small",
14301432
"n_node_constant",
14311433
"n_node_shape",
14321434
"n_node_expand",
1435+
"onnx_n_nodes_no_cst",
14331436
"peak_gpu_torch",
14341437
"peak_gpu_nvidia",
14351438
"time_export_unbiased",
@@ -1597,6 +1600,9 @@ def first_err(df: pandas.DataFrame) -> pandas.Series:
15971600
n_node_function=lambda df: gpreserve(
15981601
df, "onnx_n_functions", gdf(df, "onnx_n_functions")
15991602
),
1603+
n_node_initializer_small=lambda df: gpreserve(
1604+
df, "op_onnx_initializer_small", gdf(df, "op_onnx_initializer_small")
1605+
),
16001606
n_node_initializer=lambda df: gpreserve(
16011607
df, "onnx_n_initializer", gdf(df, "onnx_n_initializer")
16021608
),
@@ -1615,6 +1621,10 @@ def first_err(df: pandas.DataFrame) -> pandas.Series:
16151621
), f"Unexpected formula={formula!r}, should be in {sorted(lambdas)}"
16161622
return lambdas[formula]
16171623

1624+
if formula == "onnx_n_nodes_no_cst":
1625+
return lambda df: gdf(df, "onnx_n_nodes", 0) - gdf(
1626+
df, "op_onnx__Constant", 0
1627+
).fillna(0)
16181628
if formula == "peak_gpu_torch":
16191629
return lambda df: gdf(df, "mema_gpu_5_after_export") - gdf(df, "mema_gpu_4_reset")
16201630
if formula == "peak_gpu_nvidia":
@@ -1766,6 +1776,8 @@ def mean_geo(gr):
17661776
"onnx_weight_size_torch",
17671777
"onnx_weight_size_proto",
17681778
"onnx_n_nodes",
1779+
"onnx_n_nodes_no_cst",
1780+
"op_onnx__Constant",
17691781
"peak_gpu_torch",
17701782
"peak_gpu_nvidia",
17711783
],
@@ -1795,6 +1807,7 @@ def mean_geo(gr):
17951807
"onnx_weight_size_torch",
17961808
"onnx_weight_size_proto",
17971809
"onnx_n_nodes",
1810+
"onnx_n_nodes_no_cst",
17981811
"peak_gpu_torch",
17991812
"peak_gpu_nvidia",
18001813
],
@@ -1887,6 +1900,24 @@ def mean_geo(gr):
18871900
name="cmd",
18881901
order=order,
18891902
),
1903+
"onnx": lambda: CubeViewDef(
1904+
key_index=index_cols,
1905+
values=self._filter_column(
1906+
[
1907+
"onnx_filesize",
1908+
"onnx_n_nodes",
1909+
"onnx_n_nodes_no_cst",
1910+
"onnx_weight_size_proto",
1911+
"onnx_weight_size_torch",
1912+
"op_onnx_initializer_small",
1913+
],
1914+
self.values,
1915+
),
1916+
ignore_unique=True,
1917+
keep_columns_in_index=["suite"],
1918+
name="onnx",
1919+
order=order,
1920+
),
18901921
"raw-short": lambda: CubeViewDef(
18911922
key_index=self.keys_time,
18921923
values=[c for c in self.values if c not in {"ERR_std", "ERR_stdout"}],

0 commit comments

Comments
 (0)