In [1]:
devtools::load_all()
library(RPostgres)
library(DT)
library(gridExtra)
library(ggplot2)
if (!require(reshape2)) { install.packages("reshape2") }
library(reshape2)
if (!require(rpivotTable)) { install.packages("rpivotTable")}
library(rpivotTable)

c <- benchbuild::login("bb")
library(repr)
options(repr.plot.width=12, repr.plot.height=8)


Loading benchbuild
Loading required package: reshape2
Loading required package: rpivotTable

In [2]:
exps <- benchbuild::get_experiments(c)

In [3]:
plot_comparison_data <- function(selected) {
  exps <- exps[exps$id %in% selected,]$id
  plot_data <- benchbuild::region_wise_comparison(c, exps)
  return(plot_data)
}

plot_comparison <- function(plot_data) {
  plot <- ggplot(data = plot_data, aes(x=cores, y=speedup, color = cores)) +
    geom_point() +
    coord_cartesian(ylim = c(-10,10)) +
    facet_wrap(~ project)
      theme(axis.text = element_text(size = 8), axis.text.x = element_text(angle = 45, hjust = 1),
              legend.position="none")
  return(plot)
}

scatter_plot <- function(plot_data) {
  plot <- ggplot(data = plot_data, aes(y=speedup, x=runtime_jit, color=cores)) +
    scale_x_log10() +
    geom_point(size=0.5) +
    geom_hline(yintercept=0) +
    coord_cartesian(ylim = c(-10,10)) +
    facet_wrap(~ cores) +
    geom_smooth(method=lm, se=TRUE, fullrange=TRUE, size=0.5) +
    theme(axis.text = element_text(size = 8),
          axis.text.x = element_text(angle = 45, hjust = 1))
  return(plot)
}

project_plot <- function(plot_data) {
  plot <- ggplot(data = plot_data, aes(y=speedup, x=project, color=cores)) +
    geom_point(size=0.2) +
    geom_jitter() +
    geom_hline(yintercept=0) +
    coord_cartesian(ylim = c(-10,10)) +
    #facet_wrap(~ t) +
    theme(axis.text = element_text(size = 8),
          axis.text.x = element_text(angle = 45, hjust = 1))
  return(plot)
}

bar_plot <- function(plot_data) {
  plot <- ggplot(data = plot_data, aes(y=speedup, x=region_name, fill=cores)) +
    geom_bar(stat="identity", position="dodge") +
    geom_hline(yintercept=0) +
    facet_wrap(~ cores) +
    coord_cartesian(ylim = c(-10,10)) +
    scale_x_discrete() +
    scale_y_discrete(limits = c(-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10))
    theme(axis.text = element_text(size = 8))
    #,
    #      axis.text.x = element_text(angle = 45, hjust = 1))
  return(plot)
}

In [45]:
#data <- plot_comparison_data(c(
#    '0f42573f-973d-4cd4-bfac-b71961d100ed',
#    '09de35a6-f0af-4577-91a2-a564b63ef900'
#))
polybench <- plot_comparison_data(c('9fd28f1b-8a9e-4d99-b495-e3b18fe9d347'))
llvm_nt <-plot_comparison_data(c('45d076f4-52b7-4d38-8cea-4e1d64714aed'))
benchbuild <- plot_comparison_data(c('d5c856a3-4f78-4988-b43f-a349d246eab2'))

data <- rbind(polybench, llvm_nt)
data <- rbind(data, benchbuild)

data$region_name <- as.numeric(factor(data$region_name))
data <- data[data$runtime_jit > 1000,]
data <- transform(data, speedup = ifelse(speedup >= 1, speedup-1, -1/speedup+1))
data <- data[complete.cases(data),]
data


