From patchwork Wed Nov 13 11:57:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Koch X-Patchwork-Id: 35859 Received: (qmail 17706 invoked by alias); 13 Nov 2019 11:57:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 17690 invoked by uid 89); 13 Nov 2019 11:57:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=Point, 04, 0.4, matrix X-HELO: EUR03-VE1-obe.outbound.protection.outlook.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zOUIOSoBP+Y1dBc5Jog0L3zOeo+KgvAGkEXVvxbVN8s=; b=WqSjUU/WHhIS0UEb3JMwCnG0uEkeuQXLLN0c89HjpfW/17RdhJazKPEBfa9G4Cfx2TH96JMPWW538NNoRWVk3ZveZ8GZ/6GBj99rmleMgwD7BrA/OaGwcKTAFk5ZIQRemZcbGpCSjTUkx6gIg83CNAqbAhwZ7eG2UWof3YR2LFs= Authentication-Results: spf=fail (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; sourceware.org; dmarc=none action=none header.from=arm.com; Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TtKu452hXu/YDXBQ2e8cIfPQiJdcURBmFPFyQ+qiarsNpdZtJ2E76po28sDGEwqIsANmESELvRjEzkYrzB+z1Q/eoZxXFRc0YoME1NR/jOvCJmP9tsBsfYMoUzTxPZElNCvFo8bZQDvxEjMzmnP/PQRWmfVVy0URz5AprfRINqoE5qAVYM402+sPE6fRgw3BqGWteEe963ibIIVCGyDEGdf1R1arWUgT7zLwyEHn8C0opw8smEsyyIV0dClY0EBYa3gfkCihtFHOhXNFgXI63PNc6M8Fjffy3fhwVA+woA9E1C3Ry1Nuaykw7wPsABSH84gndG1ob/ukUxVAo6gOdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zOUIOSoBP+Y1dBc5Jog0L3zOeo+KgvAGkEXVvxbVN8s=; b=SKra0Y6lY/NBhcvYFLvlAv5N3xFdrOZcL/4MQJ9+V1ZbCybcKvk8ICzsZm/13Rym5GA1qiAeuEFemD7h6RTysCueUKX7wzx9GdalGQC4q0eqP9bHAtsOQb19u7GTouTZ/jbmGrm2EwS5ZkwIOX4adOTO2NvFCvr8CS9US4BZNvDesNK0VetL5FHcP09tOrtVc3QP0IN8wGXngtHxPCEffSniL1FUMqDD0aOKzQIo9hX8+8XsSNnIvEwAYGTyx6DDHpwAPGuIEEqmkFdaGKGMZjd0Jpm9AvXrC5xLv9+LWJ3iQPZZ9hdFw7ypXZ6H8NC46Z4mDB5lgm/1AJvZMnhhTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zOUIOSoBP+Y1dBc5Jog0L3zOeo+KgvAGkEXVvxbVN8s=; b=WqSjUU/WHhIS0UEb3JMwCnG0uEkeuQXLLN0c89HjpfW/17RdhJazKPEBfa9G4Cfx2TH96JMPWW538NNoRWVk3ZveZ8GZ/6GBj99rmleMgwD7BrA/OaGwcKTAFk5ZIQRemZcbGpCSjTUkx6gIg83CNAqbAhwZ7eG2UWof3YR2LFs= From: Krzysztof Koch To: "libc-alpha@sourceware.org" CC: nd Subject: [PATCH] Add new script for plotting string benchmark JSON output Date: Wed, 13 Nov 2019 11:57:17 +0000 Message-ID: x-ts-tracking-id: 5a8e7e9d-338a-4900-b5b4-c49c2956866a.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Krzysztof.Koch@arm.com; X-MS-Exchange-PUrlCount: 1 x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:5797;OLM:5797; X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(346002)(366004)(396003)(39860400002)(136003)(376002)(199004)(189003)(256004)(14444005)(3846002)(2906002)(6116002)(66066001)(71190400001)(71200400001)(2501003)(6916009)(99286004)(316002)(25786009)(74316002)(2351001)(7696005)(476003)(486006)(305945005)(33656002)(7736002)(52536014)(8936002)(5660300002)(81166006)(81156014)(66946007)(76116006)(66476007)(66446008)(64756008)(66556008)(66616009)(8676002)(30864003)(55016002)(4326008)(478600001)(9686003)(5640700003)(6436002)(6306002)(26005)(14454004)(6506007)(102836004)(186003)(86362001)(2004002)(579004); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB5167; H:VE1PR08MB4783.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: pHF6GLuxjwvH4z5Pco2rRFfDsv9adEPUh969w9zDx2STyZ/5I40MhE9ci44kba5Y/+0MCLWrBQ4iLWtVVqCplExwXyNCxS8ZT2T16cFS/8IMcaAdx25d9Z3fjlAfPiicaXCJGqwQa/bRFsRES1LU6Xa3qzjEjmavNg5rvbdkxLTIf/ZRAgpHt9cnh5BFancnx9pMwzcDZHEEsKHTot4Fx6h0q/mJtMfXMfHqNswPR0EP0yj6jIKolF/R/ZCtyZ+LaNuQTJ33Ll8XMn0MfR159mA3aXEPNTXEIfet1QnG46A0zYmC3mXR65PsYTQlY/EdBca8ahi/pFk4vKZqXIK1xPNTrdmxtcgWwamgg3uujzeB+uluehMq3KbxdX0vHS6ItGDESvjneyWYbB8wkqyCAj7cptE/ysm/BmikXnu79pgr+LPnBWJq1G3qaYyg67fxIjIxhkY53JiYs5sdicX3d9dSEBQ0Q+jcXuiL/8GR6R4= x-ms-exchange-transport-forked: True MIME-Version: 1.0 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Krzysztof.Koch@arm.com; Return-Path: Krzysztof.Koch@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT049.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 9a5df6f6-ad72-47f8-11eb-08d76830a1b6 Add a script for visualizing the JSON output generated by existing glibc string microbenchmarks. Overview: plot_strings.py is capable of plotting benchmark results in the following formats, which are controlled with the -p or --plot argument: 1. absolute timings (-p time): plot the timings as they are in the input benchmark results file. 2. relative timings (-p rel): plot relative timing difference with respect to a chosen ifunc (controlled with -b argument). 3. performance relative to max (-p max): for each varied parameter value, plot 1/timing as the percentage of the maximum value out of the plotted ifuncs. 4. throughput (-p thru): plot varied parameter value over timing For all types of graphs, there is an option to explicitly specify the subset of ifuncs to plot using the --ifuncs parameter. For plot types 1. and 4. one can hide/expose exact benchmark figures using the --values flag. When plotting relative timing differences between ifuncs, the first ifunc listed in the input JSON file is the baseline, unless the baseline implementation is explicitly chosen with the --baseline parameter. For the ease of reading, the script marks the statistically insignificant range on the graphs. The default is +-5% but this value can be controlled with the --threshold parameter. To accommodate for the heterogeneity in benchmark results files, one can control i.e the x-axis scale, the resolution (dpi) of the generated figures or the key to access the varied parameter value in the JSON file. The corresponding options are --logarithmic, --resolution or --key. The --key parameter ensures that plot_strings.py works with all files which pass JSON schema validation. The schema can be chosen with the --schema parameter. If a window manager is available, one can enable interactive figure display using the --display flag. Finally, one can use the --grid flag to enable grid lines in the generated figures. Implementation: plot_strings.py traverses the JSON tree until a 'results' array is found and generates a separate figure for each such array. The figure is then saved to a file in one of the available formats (controlled with the --extension parameter). As the tree is traversed, the recursive function tracks the metadata about the test being run, so that each figure has a unique and meaningful title and filename. While plot_strings.py works with existing benchmarks, provisions have been made to allow adding more structure and metadata to these benchmarks. Currently, many benchmarks produce multiple timing values for the same value of the varied parameter (typically 'length'). Mutiple data points for the same parameter usually mean that some other parameter was varied as well, for example, if memmove's src and dst buffers overlap or not (see bench-memmove-walk.c and bench-memmove-walk.out). Unfortunately, this information is not exposed in the benchmark output file, so plot_strings.py has to resort to computing the geometric mean of these multiple values. In the process, useful information about the benchmark configuration is lost. Also, averaging the timings for different alignments can hide useful characterstics of the benchmarked ifuncs. Testing: plot_strings.py has been tested on all existing string microbenchmarks which produce results in JSON format. The script was tested on both Windows 10 and Ubuntu 16.04.2 LTS. It runs on both python 2 and 3 (2.7.12 and 3.5.12 tested). Useful commands: 1. Plot timings for all ifuncs in bench-strlen.out: $ ./plot_strings.py bench-strlen.out 2. Display help: $ ./plot_strings.py -h 3. Plot throughput for __memset_avx512_unaligned_erms and __memset_avx512_unaligned. Save the generated figure in pdf format to 'results/'. Use logarithmic x-axis scale, show grid lines and expose the performance numbers: $ ./plot_strings.py bench.out -o results/ -lgv -e pdf -p thru \ -i __memset_avx512_unaligned_erms __memset_avx512_unaligned 4. Plot relative timings for all ifuncs in bench.out with __generic_memset as baseline. Display percentage difference threshold of +-10%: $ ./plot_strings.py bench.out -p rel -b __generic_memset -t 10 Discussion: 1. I would like to propose relaxing the benchout_strings.schema.json to allow specifying either a 'results' array with 'timings' (as before) or a 'variants' array. See below example: { "timing_type": "hp_timing", "functions": { "memcpy": { "bench-variant": "default", "ifuncs": ["generic_memcpy", "__memcpy_thunderx"], "variants": [ { "name": "powers of 2", "variants": [ { "name": "both aligned", "results": [ { "length": 1, "align1": 0, "align2": 0, "timings": [x, y] }, { "length": 2, "align1": 0, "align2": 0, "timings": [x, y] }, ... { "length": 65536, "align1": 0, "align2": 0, "timings": [x, y] }] }, { "name": "dst misaligned", "results": [ { "length": 1, "align1": 0, "align2": 0, "timings": [x, y] }, { "length": 2, "align1": 0, "align2": 1, "timings": [x, y] }, ... 'variants' array consists of objects such that each object has a 'name' attribute to describe the configuration of a particular test in the benchmark. This can be a description, for example, of how the parameter was varied or what was the buffer alignment tested. The 'name' attribute is then followed by another 'variants' array or a 'results' array. The nesting of variants allows arbitrary grouping of benchmark timings, while allowing description of these groups. Using recusion, it is possible to proceduraly create titles and filenames for the figures being generated. --- benchtests/scripts/plot_strings.py | 395 +++++++++++++++++++++++++++++++++++++ 1 file changed, 395 insertions(+) create mode 100755 benchtests/scripts/plot_strings.py diff --git a/benchtests/scripts/plot_strings.py b/benchtests/scripts/plot_strings.py new file mode 100755 index 0000000..b346d9b --- /dev/null +++ b/benchtests/scripts/plot_strings.py @@ -0,0 +1,395 @@ +#!/usr/bin/python3 +# Plot GNU C Library string microbenchmark output. +# Copyright (C) 2019 Free Software Foundation, Inc. +# This file is part of the GNU C Library. +# +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . +"""Plot string microbenchmark results. + +Given a benchmark results file in JSON format and a benchmark schema file, +plot the benchmark timings in one of the available representations. + +Separate figure is generated and saved to a file for each 'results' array +found in the benchmark results file. Output filenames and plot titles +are derived from the metadata found in the benchmark results file. +""" +import argparse +from collections import defaultdict +import json +import matplotlib as mpl +import numpy as np +import os + +try: + import jsonschema as validator +except ImportError: + print("Could not find jsonschema module.") + raise + +# Use pre-selected markers for plotting lines to improve readability +markers = [".", "x", "^", "+", "*", "v", "1", ">", "s"] + +# Benchmark variants for which the x-axis scale should be logarithmic +log_variants = {"powers of 2"} + + +def gmean(numbers): + """Compute geometric mean. + + Args: + numbers: 2-D list of numbers + Return: + numpy array with geometric means of numbers along each column + """ + a = np.array(numbers, dtype=np.complex) + means = a.prod(0) ** (1.0 / len(a)) + return np.real(means) + + +def relativeDifference(x, x_reference): + """Compute per-element relative difference between each row of + a matrix and an array of reference values. + + Args: + x: numpy matrix of shape (n, m) + x_reference: numpy array of size m + Return: + relative difference between rows of x and x_reference (in %) + """ + abs_diff = np.subtract(x, x_reference) + return np.divide(np.multiply(abs_diff, 100.0), x_reference) + + +def plotTime(timings, routine, bench_variant, title, outpath): + """Plot absolute timing values. + + Args: + timings: timings to plot + routine: benchmarked string routine name + bench_variant: top-level benchmark variant name + title: figure title (generated so far) + outpath: output file path (generated so far) + Return: + y: y-axis values to plot + title_final: final figure title + outpath_final: file output file path + """ + y = timings + plt.figure() + + if not args.values: + plt.axes().yaxis.set_major_formatter(plt.NullFormatter()) + + plt.ylabel("timing") + title_final = "%s %s benchmark timings\n%s" % \ + (routine, bench_variant, title) + outpath_final = os.path.join(args.outdir, "%s_%s_%s%s" % \ + (routine, args.plot, bench_variant, outpath)) + + return y, title_final, outpath_final + + +def plotRelative(timings, all_timings, routine, ifuncs, bench_variant, + title, outpath): + """Plot timing values relative to a chosen ifunc + + Args: + timings: timings to plot + all_timings: all collected timings + routine: benchmarked string routine name + ifuncs: names of ifuncs tested + bench_variant: top-level benchmark variant name + title: figure title (generated so far) + outpath: output file path (generated so far) + Return: + y: y-axis values to plot + title_final: final figure title + outpath_final: file output file path + """ + # Choose the baseline ifunc + if args.baseline: + baseline = args.baseline.replace("__", "") + else: + baseline = ifuncs[0] + + baseline_index = ifuncs.index(baseline) + + # Compare timings against the baseline + y = relativeDifference(timings, all_timings[baseline_index]) + + plt.figure() + plt.axhspan(-args.threshold, args.threshold, color="lightgray", alpha=0.3) + plt.axhline(0, color="k", linestyle="--", linewidth=0.4) + plt.ylabel("relative timing (in %)") + title_final = "Timing comparison against %s\nfor %s benchmark, %s" % \ + (baseline, bench_variant, title) + outpath_final = os.path.join(args.outdir, "%s_%s_%s%s" % \ + (baseline, args.plot, bench_variant, outpath)) + + return y, title_final, outpath_final + + +def plotMax(timings, routine, bench_variant, title, outpath): + """Plot results as percentage of the maximum ifunc performance. + + The optimal ifunc is computed on a per-parameter-value basis. + Performance is computed as 1/timing. + + Args: + timings: timings to plot + routine: benchmarked string routine name + bench_variant: top-level benchmark variant name + title: figure title (generated so far) + outpath: output file path (generated so far) + Return: + y: y-axis values to plot + title_final: final figure title + outpath_final: file output file path + """ + perf = np.reciprocal(timings) + max_perf = np.max(perf, axis=0) + y = np.add(100.0, relativeDifference(perf, max_perf)) + + plt.figure() + plt.axhline(100.0, color="k", linestyle="--", linewidth=0.4) + plt.ylabel("1/timing relative to max (in %)") + title_final = "Performance comparison against max for %s\n%s " \ + "benchmark, %s" % (routine, bench_variant, title) + outpath_final = os.path.join(args.outdir, "%s_%s_%s%s" % \ + (routine, args.plot, bench_variant, outpath)) + + return y, title_final, outpath_final + + +def plotThroughput(timings, params, routine, bench_variant, title, outpath): + """Plot throughput. + + Throughput is computed as the varied parameter value over timing. + + Args: + timings: timings to plot + params: varied parameter values + routine: benchmarked string routine name + bench_variant: top-level benchmark variant name + title: figure title (generated so far) + outpath: output file path (generated so far) + Return: + y: y-axis values to plot + title_final: final figure title + outpath_final: file output file path + """ + y = np.divide(params, timings) + plt.figure() + + if not args.values: + plt.axes().yaxis.set_major_formatter(plt.NullFormatter()) + + plt.ylabel("%s / timing" % args.key) + title_final = "%s %s benchmark throughput results\n%s" % \ + (routine, bench_variant, title) + outpath_final = os.path.join(args.outdir, "%s_%s_%s%s" % \ + (routine, args.plot, bench_variant, outpath)) + return y, title_final, outpath_final + + +def finishPlot(x, y, title, outpath, x_scale, plotted_ifuncs): + """Finish generating current Figure. + + Args: + x: x-axis values + y: y-axis values + title: figure title + outpath: output file path + x_scale: x-axis scale + plotted_ifuncs: names of ifuncs to plot + """ + plt.xlabel(args.key) + plt.xscale(x_scale) + plt.title(title) + + plt.grid(color="k", linestyle=args.grid, linewidth=0.5, alpha=0.5) + + for i in range(len(plotted_ifuncs)): + plt.plot(x, y[i], marker=markers[i % len(markers)], + label=plotted_ifuncs[i]) + + plt.legend(loc="best", fontsize="small") + plt.savefig("%s_%s.%s" % (outpath, x_scale, args.extension), + format=args.extension, dpi=args.resolution) + + if args.display: + plt.show() + + plt.close() + + +def plotRecursive(json_iter, routine, ifuncs, bench_variant, title, outpath, + x_scale): + """Plot benchmark timings. + + Args: + json_iter: reference to json object + routine: benchmarked string routine name + ifuncs: names of ifuncs tested + bench_variant: top-level benchmark variant name + title: figure's title (generated so far) + outpath: output file path (generated so far) + x_scale: x-axis scale + """ + + # RECURSIVE CASE: 'variants' array found + if "variants" in json_iter: + # Continue recursive search for 'results' array. Record the + # benchmark variant (configuration) in order to customize + # the title, filename and X-axis scale for the generated figure. + for variant in json_iter["variants"]: + new_title = "%s%s, " % (title, variant["name"]) + new_outpath = "%s_%s" % (outpath, variant["name"].replace(" ", "_")) + new_x_scale = "log" if variant["name"] in log_variants else x_scale + + plotRecursive(variant, routine, ifuncs, bench_variant, new_title, + new_outpath, new_x_scale) + return + + # BASE CASE: 'results' array found + domain = [] + timings = defaultdict(list) + + # Collect timings + for result in json_iter["results"]: + domain.append(result[args.key]) + timings[result[args.key]].append(result["timings"]) + + domain = np.unique(np.array(domain)) + averages = [] + + # Compute geometric mean if there are multple timings for each + # parameter value. + for parameter in domain: + averages.append(gmean(timings[parameter])) + + averages = np.array(averages).transpose() + + # Choose ifuncs to plot + if isinstance(args.ifuncs, str): + plotted_ifuncs = ifuncs + else: + plotted_ifuncs = [x.replace("__", "") for x in args.ifuncs] + + plotted_indices = [ifuncs.index(x) for x in plotted_ifuncs] + plotted_vals = averages[plotted_indices,:] + + # Plotting logic specific to each plot type + if args.plot == "time": + codomain, title, outpath = plotTime(plotted_vals, routine, + bench_variant, title, outpath) + elif args.plot == "rel": + codomain, title, outpath = plotRelative(plotted_vals, averages, routine, + ifuncs, bench_variant, title, outpath) + elif args.plot == "max": + codomain, title, outpath = plotMax(plotted_vals, routine, + bench_variant, title, outpath) + elif args.plot == "thru": + codomain, title, outpath = plotThroughput(plotted_vals, domain, routine, + bench_variant, title, outpath) + + # Plotting logic shared between plot types + finishPlot(domain, codomain, title, outpath, x_scale, plotted_ifuncs) + + +def main(args): + """Program Entry Point. + + Args: + args: command line arguments (excluding program name) + """ + + # Select non-GUI matplotlib backend if interactive display is disabled + if not args.display: + mpl.use("Agg") + + global plt + import matplotlib.pyplot as plt + + schema = None + + with open(args.schema, "r") as f: + schema = json.load(f) + + for filename in args.bench: + bench = None + + with open(filename, "r") as f: + bench = json.load(f) + + validator.validate(bench, schema) + + for function in bench["functions"]: + bench_variant = bench["functions"][function]["bench-variant"] + ifuncs = bench["functions"][function]["ifuncs"] + ifuncs = [x.replace("__", "") for x in ifuncs] + + plotRecursive(bench["functions"][function], function, ifuncs, + bench_variant, "", "", args.logarithmic) + + +""" main() """ +if __name__ == "__main__": + + parser = argparse.ArgumentParser(description= + "Plot string microbenchmark results", + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + # Required parameter + parser.add_argument("bench", nargs="+", + help="benchmark results file(s) in json format") + + # Optional parameters + parser.add_argument("-b", "--baseline", type=str, + help="baseline ifunc for 'rel' plot") + parser.add_argument("-d", "--display", action="store_true", + help="display figures") + parser.add_argument("-e", "--extension", type=str, default="png", + choices=["png", "pdf", "svg"], + help="output file(s) extension") + parser.add_argument("-g", "--grid", action="store_const", default="", + const="-", help="show grid lines") + parser.add_argument("-i", "--ifuncs", nargs="+", default="all", + help="ifuncs to plot") + parser.add_argument("-k", "--key", type=str, default="length", + help="key to access the varied parameter") + parser.add_argument("-l", "--logarithmic", action="store_const", + default="linear", const="log", + help="use logarithmic x-axis scale") + parser.add_argument("-o", "--outdir", type=str, default=os.getcwd(), + help="output directory") + parser.add_argument("-p", "--plot", type=str, default="time", + choices=["time", "rel", "max", "thru"], + help="plot absolute timings, relative timings, " \ + "performance relative to max, or throughput") + parser.add_argument("-r", "--resolution", type=int, default=100, + help="dpi resolution for the generated figures") + parser.add_argument("-s", "--schema", type=str, + default=os.path.join(os.path.dirname( + os.path.realpath(__file__)), + "benchout_strings.schema.json"), + help="schema file to validate the results file.") + parser.add_argument("-t", "--threshold", type=int, default=5, + help="threshold to mark in 'rel' graph (in %%)") + parser.add_argument("-v", "--values", action="store_true", + help="show actual values") + + args = parser.parse_args() + main(args)