Skip to content

Commit

Permalink
Make .pdf grahps.
Browse files Browse the repository at this point in the history
The graph stuff should probably be moved to the report repo.
  • Loading branch information
Martin Hafskjold Thoresen committed Nov 28, 2017
1 parent 0abe7d4 commit 6ef49af
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 32 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ time = "*"
debug = true

[[bin]]
name = "queue-ebr"
path = "benches/queue-ebr.rs"
name = "queue-transport-ebr"
path = "benches/queue-transport-ebr.rs"

[[bin]]
name = "queue-crossbeam"
path = "benches/queue-crossbeam.rs"
name = "queue-transport-crossbeam"
path = "benches/queue-transport-crossbeam.rs"

[[bin]]
name = "queue-hp"
path = "benches/queue-hp.rs"
name = "queue-transport-hp"
path = "benches/queue-transport-hp.rs"

[[bench]]
name = "queue"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use std::env;

use crossbeam::sync::MsQueue;

const BENCH_NAME: &str = "queue-transport";

fn main() {
let num_threads: usize = env::args().nth(1)
.unwrap_or("4".to_string())
Expand Down Expand Up @@ -118,6 +120,6 @@ fn main() {
state.barrier.wait();
});

let mut f = ::std::fs::File::create(&format!("crossbeam-{}", num_threads)).unwrap();
let mut f = ::std::fs::File::create(&format!("{}-crossbeam-{}", BENCH_NAME, num_threads)).unwrap();
let _ = b.output_samples(&mut f);
}
4 changes: 3 additions & 1 deletion benches/queue-ebr.rs → benches/queue-transfer-ebr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use std::env;
use comere::ebr::pin;
use comere::ebr::queue::Queue;

const BENCH_NAME: &str = "queue-transport";

fn main() {
let num_threads: usize = env::args().nth(1)
.unwrap_or("4".to_string())
Expand Down Expand Up @@ -121,6 +123,6 @@ fn main() {
state.barrier.wait();
});

let mut f = ::std::fs::File::create(&format!("ebr-{}", num_threads)).unwrap();
let mut f = ::std::fs::File::create(&format!("{}-ebr-{}", BENCH_NAME, num_threads)).unwrap();
let _ = b.output_samples(&mut f);
}
4 changes: 3 additions & 1 deletion benches/queue-hp.rs → benches/queue-transfer-hp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use std::env;

use comere::hp::queue::Queue;

const BENCH_NAME: &str = "queue-transport";

fn main() {
let num_threads: usize = env::args()
.nth(1)
Expand Down Expand Up @@ -119,6 +121,6 @@ fn main() {
state.barrier.wait();
});

let mut f = ::std::fs::File::create(&format!("hp-{}", num_threads)).unwrap();
let mut f = ::std::fs::File::create(&format!("{}-hp-{}", BENCH_NAME, num_threads)).unwrap();
let _ = b.output_samples(&mut f);
}
18 changes: 12 additions & 6 deletions plots/generate-plots.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#!/bin/bash

THREADS="1 2 4 8"
EXECS="queue-crossbeam queue-ebr queue-hp"
BENCHES="queue-transport"
VARIANTS="crossbeam ebr hp"

for e in $(echo "$EXECS"); do
for n in $(echo "$THREADS"); do
printf "Run %s with %s threads\n" "$n" "$e"
cargo run --release --bin "$e" -- "$n"
for variant in $(echo "$VARIANTS"); do
for bench in $(echo "$BENCHES"); do
files=""
for n in $(echo "$THREADS"); do
cargo run --release --bin "$bench-$variant" -- "$n"
files+="$bench-$variant-$n "
done
paste -d" " $files > "$bench-$variant"
rm $files
done
done

gnuplot -persist gnuplot
# gnuplot -persist gnuplot
40 changes: 23 additions & 17 deletions plots/gnuplot
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
#!/bin/gnuplot

set ytic auto
set xtic auto

plot 'ebr-1' smooth bezier title "EBR, 1" lc rgb "#ffaaaa",\
'ebr-2' smooth bezier title "EBR, 2" lc rgb "#ff8888",\
'ebr-4' smooth bezier title "EBR, 4" lc rgb "#ff6666",\
'ebr-8' smooth bezier title "EBR, 8" lc rgb "#ff4444",\
'hp-1' smooth bezier title "HP, 1" lc rgb "#aaffaa",\
'hp-2' smooth bezier title "HP, 2" lc rgb "#88ff88",\
'hp-4' smooth bezier title "HP, 4" lc rgb "#66ff66",\
'hp-8' smooth bezier title "HP, 8" lc rgb "#44ff44",\
'crossbeam-1' smooth bezier title "Crossbeam, 1" lc rgb "#aaaaff",\
'crossbeam-2' smooth bezier title "Crossbeam, 2" lc rgb "#8888ff",\
'crossbeam-4' smooth bezier title "Crossbeam, 4" lc rgb "#6666ff",\
'crossbeam-8' smooth bezier title "Crossbeam, 8" lc rgb "#4444ff",

plot show
set style fill solid 0.25 border -1
set style boxplot outliers pointtype 7
set style data boxplot
set size square

set pointsize 0.3

set xtics ('t=1' 1, 't=2' 2, 't=4' 3, 't=8' 4)

set terminal pdf size 10cm,10cm


set title "Timings for EBR (transfer)"
set output 'queue-transport-ebr.pdf'
plot for [i=1:4] 'queue-transport-ebr' using (i):i notitle

set title "Timings for crossbeam (transfer)"
set output 'queue-transport-crossbeam.pdf'
plot for [i=1:4] 'queue-transport-crossbeam' using (i):i notitle

set title "Timings for HP (transfer)"
set output 'queue-transport-hp.pdf'
plot for [i=1:4] 'queue-transport-hp' using (i):i notitle

0 comments on commit 6ef49af

Please sign in to comment.