projectregion_namecoresruntime_jitruntime_no_recompspeedup
1ludcmp 44 5 8674050 386083870 43.51022
2cholesky 44 5 8770138 383899522 42.77349
3cholesky 44 4 11203508 383816264 33.25858
4ludcmp 44 4 11210642 383155162 33.17781
5correlation56 5 2206754 75315458 33.12952
63mm 50 5 2525448 77192584 29.56590
7ludcmp 44 3 13012194 386490186 28.70215
8cholesky 44 3 13006294 385892570 28.66968
9correlation56 4 2638168 75272412 27.53208
102mm 49 5 1944084 54812510 27.19452
11covariance 57 5 2871408 75190808 25.18604
123mm 50 4 3061676 78437184 24.61903
13correlation56 3 2976732 75224302 24.27077
142mm 49 4 2292464 54659384 22.84307
15covariance 57 4 3300972 75360008 21.82964
16correlation56 2 3398096 75324524 21.16669
172mm 49 3 2651700 54800042 19.66600
183mm 50 3 3806658 78023898 19.49669
19covariance 57 3 4032380 75202090 17.64955
20syr2k 76 5 3722030 63239878 15.99070
21correlation56 1 4494254 75210772 15.73487
223mm 50 2 5357500 79446214 13.82897
23covariance 57 2 5199140 75153812 13.45505
24ludcmp 44 1 26761222 386661250 13.44856
25cholesky 44 1 26747456 385419324 13.40957
26syr2k 76 4 4393306 63110072 13.36505
27syr2k 76 3 5159612 63463762 11.30010
28cholesky 44 2 32568932 384743114 10.81319
29ludcmp 44 2 32635822 384510778 10.78186
30covariance 57 1 6465764 75471836 10.67253
561x264 121 5 26419 24493 -0.07863471
562lulesh 134 5 14074 12868 -0.09372086
563x264 121 1 26268 23428 -0.12122247
564lulesh 134 1 13462 11988 -0.12295629
565x264 45 1 5578 4950 -0.12686869
566lulesh 134 3 13373 11758 -0.13735329
567lulesh 134 2 13851 11965 -0.15762641
568lulesh 134 4 13990 11625 -0.20344086
569lulesh 136 3 45562 34530 -0.31949030
570lulesh 136 1 46920 34188 -0.37241137
571lulesh 136 2 48033 34985 -0.37295984
572lulesh 136 5 47218 34260 -0.37822534
573linpack 90 1 76279 55119 -0.38389666
574linpack 90 2 78351 55184 -0.41981371
575lulesh 136 4 47437 32673 -0.45187158
576xz 85 1 19357 11025 -0.75573696
577lulesh 131 3 59712 30820 -0.93744322
578lulesh 131 1 61194 31546 -0.93983389
579lulesh 131 2 61488 31039 -0.98099166
580lulesh 131 5 62328 31196 -0.99794845
581lulesh 131 4 61828 30343 -1.03763636
582xz 85 2 25410 12037 -1.11099111
583xz 85 3 27924 11531 -1.42164600
584xz 85 4 38691 11940 -2.24045226
585xz 85 5 46859 12198 -2.84153140
586lulesh 135 5 402510 34368 -10.71176676
587lulesh 135 3 378974 31861 -10.89460469
588lulesh 135 1 389755 32252 -11.08467692
589lulesh 135 2 393523 32132 -11.24707457
590lulesh 135 4 395082 31043 -11.72692717

In [82]:
box_plot <- function(plot_data) {
  plot <- ggplot(data = plot_data, aes(y=speedup, x=cores, color=cores)) +
    geom_violin(trim= TRUE, adjust = 0.5) +
    geom_jitter(height=0, size=0.5) +
    geom_hline(yintercept=0) +
    coord_cartesian(ylim = c(min(plot_data$speedup),max(plot_data$speedup))) +
    #facet_wrap(~ t) +
    theme(axis.text = element_text(size = 8),
          axis.text.x = element_text(angle = 45, hjust = 1))
  return(plot)
}

pos <- data[(as.numeric(data$cores) %in% c(1,2,5)),]
pos <- pos[pos$speedup > 0.1,]
neg <- data[(as.numeric(data$cores) %in% c(1,2,5)),]
neg <- neg[neg$speedup < 0.1,]
#data_pos <- data_filter[(data_filter$speedup > 0.50),]

neg$t <- "bad"
pos$t <- "good"

all <- rbind(neg, pos)

box_plot(all)
box_plot(pos)
box_plot(neg)