harness: distops_bench: make matplotlib dependency optional
@@ -3,7 +3,12 @@ from common import TestCommon
from results import PassFailResult, RowResults
import sys, re, numpy, os, datetime
+has_mpl = True
+try:
import matplotlib.pyplot as plt
+except:
+ has_mpl = False
+
OPERATIONHEADER = re.compile("^# Benchmarking ([A-Z 0-9]+): nodes=(\d+).*$")
DATAHEADER = re.compile("^# node (\d+): tsc_per_us = (\d+); numcopies = (\d+).*")
@@ -54,6 +59,7 @@ class DistopsPlot(object):
return passed
def _finalize_plot(self, outfile, xlabel, ylabel, ylim, fix_xticks=False, draw_legend=False):
+ if has_mpl:
plt.xlabel(xlabel if xlabel is not None else '#capabilities on node (over base set of capabilities)')
plt.ylabel(ylabel if ylabel is not None else r'latency in $\mu s$')
if draw_legend:
@@ -71,6 +77,7 @@ class DistopsPlot(object):
plt.savefig('%s.pdf' % outfile, format='pdf')
def boxplot(self, outfile, all_nodes=False, xlabel=None, ylabel=None, ylim=None):
+ if has_mpl:
# count #nodes with data
nodecount = len(self.tscperus.keys())
assert(nodecount >= 1)
@@ -96,6 +103,7 @@ class DistopsPlot(object):
def plot(self, outfile, xlabel=None, ylabel=None, ylim=None):
+ if has_mpl:
sym = [ '', 'x', 'o', '*' ]
fig = plt.figure()
nodedata = self.nodedata
