diff --git a/garlic/fig/index.nix b/garlic/fig/index.nix index 34d2ccf..bb0e052 100644 --- a/garlic/fig/index.nix +++ b/garlic/fig/index.nix @@ -16,6 +16,11 @@ let script = rScript; dataset = pp.mergeDatasets (map (e: ds.std.timetable e.result) expList); }; + + customPlot = rScript: dataset: rPlot { + script = rScript; + dataset = dataset; + }; in { nbody = with exp.nbody; { @@ -42,14 +47,12 @@ in }; osu = with exp.osu; { - #latency = pp.osu-latency latency.result; - latency = - let - resultJson = pp.osu-latency latency.result; - in - rPlot { - script = ./osu/latency.R; - dataset = resultJson; - }; + latency = customPlot ./osu/latency.R (ds.osu.latency latency.result); + latencyShm = customPlot ./osu/latency.R (ds.osu.latency latencyShm.result); + latencyMt = customPlot ./osu/latency.R (ds.osu.latency latencyMt.result); + latencyMtShm = customPlot ./osu/latency.R (ds.osu.latency latencyMtShm.result); + + bw = customPlot ./osu/bw.R (ds.osu.bw bw.result); + bwShm = customPlot ./osu/bw.R (ds.osu.bw bwShm.result); }; } diff --git a/garlic/fig/osu/bw.R b/garlic/fig/osu/bw.R new file mode 100644 index 0000000..6744dbc --- /dev/null +++ b/garlic/fig/osu/bw.R @@ -0,0 +1,50 @@ +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.unitName, config.nodes, config.ntasksPerNode, config.cpusPerTask, size, bw) %>% + rename(unitName=config.unitName) + +nodes = unique(df$config.nodes) +tasksPerNode = unique(df$config.ntasksPerNode) +cpusPerTask = unique(df$config.cpusPerTask) +df$unitName = as.factor(df$unitName) +df$sizeFactor = as.factor(df$size) + +ppi=300 +h=8 +w=12 + +png("bw.png", width=w*ppi, height=h*ppi, res=ppi) + +breaks = 10^(-10:10) +minor_breaks <- rep(1:9, 21)*(10^rep(-10:10, each=9)) + +p = ggplot(data=df, aes(x=size, y=bw)) + + labs(x="Size (bytes)", y="Bandwidth (MB/s)", + title=sprintf("OSU bandwidth benchmark: nodes=%d tasksPerNode=%d cpusPerTask=%d", + nodes, tasksPerNode, cpusPerTask), + subtitle=input_file) + + geom_boxplot(aes(color=unitName, group=interaction(unitName, sizeFactor))) + + scale_x_continuous(trans=log2_trans()) + + scale_y_log10(breaks = breaks, minor_breaks = minor_breaks) + + theme_bw() + + theme(legend.position = c(0.15, 0.9)) + +# Render the plot +print(p) + +## Save the png image +dev.off() diff --git a/garlic/fig/osu/latency.R b/garlic/fig/osu/latency.R index ade4819..53e7bb7 100644 --- a/garlic/fig/osu/latency.R +++ b/garlic/fig/osu/latency.R @@ -14,9 +14,12 @@ dataset = jsonlite::stream_in(file(input_file)) %>% jsonlite::flatten() # We only need the nblocks and time -df = select(dataset, config.unitName, size, latency) %>% +df = select(dataset, config.unitName, config.nodes, config.ntasksPerNode, config.cpusPerTask, size, latency) %>% rename(unitName=config.unitName) +nodes = unique(df$config.nodes) +tasksPerNode = unique(df$config.ntasksPerNode) +cpusPerTask = unique(df$config.cpusPerTask) df$unitName = as.factor(df$unitName) df$sizeFactor = as.factor(df$size) @@ -26,13 +29,17 @@ w=12 png("latency.png", width=w*ppi, height=h*ppi, res=ppi) +breaks = 10^(-10:10) +minor_breaks <- rep(1:9, 21)*(10^rep(-10:10, each=9)) + p = ggplot(data=df, aes(x=size, y=latency)) + labs(x="Size (bytes)", y="Latency (us)", - title="OSU latency benchmark", + title=sprintf("OSU latency benchmark nodes=%d tasksPerNode=%d cpusPerTask=%d", + nodes, tasksPerNode, cpusPerTask), subtitle=input_file) + geom_boxplot(aes(color=unitName, group=interaction(unitName, sizeFactor))) + - scale_y_continuous(trans=log10_trans()) + scale_x_continuous(trans=log2_trans()) + + scale_y_log10(breaks = breaks, minor_breaks = minor_breaks) + theme_bw() + theme(legend.position = c(0.15, 0.9)) diff --git a/garlic/index.nix b/garlic/index.nix index c513af9..815864c 100644 --- a/garlic/index.nix +++ b/garlic/index.nix @@ -106,7 +106,6 @@ # Post processing pp = { store = callPackage ./pp/store.nix { }; - osu-latency = callPackage ./pp/osu-latency.nix { }; rPlot = callPackage ./pp/rplot.nix { }; mergeDatasets = callPackage ./pp/merge.nix { }; }; diff --git a/garlic/pp/osu-latency.nix b/garlic/pp/osu-latency.nix deleted file mode 100644 index 4b4a4d1..0000000 --- a/garlic/pp/osu-latency.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - stdenv -, jq -}: - -inputResult: - -stdenv.mkDerivation { - name = "osu-latency.json"; - preferLocalBuild = true; - phases = [ "installPhase" ]; - buildInputs = [ jq ]; - installPhase = '' - touch $out - cd ${inputResult} - for exp in *-experiment; do - cd ${inputResult}/$exp - for unit in *-unit; do - cd ${inputResult}/$exp/$unit - conf=garlic_config.json - for run in $(ls -d [0-9]* | sort -n); do - echo "processing unit=$unit run=$run" - awk '/^[0-9]+ +[0-9\.]+$/{print $1, $2}' $run/stdout.log | ( - while read -r size latency; do - jq -cn "{ exp:\"$exp\", unit:\"$unit\", config:inputs, run:$run, \ - size:$size, latency:$latency }" $conf >> $out - done) - done - done - done - ''; -}