[mlpack-svn] r15627 - in mlpack/conf/jenkins-conf/benchmark: benchmark util
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Aug 16 13:11:52 EDT 2013
Author: marcus
Date: Fri Aug 16 13:11:52 2013
New Revision: 15627
Log:
Added axis labels to the plots and set additional dataset information.
Modified:
mlpack/conf/jenkins-conf/benchmark/benchmark/make_reports.py
mlpack/conf/jenkins-conf/benchmark/util/graph.py
mlpack/conf/jenkins-conf/benchmark/util/misc.py
mlpack/conf/jenkins-conf/benchmark/util/template.py
Modified: mlpack/conf/jenkins-conf/benchmark/benchmark/make_reports.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/benchmark/make_reports.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/benchmark/make_reports.py Fri Aug 16 13:11:52 2013
@@ -36,7 +36,7 @@
build, results = db.GetResultsSum("mlpack")
GenerateSingleLineChart(results, "reports/img/mlpack_top_" + str(build) + ".png",
- backgroundColor="#F5F5F5")
+ backgroundColor="#F3F3F3")
return "img/mlpack_top_" + str(build) + ".png"
'''
@@ -91,6 +91,7 @@
datasetTable += "<td>" + "{0:.5f}".format(data[9]) + " MB</td>"
datasetTable += "<td>" + str(data[10]) + "</td>"
datasetTable += "<td>" + str(data[11]) + "</td>"
+ datasetTable += "<td>" + str(data[10] * data[11]) + "</td>"
datasetTable += "<td>" + str(data[12]) + "</td>"
datasetTable += "</tr>"
@@ -109,7 +110,11 @@
memoryValues = {}
memoryValues["name"] = result[7]
memoryValues["nameID"] = result[7] + str(hash(datetime.datetime.now()))
- memoryValues["content"] = Profiler.MassifMemoryUsageReport(str(result[5])).lstrip(" ")
+
+ content = Profiler.MassifMemoryUsageReport(str(result[5])).lstrip(" ")
+ if len(content) > 800:
+ content = content[1:800]
+ memoryValues["content"] = content
filename = "img/massif_" + os.path.basename(result[5]).split('.')[0] + ".png"
CreateMassifChart(result[5], "reports/" + filename)
Modified: mlpack/conf/jenkins-conf/benchmark/util/graph.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/util/graph.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/util/graph.py Fri Aug 16 13:11:52 2013
@@ -24,6 +24,7 @@
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import re
+import collections
# Use this colors to plot the graph.
@@ -53,6 +54,7 @@
# Create figure and set the color.
matplotlib.rc('axes', facecolor=backgroundColor)
+ matplotlib.rcParams.update({'font.size': 8})
fig = plt.figure(figsize=(windowWidth, windowHeight),
facecolor=backgroundColor, dpi=80)
plt.rc('lines', linewidth=lineWidth)
@@ -172,6 +174,9 @@
for label in lgd.get_texts():
label.set_color("#6e6e6e")
+ # Set axis labels.
+ plt.ylabel("time [s]", color="#6e6e6e")
+
# Save the bar chart.
fig.savefig(fileName, bbox_extra_artists=(lgd,), bbox_inches='tight',
facecolor=fig.get_facecolor(), edgecolor='none', format='png')
@@ -183,7 +188,8 @@
if data[1] == bestlib:
bestLibCount += 1
- return (len(color), totalTime, failure, timeouts, bestLibCount, timingData)
+ return (len(color), totalTime, failure, timeouts, bestLibCount,
+ collections.OrderedDict(sorted(timingData.items())))
'''
Generate a line chart with the specified informations.
@@ -193,53 +199,58 @@
@param backgroundColor - The color of the image background.
'''
def GenerateSingleLineChart(data, fileName, backgroundColor="#FFFFFF"):
- # Line chart settings.
- lineWidth = 1.5
- opacity = 0.9
- windowWidth = 10.6
- windowHeight = 1.5
- gridLineWidth = 0.2
-
- # Create figure and set the color.
- matplotlib.rc('axes', facecolor=backgroundColor)
- fig = plt.figure(figsize=(windowWidth, windowHeight),
- facecolor=backgroundColor, dpi=80)
- plt.rc('lines', linewidth=lineWidth)
- ax = plt.subplot(1,1,1)
-
- # Set the grid style.
- ax.yaxis.grid(True, linestyle='-', linewidth=gridLineWidth)
- ax.xaxis.grid(False)
- ax.spines['left'].set_visible(False)
- ax.spines['top'].set_visible(False)
- ax.spines['right'].set_visible(False)
- ax.get_xaxis().tick_bottom()
- ax.get_yaxis().tick_left()
- ax.spines['bottom'].set_linewidth(gridLineWidth)
-
- # Set ticks for the x-axis.
- myLocator = mticker.MultipleLocator(1)
- ax.xaxis.set_major_locator(myLocator)
-
- # If we have only have a single value we don't want to start from zero so we
- # double the data.
- if len(data) == 1:
- data += data
-
- # Create the data for the x-axis.
- X = np.arange(len(data))
-
- # Plot the line chart.
- plt.plot(X, data, color=colors[0], alpha=opacity)
-
- # Set the color and the font of the x-axis and y-axis labels.
- ax.tick_params(axis='both', which='major', labelsize=8, labelcolor="#6e6e6e")
- ax.tick_params(axis='both', which='minor', labelsize=6, labelcolor="#6e6e6e")
-
- # Save the line chart.
- fig.savefig(fileName, bbox_inches='tight', facecolor=fig.get_facecolor(),
- edgecolor='none')
- plt.close()
+ if not CheckFileAvailable(fileName):
+ # Line chart settings.
+ lineWidth = 1.5
+ opacity = 0.9
+ windowWidth = 10.6
+ windowHeight = 1.5
+ gridLineWidth = 0.2
+
+ # Create figure and set the color.
+ matplotlib.rc('axes', facecolor=backgroundColor)
+ matplotlib.rcParams.update({'font.size': 8})
+ fig = plt.figure(figsize=(windowWidth, windowHeight),
+ facecolor=backgroundColor, dpi=80)
+ plt.rc('lines', linewidth=lineWidth)
+ ax = plt.subplot(1,1,1)
+
+ # Set the grid style.
+ ax.yaxis.grid(True, linestyle='-', linewidth=gridLineWidth)
+ ax.xaxis.grid(False)
+ ax.spines['left'].set_visible(False)
+ ax.spines['top'].set_visible(False)
+ ax.spines['right'].set_visible(False)
+ ax.get_xaxis().tick_bottom()
+ ax.get_yaxis().tick_left()
+ ax.spines['bottom'].set_linewidth(gridLineWidth)
+
+ # Set ticks for the x-axis.
+ myLocator = mticker.MultipleLocator(1)
+ ax.xaxis.set_major_locator(myLocator)
+
+ # If we have only have a single value we don't want to start from zero so we
+ # double the data.
+ if len(data) == 1:
+ data += data
+
+ # Create the data for the x-axis.
+ X = np.arange(len(data))
+
+ # Plot the line chart.
+ plt.plot(X, data, color=colors[0], alpha=opacity, linewidth=1.7)
+
+ # Set the color and the font of the x-axis and y-axis labels.
+ ax.tick_params(axis='both', which='major', labelsize=8, labelcolor="#6e6e6e")
+ ax.tick_params(axis='both', which='minor', labelsize=6, labelcolor="#6e6e6e")
+
+ # Set axis labels.
+ plt.ylabel("time [s]", color="#6e6e6e")
+
+ # Save the line chart.
+ fig.savefig(fileName, bbox_inches='tight', facecolor=fig.get_facecolor(),
+ edgecolor='none')
+ plt.close()
'''
Generate a memory chart with the specified informations.
@@ -249,66 +260,68 @@
@param backgroundColor - The color of the image background.
'''
def CreateMassifChart(massiflogFile, fileName, backgroundColor="#FFFFFF"):
- lineWidth = 1.5
- opacity = 0.9
- windowWidth = 10.2
- windowHeight = 1.5
- gridLineWidth = 0.2
-
- # Create figure and set the color.
- matplotlib.rc('axes', facecolor=backgroundColor)
- matplotlib.rcParams.update({'font.size': 8})
- fig = plt.figure(figsize=(windowWidth, windowHeight),
- facecolor=backgroundColor, dpi=80)
- plt.rc('lines', linewidth=lineWidth)
- ax = plt.subplot(1,1,1)
-
- # Set the grid style.
- ax.yaxis.grid(True, linestyle='-', linewidth=gridLineWidth)
- ax.xaxis.grid(False)
- ax.spines['left'].set_visible(False)
- ax.spines['top'].set_visible(False)
- ax.spines['right'].set_visible(False)
- ax.get_xaxis().tick_bottom()
- ax.get_yaxis().tick_left()
- ax.spines['bottom'].set_linewidth(gridLineWidth)
-
- # Read the massif logfile.
- with open(massiflogFile, "r") as fid:
- content = fid.read()
-
- # Parse the massif logfile.
- memHeapB = [int(i) for i in re.findall(r"mem_heap_B=(\d*)", content)]
- memHeapExtraB = [int(i) for i in re.findall(r"mem_heap_extra_B=(\d*)", content)]
- memStackB = [int(i) for i in re.findall(r"mem_stacks_B=(\d*)", content)]
-
- # Plot the memory information.
- X = np.arange(len(memHeapExtraB))
- # plt.fill_between(X, memHeapB, 0, color='g', alpha=0.6)
- # plt.fill_between(X, memHeapB, memHeapExtraB, color='y', alpha=0.6)
- # plt.fill_between(X, memHeapB, memStackB, color='r', alpha=0.6)
- plt.fill_between(X, memHeapExtraB, 0, color="#109618", alpha=0.6)
- plt.fill_between(X, memHeapExtraB, memHeapB, color="#DC3912", alpha=0.6)
- plt.fill_between(X, memHeapExtraB, memStackB, color="#3366CC", alpha=0.6)
-
- # Set the color and the font of the x-axis and y-axis labels.
- ax.tick_params(axis='both', which='major', labelsize=8, labelcolor="#6e6e6e")
- ax.tick_params(axis='both', which='minor', labelsize=6, labelcolor="#6e6e6e")
-
- # Create a proxy artist, because fill_between hasn't a chart handler.
- p1 = plt.Rectangle((0, 0), 1, 1, fc="#109618", alpha=0.6)
- p2 = plt.Rectangle((0, 0), 1, 1, fc="#DC3912", alpha=0.6)
- p3 = plt.Rectangle((0, 0), 1, 1, fc="#3366CC", alpha=0.6)
-
- # Create the legend above the memory chart.
- lgd = ax.legend((p1, p2, p3),
- ("mem heap B", "mem heap extra B", "mem stacks B"), loc='upper center',
- bbox_to_anchor=(0.5, 1.3), fancybox=True, shadow=False, ncol=8, fontsize=8)
- lgd.get_frame().set_linewidth(0)
- for label in lgd.get_texts():
- label.set_color("#6e6e6e")
-
- # Save the memory chart.
- fig.savefig(fileName, bbox_extra_artists=(lgd,), bbox_inches='tight',
- facecolor=fig.get_facecolor(), edgecolor='none', format='png')
- plt.close()
+ if not CheckFileAvailable(fileName):
+ lineWidth = 1.5
+ opacity = 0.9
+ windowWidth = 10.2
+ windowHeight = 1.5
+ gridLineWidth = 0.2
+
+ # Create figure and set the color.
+ matplotlib.rc('axes', facecolor=backgroundColor)
+ matplotlib.rcParams.update({'font.size': 8})
+ fig = plt.figure(figsize=(windowWidth, windowHeight),
+ facecolor=backgroundColor, dpi=80)
+ plt.rc('lines', linewidth=lineWidth)
+ ax = plt.subplot(1,1,1)
+
+ # Set the grid style.
+ ax.yaxis.grid(True, linestyle='-', linewidth=gridLineWidth)
+ ax.xaxis.grid(False)
+ ax.spines['left'].set_visible(False)
+ ax.spines['top'].set_visible(False)
+ ax.spines['right'].set_visible(False)
+ ax.get_xaxis().tick_bottom()
+ ax.get_yaxis().tick_left()
+ ax.spines['bottom'].set_linewidth(gridLineWidth)
+
+ # Read the massif logfile.
+ with open(massiflogFile, "r") as fid:
+ content = fid.read()
+
+ # Parse the massif logfile.
+ memHeapB = [(int(i) / 1024) + 0.0001 for i in re.findall(r"mem_heap_B=(\d*)", content)]
+ memHeapExtraB = [(int(i) / 1024) + 0.0001 for i in re.findall(r"mem_heap_extra_B=(\d*)", content)]
+ memStackB = [(int(i) / 1024) + 0.0001 for i in re.findall(r"mem_stacks_B=(\d*)", content)]
+
+ # Plot the memory information.
+ X = np.arange(len(memHeapExtraB))
+ X = [x+0.0001 for x in X]
+ plt.fill_between(X, memHeapExtraB, 0, color="#109618", alpha=0.6)
+ plt.fill_between(X, memHeapExtraB, memHeapB, color="#DC3912", alpha=0.6)
+ plt.fill_between(X, memHeapExtraB, memStackB, color="#3366CC", alpha=0.6)
+
+ # Set the color and the font of the x-axis and y-axis labels.
+ ax.tick_params(axis='both', which='major', labelsize=8, labelcolor="#6e6e6e")
+ ax.tick_params(axis='both', which='minor', labelsize=6, labelcolor="#6e6e6e")
+
+ # Create a proxy artist, because fill_between hasn't a chart handler.
+ p1 = plt.Rectangle((0, 0), 1, 1, fc="#109618", alpha=0.6)
+ p2 = plt.Rectangle((0, 0), 1, 1, fc="#DC3912", alpha=0.6)
+ p3 = plt.Rectangle((0, 0), 1, 1, fc="#3366CC", alpha=0.6)
+
+ # Set axis labels.
+ plt.ylabel("memory [KB]", color="#6e6e6e")
+
+ # Create the legend above the memory chart.
+ lgd = ax.legend((p1, p2, p3),
+ ("mem heap B", "mem heap extra B", "mem stacks B"), loc='upper center',
+ bbox_to_anchor=(0.5, 1.3), fancybox=True, shadow=False, ncol=8, fontsize=8)
+ lgd.get_frame().set_linewidth(0)
+ for label in lgd.get_texts():
+ label.set_color("#6e6e6e")
+
+ # Save the memory chart.
+ fig.savefig(fileName, bbox_extra_artists=(lgd,), bbox_inches='tight',
+ facecolor=fig.get_facecolor(), edgecolor='none', format='png')
+ plt.close()
Modified: mlpack/conf/jenkins-conf/benchmark/util/misc.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/util/misc.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/util/misc.py Fri Aug 16 13:11:52 2013
@@ -125,6 +125,15 @@
os.remove(f)
'''
+Check if the given file is available.
+
+ at param fileName - The name of the file.
+ at return True if the file is available otherwise False.
+'''
+def CheckFileAvailable(fileName):
+ return True if os.path.isfile(fileName) else False
+
+'''
Check if the file is available in one of the given formats.
@param dataset - Datsets which should be checked.
Modified: mlpack/conf/jenkins-conf/benchmark/util/template.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/util/template.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/util/template.py Fri Aug 16 13:11:52 2013
@@ -116,6 +116,7 @@
<th>Size</th>
<th>Number of Instances</th>
<th>Number of Attributes</th>
+ <th>Instances</th>
<th>Attribute Types</th>
</tr>
</thead>
More information about the mlpack-svn
mailing list