2016-06-23 00:40:48 +00:00
|
|
|
import pandas as pd
|
|
|
|
import numpy as np
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
import matplotlib
|
|
|
|
from matplotlib.ticker import ScalarFormatter, FormatStrFormatter
|
|
|
|
|
|
|
|
|
|
|
|
matplotlib.style.use('ggplot')
|
|
|
|
|
|
|
|
# Roofline Plot
|
|
|
|
|
|
|
|
#log x
|
|
|
|
i = 32
|
|
|
|
xlbl = []
|
|
|
|
while i > 1:
|
|
|
|
xlbl.append("1/"+repr(i))
|
|
|
|
i //= 2
|
|
|
|
xlbl.append(repr(i)) #1
|
|
|
|
i += 1
|
|
|
|
while i<=64:
|
|
|
|
xlbl.append(repr(i))
|
|
|
|
i *= 2
|
|
|
|
|
|
|
|
# memory
|
|
|
|
values = []
|
|
|
|
bandwidth = 10.6
|
|
|
|
peak = 86.4
|
2016-06-23 21:29:47 +00:00
|
|
|
basepeak = 54.4
|
2016-06-23 00:40:48 +00:00
|
|
|
ymem = []
|
|
|
|
ypeak = []
|
2016-06-23 21:29:47 +00:00
|
|
|
ybasepeak = []
|
2016-06-23 00:40:48 +00:00
|
|
|
|
|
|
|
for i in np.arange(0,64,0.1):
|
|
|
|
if bandwidth*i < peak:
|
|
|
|
values.append(bandwidth*i)
|
|
|
|
else:
|
|
|
|
values.append(peak)
|
|
|
|
|
|
|
|
i=1/32
|
|
|
|
while i<=64:
|
|
|
|
if bandwidth*i < peak and bandwidth*i*2 < peak:
|
|
|
|
ymem.append(bandwidth*i)
|
|
|
|
ypeak.append(None)
|
|
|
|
elif bandwidth*i < peak and bandwidth*i*2 > peak:
|
|
|
|
ypeak.append(peak)
|
|
|
|
ymem.append(bandwidth*i)
|
|
|
|
else:
|
|
|
|
ypeak.append(peak)
|
|
|
|
ymem.append(None)
|
|
|
|
i*=2
|
|
|
|
|
2016-06-23 21:29:47 +00:00
|
|
|
|
|
|
|
|
2016-06-23 00:40:48 +00:00
|
|
|
#plot data
|
|
|
|
#data = pd.Series(data=values, name='Peak Memory Bandwidth', index=np.arange(0,64,0.1))
|
|
|
|
|
2016-06-23 21:29:47 +00:00
|
|
|
data = {'Peak Memory Bandwidth': pd.Series(ymem, index=xlbl), 'Peak Floating-Point Performance (Turbo)': pd.Series(ypeak, index=xlbl)}
|
2016-06-23 00:40:48 +00:00
|
|
|
df = pd.DataFrame(data)
|
|
|
|
|
|
|
|
ax = df.plot()
|
|
|
|
ax.set_xlabel("Operational Itensity (FLOP/Byte)")
|
|
|
|
ax.set_ylabel("Attainable GFLOP/s")
|
|
|
|
ax.set_yscale('log', basey=2)
|
|
|
|
ax.yaxis.set_major_formatter(FormatStrFormatter('%.0f'))
|
|
|
|
|
|
|
|
print(repr(data))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plt.show()
|