[Assorted-commits] SF.net SVN: assorted: [417] numa-bench/trunk
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-02-15 01:43:47
|
Revision: 417 http://assorted.svn.sourceforge.net/assorted/?rev=417&view=rev Author: yangzhang Date: 2008-02-14 17:43:52 -0800 (Thu, 14 Feb 2008) Log Message: ----------- never added tools! Added Paths: ----------- numa-bench/trunk/tools/ numa-bench/trunk/tools/Makefile numa-bench/trunk/tools/PlotHist.scala numa-bench/trunk/tools/plot-hist.bash Added: numa-bench/trunk/tools/Makefile =================================================================== --- numa-bench/trunk/tools/Makefile (rev 0) +++ numa-bench/trunk/tools/Makefile 2008-02-15 01:43:52 UTC (rev 417) @@ -0,0 +1,12 @@ +COMMONS := $(wildcard commons/*.scala) + +all: out/PlotHist.class + +out/PlotHist.class: PlotHist.scala $(COMMONS) + mkdir -p out + fsc -d out $^ + +clean: + rm -rf out + +.PHONY: clean Added: numa-bench/trunk/tools/PlotHist.scala =================================================================== --- numa-bench/trunk/tools/PlotHist.scala (rev 0) +++ numa-bench/trunk/tools/PlotHist.scala 2008-02-15 01:43:52 UTC (rev 417) @@ -0,0 +1,90 @@ +import commons.Collections._ +import commons.Control._ +import commons.Io._ +import scala.util._ +object PlotHist { + def main(args: Array[String]) { + // The input consists of header lines describing the experiment + // configuration followed by body lines reporting the time measurements. + // Construct a map from configuration to bodies that were run under that + // config. + val lines = using (TextReader(Console.in)) (_.readLines.toArray) + val runs = separateHeads(groupByHeaders(lines)(_ startsWith "config: ")) + val exps = multimap( + for ((config, lines) <- runs) yield { + val pairs = + for (line <- lines) yield { + val Seq(a,b) = line split ": " + (a.toInt, b.toInt) + } + (config.split(": ")(1), pairs) + } + ) + // For each config, aggregate the bodies together by finding the average of + // all the measurements corresponding to the same core. + val graphs = for ((config, vs) <- exps) yield { + val vmap = multimap(vs flatMap (x=>x)) + val agg = for ((x,ys) <- vmap) yield (x,mean(ys.toArray)) + val arr = agg.toStream.toArray + Sorting quickSort arr + (config, arr) + } + // Also generate the scaling view of the data by grouping together by the + // first numeric parameter (in this case, the number of cores). + val scaling = multimap( + for ((config, points) <- graphs) yield { + val Seq(_, ncores, rest) = config split (" ", 3) + (rest, (ncores.toInt, Iterable.max(points map (_._2)))) + } + ) + val scalingGraphs = for ((k,vs) <- scaling; if vs.size > 1) yield { + val arr = vs.toStream.toArray + Sorting quickSort arr + (k, arr) + } + // Prepare the plotting. + val cmd = <p> + set style data histogram + # set style histogram clustered + set terminal pdf + set xlabel 'core' + set ylabel 'time (ms)' + set key off + { + // Generate the histograms. + for ((config, points) <- graphs) yield { + <p> + set title '{config}' + set output 'graphs/{spacedToHyphen(config)}.pdf' + plot '-' using 2:xticlabel(1) + {points map {case (a,b) => (a + " " + b)} mkString "\n"} + e + </p>.text + } + } + set style data linespoints + { + // Generate the time and speedup plots varying ncores. + for ((config, points) <- scalingGraphs) yield { + <p> + set title '{config}' + + set output 'graphs/{"scaling-" + spacedToHyphen(config)}.pdf' + plot '-' + {points map {case (a,b) => (a + " " + b)} mkString "\n"} + e + + set output 'graphs/{"speedup-" + spacedToHyphen(config)}.pdf' + plot '-' + { + val (_, base) = points(0) + points map {case (a,b) => (a + " " + (base.toDouble/b)) + } mkString "\n"} + e + </p>.text + } + } + </p>.text + run("gnuplot", cmd) + } +} Added: numa-bench/trunk/tools/plot-hist.bash =================================================================== --- numa-bench/trunk/tools/plot-hist.bash (rev 0) +++ numa-bench/trunk/tools/plot-hist.bash 2008-02-15 01:43:52 UTC (rev 417) @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -o errexit -o nounset +make -s +egrep '^[[:digit:]]+: [[:digit:]]+|config' "$@" | scala -cp out PlotHist Property changes on: numa-bench/trunk/tools/plot-hist.bash ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |