From f4041f41ecdcbbab754e4d930b46bc7d0d328845 Mon Sep 17 00:00:00 2001 From: David Kaufmann Date: Wed, 25 Jan 2012 08:38:38 +0100 Subject: [PATCH] graphing --- openmp/prefix/parseDat.py | 43 +++++++++++++++++++++++++++++++++++++++ openmp/prefix/prefix.plt | 19 +++++++++++++++++ openmp/prefix/runAll.sh | 11 ++++++---- 3 files changed, 69 insertions(+), 4 deletions(-) create mode 100755 openmp/prefix/parseDat.py create mode 100644 openmp/prefix/prefix.plt diff --git a/openmp/prefix/parseDat.py b/openmp/prefix/parseDat.py new file mode 100755 index 0000000..7d0d7b1 --- /dev/null +++ b/openmp/prefix/parseDat.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python2 + +from optparse import OptionParser + +parser = OptionParser() +parser.add_option("-i", "--infile", dest="infilename", help="read unparsed data from FILE", metavar="FILE", default="prefix.pre.dat") +parser.add_option("-o", "--outfile", dest="outfilename", help="write parsed data to FILE.alg.dat", metavar="FILE", default="prefix") + +(options, args) = parser.parse_args() + +in_file = open(options.infilename, "r") + +algos = { + 'datapar': [], + 'hillis': [], + 'seq': [], + 'recurse': [] + } + +text = in_file.read() +lines = text.split("\n") +for line in lines: + if line == "": + continue + elements = line.split(" ") + for elem in elements: + (key, value) = elem.split("=", 1) + if key == 'binname': + (_, prog) = value.split("/", 1) + elif key == 'size': + size = value + elif key == 'time': + time = value + algos[prog].append({'size': size, 'time': time}) + +in_file.close() + +for key in algos: + out_file = open(options.outfilename+"."+key+".dat", "w") + for res in algos[key]: + out_file.write(res['size']+";"+res['time']+"\n") + out_file.close() + diff --git a/openmp/prefix/prefix.plt b/openmp/prefix/prefix.plt new file mode 100644 index 0000000..67f2c00 --- /dev/null +++ b/openmp/prefix/prefix.plt @@ -0,0 +1,19 @@ +set terminal png font arial 8 size #600,300 +set output 'prefix.png' +set grid +set title "Time required for each algorithm" +set xlabel "Size of array" +set ylabel "Time needed for calculation" +#set xrange [ 100000 : 100000000 ] +#set yrange [ 0.0000 : 0.75 ] +#set xtics 0,25,200 +#set ytics 0,0.1,0.75 +set datafile separator ";" +plot 'prefix.datapar.dat' using 1:2 notitle with points, \ + 'prefix.datapar.dat' using 1:2 title "datapar" with lines, \ + 'prefix.hillis.dat' using 1:2 notitle with points, \ + 'prefix.hillis.dat' using 1:2 title "hillis" with lines, \ + 'prefix.seq.dat' using 1:2 notitle with points, \ + 'prefix.seq.dat' using 1:2 title "seq" with lines, \ + 'prefix.recurse.dat' using 1:2 notitle with points, \ + 'prefix.recurse.dat' using 1:2 title "recurse" with lines diff --git a/openmp/prefix/runAll.sh b/openmp/prefix/runAll.sh index 40f5015..2d504db 100755 --- a/openmp/prefix/runAll.sh +++ b/openmp/prefix/runAll.sh @@ -1,12 +1,13 @@ #!/bin/bash -touch numlist.bin -dd if=/dev/urandom of=numlist.bin bs=1 count=100000 +if [ ! -f numlist.bin ]; then + dd if=/dev/urandom of=numlist.bin bs=1000 count=100000 +fi ALGORITHMS="seq datapar recurse hillis" -RUNLIST="10 100000" +RUNLIST="$(seq 100000 100000 1000000) $(seq 1000000 1000000 10000000) $(seq 10000000 10000000 100000000)" -rm -f prefix.pre.dat +rm -f prefix.pre.dat prefix.seq.dat prefix.recurse.dat prefix.datapar.dat prefix.hillis.dat touch prefix.pre.dat ulimit -s unlimited @@ -17,5 +18,7 @@ for prog in $ALGORITHMS; do done done +./parseDat.py + echo "done - hit ENTER to exit" read -- 2.43.0