From a8477b1b05b95990f04b9ec23d1fd0487a8f5f6c Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 4 Mar 2021 18:41:45 +0100 Subject: [PATCH] fwi: add test figure with the time --- garlic/fig/fwi/test.R | 46 +++++++++++++++++++++++++++++++++++++++++++ garlic/fig/index.nix | 4 ++++ 2 files changed, 50 insertions(+) create mode 100644 garlic/fig/fwi/test.R diff --git a/garlic/fig/fwi/test.R b/garlic/fig/fwi/test.R new file mode 100644 index 0000000..ca79f0d --- /dev/null +++ b/garlic/fig/fwi/test.R @@ -0,0 +1,46 @@ +library(ggplot2) +library(dplyr) +library(scales) +library(jsonlite) + +args=commandArgs(trailingOnly=TRUE) + +# Read the timetable from args[1] +input_file = "input.json" +if (length(args)>0) { input_file = args[1] } + +# Load the dataset in NDJSON format +dataset = jsonlite::stream_in(file(input_file)) %>% + jsonlite::flatten() + +# We only need the nblocks and time +df = select(dataset, config.blocksize, config.gitBranch, time) %>% + rename(blocksize=config.blocksize, gitBranch=config.gitBranch) %>% + group_by(blocksize, gitBranch) %>% + mutate(mtime = median(time)) %>% + ungroup() + +df$gitBranch = as.factor(df$gitBranch) +df$blocksize = as.factor(df$blocksize) + +ppi=300 +h=5 +w=5 + +png("time.png", width=w*ppi, height=h*ppi, res=ppi) +# +## Create the plot with the normalized time vs nblocks +p = ggplot(df, aes(x=blocksize, y=time)) + + geom_point() + + geom_line(aes(y=mtime, group=gitBranch, color=gitBranch)) + + theme_bw() + + labs(x="Blocksize", y="Time (s)", title="FWI granularity", + subtitle=input_file) + + theme(plot.subtitle=element_text(size=8)) + + theme(legend.position = c(0.5, 0.88)) + +# Render the plot +print(p) + +# Save the png image +dev.off() diff --git a/garlic/fig/index.nix b/garlic/fig/index.nix index c36f0b4..dbe73e3 100644 --- a/garlic/fig/index.nix +++ b/garlic/fig/index.nix @@ -61,6 +61,10 @@ in big.granularity = stdPlot ./creams/granularity.R [ big.granularity ]; }; + fwi = with exp.fwi; { + test = stdPlot ./fwi/test.R [ test ]; + }; + osu = with exp.osu; { latency = customPlot ./osu/latency.R (ds.osu.latency latency.result); latencyShm = customPlot ./osu/latency.R (ds.osu.latency latencyShm.result);