Skip to content

Commit 1ac882e

Browse files
author
telemin
committed
support table configuration from command line
1 parent 9055b13 commit 1ac882e

File tree

3 files changed

+38
-10
lines changed

3 files changed

+38
-10
lines changed

pypop/cli.py

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,24 @@ def _cli_metrics_parse_args(metric_name="MPI"):
8686
)
8787

8888
# Output Customisation
89-
parser.add_argument("--metric-title", type=str, help="Title of metric table")
89+
parser.add_argument("--table-title", type=str, help="Title of metric table")
90+
parser.add_argument(
91+
"--table-key", type=str, default="auto", help="Key to use for table columns"
92+
)
93+
parser.add_argument(
94+
"--table-group",
95+
type=str,
96+
default="auto",
97+
help="Key to use for table column grouping",
98+
)
99+
90100
parser.add_argument("--scaling-title", type=str, help="Title of scaling plot")
101+
parser.add_argument(
102+
"--scaling-key",
103+
type=str,
104+
default="auto",
105+
help="Key to use for independent variable in scaling plot",
106+
)
91107

92108
return parser.parse_args()
93109

@@ -150,12 +166,16 @@ def mpi_cli_metrics():
150166

151167
# Create and save table
152168
if not config.no_metric_table:
153-
metric_table = metrics.plot_table(title=config.metric_title)
169+
metric_table = metrics.plot_table(
170+
title=config.table_title, columns_key=config.table_key
171+
)
154172
metric_table.savefig(config.metric_table)
155173

156174
# Create and save scaling plot
157175
if not config.no_scaling_plot:
158-
scaling_plot = metrics.plot_scaling(title=config.scaling_title)
176+
scaling_plot = metrics.plot_scaling(
177+
title=config.scaling_title, x_key=config.scaling_key
178+
)
159179
scaling_plot.savefig(config.scaling_plot)
160180

161181
# Save metrics as csv
@@ -181,12 +201,16 @@ def openmp_cli_metrics():
181201

182202
# Create and save table
183203
if not config.no_metric_table:
184-
metric_table = metrics.plot_table(title=config.metric_title)
204+
metric_table = metrics.plot_table(
205+
title=config.table_title, columns_key=config.table_key
206+
)
185207
metric_table.savefig(config.metric_table)
186208

187209
# Create and save scaling plot
188210
if not config.no_scaling_plot:
189-
scaling_plot = metrics.plot_scaling(title=config.scaling_title)
211+
scaling_plot = metrics.plot_scaling(
212+
title=config.scaling_title, x_key=config.scaling_key
213+
)
190214
scaling_plot.savefig(config.scaling_plot)
191215

192216
# Save metrics as csv
@@ -212,12 +236,16 @@ def hybrid_cli_metrics():
212236

213237
# Create and save table
214238
if not config.no_metric_table:
215-
metric_table = metrics.plot_table(title=config.metric_title)
239+
metric_table = metrics.plot_table(
240+
title=config.table_title, columns_key=config.table_key
241+
)
216242
metric_table.savefig(config.metric_table)
217243

218244
# Create and save scaling plot
219245
if not config.no_scaling_plot:
220-
scaling_plot = metrics.plot_scaling(title=config.scaling_title)
246+
scaling_plot = metrics.plot_scaling(
247+
title=config.scaling_title, x_key=config.scaling_key
248+
)
221249
scaling_plot.savefig(config.scaling_plot)
222250

223251
# Save metrics as csv

pypop/metrics/metricset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def plot_table(
212212
Figure containing the metrics table.
213213
"""
214214

215-
if columns_key == "auto":
215+
if columns_key is None or columns_key == "auto":
216216
columns_key = self._default_metric_key
217217

218218
with mpl.rc_context(pypop_mpl_params):
@@ -376,7 +376,7 @@ def plot_scaling(self, x_key="auto", y_key="Speedup", label=None, title=None):
376376
figure: matplotlib.figure.Figure
377377
Figure containing complete scaling plot.
378378
"""
379-
if x_key == "auto":
379+
if x_key is None or x_key == "auto":
380380
x_key = self._default_scaling_key
381381

382382
with mpl.rc_context(pypop_mpl_params):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name="pypop",
9-
version="0.2.0rc7",
9+
version="0.2.0rc8",
1010
url="https://github.com/numericalalgorithmsgroup/pypop.git",
1111
author="Numerical Algorithms Group",
1212
author_email="[email protected]",

0 commit comments

Comments
 (0)