commit 7258df6c58772cc0cc0a8c01f87d41a083be6222
parent 5c092b91e0caffbb28b55e02a771f1adff1467a6
Author: Ivan Gankevich <igankevich@ya.ru>
Date: Mon, 21 Aug 2017 10:46:36 +0300
Add palette option. Add EPS output format.
Diffstat:
3 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,7 +1,8 @@
all: build
all: build/classes.pdf
- ./R/plot-cpu-gpu.R png
- ./R/plot-cpu-gpu.R pdf
+ ./R/plot-cpu-gpu.R png spbu
+ ./R/plot-cpu-gpu.R pdf spbu
+ ./R/plot-cpu-gpu.R eps gray
build/classes.svg: dia/classes.dia
dia -t svg -e $@ $<
diff --git a/R/common.R b/R/common.R
@@ -126,9 +126,14 @@ arma.aggregate_dev <- function (data2) {
arma.plot_aggregate_dev <- function (all_opencl, ...) {
args <- list(...)
- #bar_colours <- gray.colors(ncol(all_opencl))
- palette <- colorRampPalette(c("#9F2D20", "#A8ADB4"))
- bar_colours <- palette(ncol(all_opencl))
+ if (args$palette == 'gray') {
+ bar_colours <- gray.colors(ncol(all_opencl))
+ } else if (args$palette == 'spbu') {
+ palette <- colorRampPalette(c("#9F2D20", "#A8ADB4"))
+ bar_colours <- palette(ncol(all_opencl))
+ } else {
+ stop(paste("unknown palette: ", args$palette, sep=" "))
+ }
barplot(
t(as.matrix(all_opencl)),
ylim=args$ylim,
@@ -148,7 +153,7 @@ arma.plot_aggregate_dev <- function (all_opencl, ...) {
)
}
-arma.plot_performance_breakdown <- function () {
+arma.plot_performance_breakdown <- function (palette="gray") {
data1 <- load_log_file_as_data_frame("data", "^linear.*\\.log$")
data2 <- load_log_file_as_data_frame("data", "^high_amplitude_realtime.*\\.log$")
data1 <- aggregate(
@@ -184,12 +189,14 @@ arma.plot_performance_breakdown <- function () {
all_opencl,
ylim=c(0,1),
title="OpenCL",
- legend=c(expression("g"[1]), expression("g"[2]), "FFT", "Copy")
+ legend=c(expression("g"[1]), expression("g"[2]), "FFT", "Copy"),
+ palette=palette
)
arma.plot_aggregate_dev(
all_openmp,
ylim=c(0,20),
title="OpenMP",
- legend=c(expression("g"[1]), expression("g"[2]), "FFT")
+ legend=c(expression("g"[1]), expression("g"[2]), "FFT"),
+ palette=palette
)
}
diff --git a/R/plot-cpu-gpu.R b/R/plot-cpu-gpu.R
@@ -4,6 +4,7 @@ source(file.path("R", "common.R"))
args <- commandArgs(trailingOnly=TRUE)
fmt <- args[1]
+palette <- args[2]
if (fmt == 'pdf') {
pdf(
@@ -12,6 +13,13 @@ if (fmt == 'pdf') {
height=2.5,
pointsize=8
)
+} else if (fmt == 'eps') {
+ cairo_ps(
+ file=file.path("build", "bench-cpu-gpu.eps"),
+ width=3,
+ height=2.5,
+ pointsize=8
+ )
} else {
png(
file=file.path("build", "bench-cpu-gpu.png"),
@@ -32,6 +40,13 @@ if (fmt == 'pdf') {
height=4,
pointsize=8
)
+} else if (fmt == 'eps') {
+ cairo_ps(
+ file=file.path("build", "breakdown-cpu-gpu.eps"),
+ width=4.5,
+ height=4,
+ pointsize=8
+ )
} else {
png(
file=file.path("build", "breakdown-cpu-gpu.png"),
@@ -41,5 +56,5 @@ if (fmt == 'pdf') {
)
}
par(family="Times")
-data <- arma.plot_performance_breakdown()
+data <- arma.plot_performance_breakdown(palette=palette)