Benchmarking Efficiency Graphs

Taking benchmarking data per-core and producing efficiency graphs.

by Chris Want

HTML

<head>
  <!-- Plotly.js -->
  <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>

<body>
  <h2>
    Timing
  </h2>
  <div id="timing"></div>
  <h2>
    Speedup
  </h2>
  <div id="speedup"></div>

  <h2>
    Efficiency
  </h2>
  <div id="efficiency"></div>
</body>

JavaScript

// MODIFY WITH YOUR OWN TIMINGS AND PRESS RUN ABOVE

timings_per_num_processors = {
  // number of processors: time to run
  1: 2.335,
  2: 1.524,
  4: 1.192,
  8: 1.032,
  16: 1.048
};

// DON"T TOUCH BELOW

num_procs = Object.keys(timings_per_num_processors).map(Number);

var timing = num_procs.map(function(num_proc) {
  return timings_per_num_processors[num_proc];
});

var speedup = num_procs.map(function(num_proc) {
  return timings_per_num_processors[1] / timings_per_num_processors[num_proc];
});

var linear_speedup = num_procs.map(function(num_proc) {
  return num_proc;
});

var efficiency = num_procs.map(function(num_proc) {
  return timings_per_num_processors[1] / (num_proc * timings_per_num_processors[num_proc]);
});


function make_data(values, name) {
  return {
    x: num_procs, 
    y: values,
    name: name,
    type: 'scatter'
  };
}

var layout = {
  yaxis: { rangemode: 'tozero',
           showline: true,
           zeroline: true },
  xaxis: { title: 'Cores' }
};


Plotly.newPlot('timing', [make_data(timing, 'My compute times')], layout);
Plotly.newPlot('speedup', [make_data(speedup, 'My speedup'),
	                         make_data(linear_speedup, 'Linear speedup')], layout);
Plotly.newPlot('efficiency', [make_data(efficiency, 'My efficiency')], layout);