Updated python script
This commit is contained in:
parent
324ace2671
commit
91f8def5ea
@ -19,15 +19,28 @@ Assumptions: developed and tested using Python version 3.8.8 on macOS 11.6
|
||||
import pandas as pd
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
# Constants for calculations
|
||||
OPS = 1e6 # 1 million operations
|
||||
BYTES_ACCESSED = 1e9 # Example: 1 GB accessed
|
||||
PEAK_MEMORY_BANDWIDTH = 100 # Example: 100 GB/s
|
||||
MEMORY_ACCESSES = 1e6 # Example: 1 million memory accesses
|
||||
|
||||
# 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()
|
||||
elapsed_times = df['Elapsed Time'].values.tolist()
|
||||
|
||||
# Calculate MFLOP/s
|
||||
mflops = [OPS / time for time in elapsed_times]
|
||||
|
||||
# Calculate Memory Bandwidth Utilization (%)
|
||||
memory_bandwidth = [(BYTES_ACCESSED / time) / PEAK_MEMORY_BANDWIDTH * 100 for time in elapsed_times]
|
||||
|
||||
# Calculate Memory Latency
|
||||
memory_latency = [time / MEMORY_ACCESSES for time in elapsed_times]
|
||||
|
||||
# Plot MFLOP/s
|
||||
plt.figure()
|
||||
@ -56,6 +69,4 @@ plt.ylabel('Memory Latency')
|
||||
plt.legend()
|
||||
plt.savefig('memory_latency_plot.png')
|
||||
|
||||
plt.show()
|
||||
|
||||
# EOF
|
||||
plt.show()
|
||||
Loading…
Reference in New Issue
Block a user