# sprintf(format, arch, node, dir, threads, accel, stride, j, arr, workers, type)
format = "data/arch=%s.node=%s.dir=%s.threads=%d.accel=%i.opt-stride=%i.j=%i.arr=%s.workers=%i.type=%s.txt"

arch = "x86_64"
node = "pc"

dir = "fwd"
threads = 1
accel = 9
stride = 2
j = 1
arr = "packed"
workers = 1
type = "float"

#############################################################################
set terminal svg enhanced size 640 420
set output "array.svg"
set xlabel "pixels"
set ylabel "seconds / pixel"
set format x "%.1s%c"
set format y "%.1s%c"
set logscale x
set logscale y

threads = 1
accel = 9
stride = 2
j = -1
workers = 1

unset arrow

plot \
	sprintf(format, arch, node, dir, threads,  accel, stride, j, "simple", workers, type) with lines lc rgb "#ff0000" lw 2 title "simple", \
	sprintf(format, arch, node, dir, threads,  accel, stride, j, "sparse", workers, type) with lines lc rgb "#00ff00" lw 2 title "sparse", \
	sprintf(format, arch, node, dir, threads,  accel, stride, j, "packed", workers, type) with lines lc rgb "#0000ff" lw 2 title "packed"

#############################################################################
set terminal svg enhanced size 640 420
set output "stride.svg"
set xlabel "pixels"
set ylabel "seconds / pixel"
set format x "%.1s%c"
set format y "%.1s%c"
set logscale x
set logscale y

threads = 1
accel = 12
j = 1
arr = "packed"
workers = 4

unset arrow

# L1cache = 32*1024
# set arrow from L1cache/4,graph(0,0) to L1cache/4,graph(1,1) nohead
# 
# L2cache = 3072*1024
# set arrow from L2cache/4,graph(0,0) to L2cache/4,graph(1,1) nohead

plot \
	sprintf(format, arch, node, dir, threads,  accel, 0, j, arr, workers, type) with lines lc rgb "#ff0000" lw 2 title "non-optimal (0)", \
	sprintf(format, arch, node, dir, threads,  accel, 1, j, arr, workers, type) with lines lc rgb "#0000ff" lw 2 title "prime (1)", \
	sprintf(format, arch, node, dir, threads,  accel, 2, j, arr, workers, type) with lines lc rgb "#00ffff" lw 2 title "prime-set (2)", \
	sprintf(format, arch, node, dir, threads,  accel, 6, j, arr, workers, type) with lines lc rgb "#7f7f00" lw 2 title "odd (6)", \
	sprintf(format, arch, node, dir, threads,  accel, 7, j, arr, workers, type) with lines lc rgb "#7f7f7f" lw 2 title "odd-set (7)"

#############################################################################
set terminal svg enhanced size 640 420
set output "stride-all.svg"
set xlabel "pixels"
set ylabel "seconds / pixel"
set format x "%.1s%c"
set format y "%.1s%c"
set logscale x
set logscale y

threads = 1
accel = 12
j = 1
arr = "packed"
workers = 4

unset arrow

# L1cache = 32*1024
# set arrow from L1cache/4,graph(0,0) to L1cache/4,graph(1,1) nohead
# 
# L2cache = 3072*1024
# set arrow from L2cache/4,graph(0,0) to L2cache/4,graph(1,1) nohead

plot \
	sprintf(format, arch, node, dir, threads,  accel, 0, j, arr, workers, type) with lines lc rgb "#ff0000" lw 2 title "non-optimal (0)", \
	sprintf(format, arch, node, dir, threads,  accel, 1, j, arr, workers, type) with lines lc rgb "#0000ff" lw 2 title "prime (1)", \
	sprintf(format, arch, node, dir, threads,  accel, 2, j, arr, workers, type) with lines lc rgb "#00ffff" lw 2 title "prime-set (2)", \
	sprintf(format, arch, node, dir, threads,  accel, 3, j, arr, workers, type) with lines lc rgb "#00ff00" lw 2 title "one-set (3)", \
	sprintf(format, arch, node, dir, threads,  accel, 4, j, arr, workers, type) with lines lc rgb "#007f00" lw 2 title "set (4)", \
	sprintf(format, arch, node, dir, threads,  accel, 5, j, arr, workers, type) with lines lc rgb "#007f7f" lw 2 title "(5)", \
	sprintf(format, arch, node, dir, threads,  accel, 6, j, arr, workers, type) with lines lc rgb "#7f7f00" lw 2 title "odd (6)", \
	sprintf(format, arch, node, dir, threads,  accel, 7, j, arr, workers, type) with lines lc rgb "#7f7f7f" lw 2 title "odd-set (7)"

#############################################################################
set terminal svg enhanced size 640 420
set output "threads.svg"
set xlabel "pixels"
set ylabel "seconds / pixel"
set format x "%.1s%c"
set format y "%.1s%c"
set logscale x
set logscale y

accel = 9
stride = 2
j = 1
arr = "packed"
workers = 1

unset arrow

plot \
	sprintf(format, arch, node, dir, 1,  accel, stride, j, arr, workers, type) with lines lc rgb "#ff0000" lw 2 title "1 thread", \
	sprintf(format, arch, node, dir, 2,  accel, stride, j, arr, workers, type) with lines lc rgb "#0000ff" lw 2 title "2 threads"

#############################################################################
set terminal svg enhanced size 640 420
set output "accel-pc.svg"
set xlabel "pixels"
set ylabel "seconds / pixel"
set format x "%.1s%c"
set format y "%.1s%c"
set logscale x
set logscale y

threads = 1
stride = 7
j = 1
arr = "packed"

unset arrow

plot \
	sprintf(format, arch, node, dir, threads,  0, stride, j, arr, 1, type) with lines lc rgb "#ff0000" lw 2 title "ML (0)", \
	sprintf(format, arch, node, dir, threads,  9, stride, j, arr, 1, type) with lines lc rgb "#000000" lw 2 title "SDL (9)", \
	sprintf(format, arch, node, dir, threads, 11, stride, j, arr, 4, type) with lines lc rgb "#00ff00" lw 2 title "DL4 (11)", \
	sprintf(format, arch, node, dir, threads, 12, stride, j, arr, 4, type) with lines lc rgb "#ff7f00" lw 2 title "ML4 (12)", \
	sprintf(format, arch, node, dir, threads, 13, stride, j, arr, 1, type) with lines lc rgb "#7f7f7f" lw 2 title "ML no-sse (13)", \
	sprintf(format, arch, node, dir, threads, 16, stride, j, arr, 1, type) with lines lc rgb "#0000ff" lw 2 title "DL4L (16)"

#############################################################################
set terminal svg enhanced size 640 420
set output "accel-asvp.svg"
set xlabel "pixels"
set ylabel "seconds / pixel"
set format x "%.1s%c"
set format y "%.1s%c"
set logscale x
set logscale y

arch = "microblaze"
node = "asvpsys"
threads = 1
stride = 2
j = 1
arr = "packed"

unset arrow

plot \
	sprintf(format, arch, node, dir, threads,  0, stride, j, arr, 1, type) with lines lc rgb "#ff0000" lw 2 title "ML/CPU (0)", \
	sprintf(format, arch, node, dir, threads,  1, stride, j, arr, 1, type) with lines lc rgb "#0000ff" lw 2 title "ML/BCEx1 (1)", \
	sprintf(format, arch, node, dir, threads,  1, stride, j, arr, 2, type) with lines lc rgb "#00007f" lw 2 title "ML/BCEx2 (1)", \
	sprintf(format, arch, node, dir, threads,  4, stride, j, arr, 1, type) with lines lc rgb "#00ff00" lw 2 title "DL (4)", \
	sprintf(format, arch, node, dir, threads,  5, stride, j, arr, 1, type) with lines lc rgb "#000000" lw 2 title "SDL (5)"
