From 9185be7074068f654eb6843a61e57b0963b1eab2 Mon Sep 17 00:00:00 2001 From: Wes Bethel Date: Tue, 18 Oct 2022 07:10:47 -0700 Subject: [PATCH] Updates to README, addition of plotting script and sample data --- README.md | 5 ++++ plot_3vars.py | 62 +++++++++++++++++++++++++++++++++++++++++++ sample_data_3vars.csv | 8 ++++++ 3 files changed, 75 insertions(+) create mode 100644 plot_3vars.py create mode 100644 sample_data_3vars.csv diff --git a/README.md b/README.md index ffb5d9c..092e946 100644 --- a/README.md +++ b/README.md @@ -89,4 +89,9 @@ or When you run each code, it will iterate through the set of problem sizes predefined inside benchmark.cpp +# Building and running the codes on Cori@NERSC + +Please refer to lecture slides for additional information about accessing Cori, building your code there, and running your code there. + + # EOF diff --git a/plot_3vars.py b/plot_3vars.py new file mode 100644 index 0000000..60f7841 --- /dev/null +++ b/plot_3vars.py @@ -0,0 +1,62 @@ +""" + +E. Wes Bethel, Copyright (C) 2022 + +October 2022 + +Description: This code loads a .csv file and creates a 3-variable plot + +Inputs: the named file "sample_data_3vars.csv" + +Outputs: displays a chart with matplotlib + +Dependencies: matplotlib, pandas modules + +Assumptions: developed and tested using Python version 3.8.8 on macOS 11.6 + +""" + +import pandas as pd +import matplotlib.pyplot as plt + + +fname = "sample_data_3vars.csv" +df = pd.read_csv(fname, comment="#") +print(df) + +var_names = list(df.columns) + +print("var names =", var_names) + +# split the df into individual vars +# assumption: column order - 0=problem size, 1=blas time, 2=basic time + +problem_sizes = df[var_names[0]].values.tolist() +code1_time = df[var_names[1]].values.tolist() +code2_time = df[var_names[2]].values.tolist() +code3_time = df[var_names[3]].values.tolist() + +plt.title("Comparison of 3 Codes") + +xlocs = [i for i in range(len(problem_sizes))] + +plt.xticks(xlocs, problem_sizes) + +plt.plot(code1_time, "r-o") +plt.plot(code2_time, "b-x") +plt.plot(code3_time, "g-^") + +#plt.xscale("log") +#plt.yscale("log") + +plt.xlabel("Problem Sizes") +plt.ylabel("runtime") + +varNames = [var_names[1], var_names[2], var_names[3]] +plt.legend(varNames, loc="best") + +plt.grid(axis='both') + +plt.show() + +# EOF diff --git a/sample_data_3vars.csv b/sample_data_3vars.csv new file mode 100644 index 0000000..a6a223b --- /dev/null +++ b/sample_data_3vars.csv @@ -0,0 +1,8 @@ +# author: E. Wes Bethel, Oct 2022 +# sample data for use with the plot_3vars.py file +Problem Size,code 1,code 2,code 3 +64,0.00044,0.00128,0.00759 +128,0.00061,0.00949,0.05974 +256,0.00236,0.0875,0.20877 +512,0.01201,0.1418,0.89089 +1024,0.07743,0.81365,3.04055