Skip to content
Snippets Groups Projects
Commit ce57dbc4 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Better to actually commit the file....

parent 80d1e8b6
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import matplotlib
matplotlib.use("Agg")
from pylab import *
from scipy import integrate
import distinct_colours as colours
params = {
# 'axes.labelsize': 10,
# 'axes.titlesize': 10,
# 'text.fontsize': 12,
# 'legend.fontsize': 12,
# 'xtick.labelsize': 10,
# 'ytick.labelsize': 10,
'axes.labelsize': 9,
'axes.titlesize': 9,
'text.fontsize': 11,
'legend.fontsize': 11,
'xtick.labelsize': 9,
'ytick.labelsize': 9,
'text.usetex': True,
'figure.figsize' : (7.2, 3.15),
'figure.subplot.left' : 0.04,
'figure.subplot.right' : 0.99 ,
'figure.subplot.bottom' : 0.1 ,
'figure.subplot.top' : 0.99 ,
'figure.subplot.wspace' : 0. ,
'figure.subplot.hspace' : 0.02 ,
'lines.markersize' : 6,
'lines.linewidth' : 3.,
'text.latex.unicode': True
}
rcParams.update(params)
rc('font',**{'family':'sans-serif','sans-serif':['Times']})
import sys
import os
from scipy import stats
from scipy import optimize
from matplotlib.colors import colorConverter
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
from matplotlib.patches import Polygon
from matplotlib.patches import Rectangle
from matplotlib import gridspec
CPU_TPS = 2.67e9 / 1000
if sys.argv[1] == "bh":
data = loadtxt("output_bh_new.out")
elif sys.argv[1] == "fmm":
data = loadtxt("output_fmm.out")
t_type = data[:,0]
t_thread = data[:,1]
t_begin = data[:,2] / CPU_TPS
t_end = data[:,3] / CPU_TPS
# Correct for empty type...
t_type[t_type==4] = 5
t_type[t_type==3] = 4
# Recover some information
n_task = np.max(t_type)
n_threads = np.max(t_thread)
print n_task, "tasks using", n_threads, "threads."
# Standardize the time
startTime = np.min(t_begin)
t_begin -= startTime
t_end -= startTime
startTime = np.min(t_begin)
endTime = np.max(t_end)
print "t = [", startTime, "-", endTime, "] ms."
# Prepare for plots
colours = colours.get_distinct(12)
colors = [ colours[1], colours[3], colours[6], colours[8], colours[11], colours[2]]
labels = ["self", "pair", "m-poles", "direct", "CoM", "Downpass"]
count = np.zeros(6)
for j in range(6):
count[j] = np.size(t_type[t_type == j])
figure()
gs = gridspec.GridSpec(2, 1, height_ratios=[1, 6])
# Plot the legend ........................
subplot(gs[0])
xlim(0,6)
ylim(0,1)
for i in range(6):
gca().add_patch(Rectangle( (0.1 + i, 0.1), 0.8, 0.8, facecolor=colors[i], edgecolor='k', lw=0.2))
text( 0.5 + i, 0.5, "${\\rm %s~(%d)}$"%(labels[i],count[i]), ha='center', va='center', fontsize=8)
gca().axison = False
# Now the actual plot ...................
subplot(gs[1])
for i in range(np.size(t_type)):
#for i in range(100):
gca().add_patch(Rectangle(( t_begin[i], t_thread[i] + 0.05 ), t_end[i] - t_begin[i], 0.9, facecolor=colors[int(t_type[i])], edgecolor='k', lw=0.2))
# Remove axis
gca().spines['top'].set_visible(False)
gca().spines['right'].set_visible(False)
gca().get_xaxis().tick_bottom()
gca().get_yaxis().tick_left()
# Plot limits
ylim(0, n_threads + 1)
yticks( np.array(range(int(n_threads)+1))+0.5, np.array(range(int(n_threads)+1)) )
ylabel("${\\rm Thread~ID}$", labelpad=0.1)
xlim(0, endTime*1.02)
xlabel("${\\rm Wallclock~time~[ms]}$", labelpad=0.1)
if sys.argv[1] == "bh":
savefig("taskGraph_bh.png", dpi=600)
elif sys.argv[1] == "fmm":
savefig("taskGraph_fmm.png", dpi=600)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment