iccsa-17-gpulab

git clone https://git.igankevich.com/iccsa-17-gpulab.git
Log | Files | Refs

commit 07216671f0052ea3cff99171397d868a1199e3e7
parent 72b6b096b832fc07e9f5980a955c6be11fe37278
Author: Ivan Gankevich <igankevich@ya.ru>
Date:   Thu, 11 May 2017 14:26:56 +0300

Plot histrograms.

Diffstat:
Makefile | 5++++-
R/common.R | 85++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
R/plot-cpu-gpu.R | 16++++++++++++----
3 files changed, 100 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,2 +1,5 @@ -all: +all: build ./R/plot-cpu-gpu.R + +build: + mkdir -p build diff --git a/R/common.R b/R/common.R @@ -65,7 +65,6 @@ load_log_file_as_data_frame <- function (prefix, pattern) { arma.plot_cpu_gpu <- function () { data1 <- load_log_file_as_data_frame("data", "^linear.*\\.log$") data2 <- load_log_file_as_data_frame("data", "^high_amplitude_realtime.*\\.log$") - first_size <- data1[1, "size"] data1 <- aggregate( data1$t, by=list(run=data1$run, size=data1$size), @@ -108,3 +107,87 @@ arma.plot_cpu_gpu <- function () { #print(data1) #print(data2) } + +arma.aggregate_dev <- function (data2) { + dev_to_host_opencl <- data2[data2$routine=="dev_to_host_copy", ] + window_function <- data2[data2$routine=="window_function", ] + second_function <- data2[data2$routine=="second_function", ] + fft <- data2[data2$routine=="fft", ] + all_opencl <- data.frame( + size=dev_to_host_opencl$size, + t_wnd=window_function$x, + t_sec=second_function$x, + t_fft=fft$x, + t_copy=dev_to_host_opencl$x, + row.names="size" + ) + all_opencl +} + +arma.plot_aggregate_dev <- function (all_opencl, ...) { + args <- list(...) + bar_colours <- gray.colors(ncol(all_opencl)) + barplot( + t(as.matrix(all_opencl)), + ylim=args$ylim, + axes=FALSE, + col=bar_colours + ) + axis(2, at=seq(0, args$ylim[[2]], length.out=6)) + title( + main=args$title, + xlab="Wavy surface size", + ylab="Time, s" + ) + legend( + "top", + args$legend, + fill=bar_colours + ) +} + +arma.plot_performance_breakdown <- function () { + data1 <- load_log_file_as_data_frame("data", "^linear.*\\.log$") + data2 <- load_log_file_as_data_frame("data", "^high_amplitude_realtime.*\\.log$") + data1 <- aggregate( + data1$t, + by=list(run=data1$run, size=data1$size, routine=data1$routine), + FUN=sum + ) + names(data1) <- c("run", "size", "routine", "t") + data2 <- aggregate( + data2$t, + by=list(run=data2$run, size=data2$size, routine=data2$routine), + FUN=sum + ) + names(data2) <- c("run", "size", "routine", "t") + #print(data2) + data1 <- aggregate( + data1$t*1e-6, + by=list(size=data1$size, routine=data1$routine), + FUN=mean + ) + data2 <- aggregate( + data2$t*1e-6, + by=list(size=data2$size, routine=data2$routine), + FUN=mean + ) + all_openmp <- arma.aggregate_dev(data1) + all_openmp$t_copy <- NULL + all_opencl <- arma.aggregate_dev(data2) + print(all_openmp) + print(all_opencl) + par(mfrow=c(1,2)) + arma.plot_aggregate_dev( + all_opencl, + ylim=c(0,1), + title="OpenCL", + legend=c(expression("f"[1]), expression("f"[2]), "FFT", "Copy") + ) + arma.plot_aggregate_dev( + all_openmp, + ylim=c(0,20), + title="OpenMP", + legend=c(expression("f"[1]), expression("f"[2]), "FFT") + ) +} diff --git a/R/plot-cpu-gpu.R b/R/plot-cpu-gpu.R @@ -2,10 +2,6 @@ source(file.path("R", "common.R")) -if (!dir.exists("build")) { - dir.create("build") -} - pdf( file=file.path("build", "bench-cpu-gpu.pdf"), width=3, @@ -14,3 +10,15 @@ pdf( ) par(family="Times") data <- arma.plot_cpu_gpu() + +dev.off() + +pdf( + file=file.path("build", "breakdown-cpu-gpu.pdf"), + width=4.5, + height=4, + pointsize=8 +) +par(family="Times") +data <- arma.plot_performance_breakdown() +