61 lines
1.5 KiB
Python
61 lines
1.5 KiB
Python
"""
|
|
|
|
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
|
|
|
|
# Read the CSV file
|
|
fname = "benchmark_data.csv"
|
|
df = pd.read_csv(fname, comment="#")
|
|
|
|
# Extract columns
|
|
problem_sizes = df['Problem Size'].values.tolist()
|
|
mflops = df['MFLOP/s'].values.tolist()
|
|
memory_bandwidth = df['Memory Bandwidth Utilization (%)'].values.tolist()
|
|
memory_latency = df['Memory Latency'].values.tolist()
|
|
|
|
# Plot MFLOP/s
|
|
plt.figure()
|
|
plt.plot(problem_sizes, mflops, label='MFLOP/s')
|
|
plt.title('Problem Size vs. MFLOP/s')
|
|
plt.xlabel('Problem Size')
|
|
plt.ylabel('MFLOP/s')
|
|
plt.legend()
|
|
plt.savefig('mflops_plot.png')
|
|
|
|
# Plot Memory Bandwidth Utilization
|
|
plt.figure()
|
|
plt.plot(problem_sizes, memory_bandwidth, label='Memory Bandwidth Utilization (%)')
|
|
plt.title('Problem Size vs. Memory Bandwidth Utilization')
|
|
plt.xlabel('Problem Size')
|
|
plt.ylabel('Memory Bandwidth Utilization (%)')
|
|
plt.legend()
|
|
plt.savefig('memory_bandwidth_plot.png')
|
|
|
|
# Plot Memory Latency
|
|
plt.figure()
|
|
plt.plot(problem_sizes, memory_latency, label='Memory Latency')
|
|
plt.title('Problem Size vs. Memory Latency')
|
|
plt.xlabel('Problem Size')
|
|
plt.ylabel('Memory Latency')
|
|
plt.legend()
|
|
plt.savefig('memory_latency_plot.png')
|
|
|
|
plt.show()
|
|
|
|
# EOF |