diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2018-01-25 21:24:18 +0100 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2018-01-25 21:24:18 +0100 |
commit | 3651b5166406527b2085d5b6ed100ddfd4ea2c5b (patch) | |
tree | 40f531b8e6e7937e808d6fea452188a42fca307f /scripts/benchmark | |
parent | 19fd263fb26f292a12f5d0fc047174934c6daf04 (diff) |
Improved the benchmark scripts; added gemmstridedbatched benchmark
Diffstat (limited to 'scripts/benchmark')
-rw-r--r-- | scripts/benchmark/benchmark.py | 6 | ||||
-rw-r--r-- | scripts/benchmark/plot.py | 15 | ||||
-rw-r--r-- | scripts/benchmark/settings.py | 58 |
3 files changed, 63 insertions, 16 deletions
diff --git a/scripts/benchmark/benchmark.py b/scripts/benchmark/benchmark.py index d0a9d80f..d84d5d98 100644 --- a/scripts/benchmark/benchmark.py +++ b/scripts/benchmark/benchmark.py @@ -22,6 +22,7 @@ EXPERIMENTS = { "gemm": settings.GEMM, "gemm_small": settings.GEMM_SMALL, "gemmbatched": settings.GEMMBATCHED, + "gemmstridedbatched": settings.GEMMSTRIDEDBATCHED, "symm": settings.SYMM, "syrk": settings.SYRK, "summary": settings.SUMMARY, @@ -162,6 +163,11 @@ def benchmark_single(benchmark, comparisons, platform, device, num_runs, precisi label_names.append("CLBlast FP32") y_keys = [y_key + [y_key[0] + "_FP32"] for y_key in y_keys] + # For batched routines: comparison is non-batched + if benchmark in ["axpybatched", "gemmbatched", "gemmstridedbatched"]: + for index in range(1, len(label_names)): + label_names[index] += " (non-batched)" + # Plots the graphs plot.plot_graphs(results["benchmarks"], pdf_file_name, results["num_rows"], results["num_cols"], x_keys, y_keys, titles, x_labels, y_labels, diff --git a/scripts/benchmark/plot.py b/scripts/benchmark/plot.py index 06fb278f..66d71595 100644 --- a/scripts/benchmark/plot.py +++ b/scripts/benchmark/plot.py @@ -109,9 +109,20 @@ def plot_graphs(results, file_name, num_rows, num_cols, assert len(label_names) == len(y_keys[index]) for i in range(len(y_keys[index])): color = COLORS[i] - if label_names[i] == "cuBLAS": + marker = MARKERS[i] + if label_names[i] in ["CLBlast", "CLBlast FP32"]: + color = BLUEISH + marker = "o-" + elif label_names[i] in ["CLBlast FP16"]: + color = PURPLISH + marker = ".-" + elif label_names[i] in ["clBLAS", "clBLAS FP32"]: + color = REDISH + marker = "x-" + elif label_names[i] == "cuBLAS": color = GREEN - ax.plot(x_location, y_list[i], MARKERS[i], label=label_names[i], color=color) + marker = ".-" + ax.plot(x_location, y_list[i], marker, label=label_names[i], color=color) # Sets the legend leg = ax.legend(loc=(0.02, 1.0 - legend_from_top - legend_from_top_per_item * len(y_keys[index])), diff --git a/scripts/benchmark/settings.py b/scripts/benchmark/settings.py index d0d17178..98b97530 100644 --- a/scripts/benchmark/settings.py +++ b/scripts/benchmark/settings.py @@ -63,28 +63,28 @@ AXPYBATCHED = { "num_rows": 1, "num_cols": 3, "benchmarks": [ { - "name": "axpybatched", "num_runs": 30, - "title": "8 AXPYs", + "name": "axpybatched", "num_runs": 10, + "title": "b=8", "x_label": "sizes (n)", "x_keys": ["n"], "y_label": "GB/s (higher is better)", "y_key": "GBs", "arguments": [{"batch_num": 8, "n": n, "incx": 1, "incy": 1, "step": 0, "num_steps": 1} for n in utils.powers_of_2(utils.k(8), utils.m(4))], }, { - "name": "axpybatched", "num_runs": 20, - "title": "64 AXPYs", + "name": "axpybatched", "num_runs": 5, + "title": "b=64", "x_label": "sizes (n)", "x_keys": ["n"], "y_label": "GB/s (higher is better)", "y_key": "GBs", "arguments": [{"batch_num": 64, "n": n, "incx": 1, "incy": 1, "step": 0, "num_steps": 1} for n in utils.powers_of_2(utils.k(8), utils.m(4))], }, { - "name": "axpybatched", "num_runs": 40, + "name": "axpybatched", "num_runs": 10, "title": "n=512K", - "x_label": "batch size", "x_keys": ["batch_num"], + "x_label": "num batches (b)", "x_keys": ["batch_num"], "y_label": "GB/s (higher is better)", "y_key": "GBs", "arguments": [{"batch_num": b, "n": utils.k(512), "incx": 1, "incy": 1, "step": 1, "num_steps": 1} - for b in utils.powers_of_2(1, 512)], + for b in utils.powers_of_2(1, 256)], } ] } @@ -221,28 +221,58 @@ GEMMBATCHED = { "num_rows": 1, "num_cols": 3, "benchmarks": [ { - "name": "gemmbatched", "num_runs": 40, - "title": "8 GEMMs", + "name": "gemmbatched", "num_runs": 20, + "title": "b=8", "x_label": "sizes (m=n=k)", "x_keys": ["m"], "y_label": "GFLOPS (higher is better)", "y_key": "GFLOPS", "arguments": [{"batch_num": 8, "m": 32, "n": 32, "k": 32, "layout": 102, "transA": 111, "transB": 111, "step": 32, "num_steps": 20}], }, { - "name": "gemmbatched", "num_runs": 20, - "title": "64 GEMMs", + "name": "gemmbatched", "num_runs": 10, + "title": "b=64", + "x_label": "sizes (m=n=k)", "x_keys": ["m"], + "y_label": "GFLOPS (higher is better)", "y_key": "GFLOPS", + "arguments": [{"batch_num": 64, "m": 32, "n": 32, "k": 32, "layout": 102, + "transA": 111, "transB": 111, "step": 32, "num_steps": 20}], + }, + { + "name": "gemmbatched", "num_runs": 10, + "title": "m=n=k=128", + "x_label": "num batches (b)", "x_keys": ["batch_num"], + "y_label": "GFLOPS (higher is better)", "y_key": "GFLOPS", + "arguments": [{"batch_num": b, "m": 128, "n": 128, "k": 128, "layout": 102, + "transA": 111, "transB": 111} for b in utils.powers_of_2(1, utils.k(4))], + } + ] +} + +GEMMSTRIDEDBATCHED = { + "num_rows": 1, "num_cols": 3, + "benchmarks": [ + { + "name": "gemmstridedbatched", "num_runs": 20, + "title": "b=8", + "x_label": "sizes (m=n=k)", "x_keys": ["m"], + "y_label": "GFLOPS (higher is better)", "y_key": "GFLOPS", + "arguments": [{"batch_num": 8, "m": 32, "n": 32, "k": 32, "layout": 102, + "transA": 111, "transB": 111, "step": 32, "num_steps": 20}], + }, + { + "name": "gemmstridedbatched", "num_runs": 10, + "title": "b=64", "x_label": "sizes (m=n=k)", "x_keys": ["m"], "y_label": "GFLOPS (higher is better)", "y_key": "GFLOPS", "arguments": [{"batch_num": 64, "m": 32, "n": 32, "k": 32, "layout": 102, "transA": 111, "transB": 111, "step": 32, "num_steps": 20}], }, { - "name": "gemmbatched", "num_runs": 30, + "name": "gemmstridedbatched", "num_runs": 10, "title": "m=n=k=128", - "x_label": "batch size", "x_keys": ["batch_num"], + "x_label": "num batches (b)", "x_keys": ["batch_num"], "y_label": "GFLOPS (higher is better)", "y_key": "GFLOPS", "arguments": [{"batch_num": b, "m": 128, "n": 128, "k": 128, "layout": 102, - "transA": 111, "transB": 111} for b in utils.powers_of_2(1, utils.k(16))], + "transA": 111, "transB": 111} for b in utils.powers_of_2(1, utils.k(4))], } ] } |