#! /usr/bin/gnuplot

# Determine appropriate figure width given number of GPUs
stats "gpus.txt" using 0 nooutput
NUM_GPU_BENCHMARKS = STATS_records
WIDTH = 100 + 10 * NUM_GPU_BENCHMARKS # Empirically determined to look good for approx. 50 GPUs
HEIGHT = WIDTH*0.72
set term svg size WIDTH, HEIGHT font "DejaVu Sans,11"

# Load and display data
set output "gpus.svg"
set encoding utf8
set boxwidth 0.6
set style fill solid noborder
set key off
set ylabel "throughput (M cells/s)"
set xtics rotate by -90
set xtics scale 0
#set xtics out offset 0,-1.2
#set title "Mumax3 GPU performance for 2D simulations containing 4 million cells" font ",12" textcolor "#888888"
#set logscale y 10

set yrange[1:2000]
plot "gpus.txt" u ($0+1):($2/1e6):xtic(4) w boxes title " ", "oommf4M.txt" u (0):(4*$1**2 * $2 /$3/1e6):xtic("OOMMF (CPU)") w boxes

set output
