From 992af14c7fb40f077893672fb1300454b301980c Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 23 Feb 2021 11:52:42 +0100 Subject: [PATCH] saiph: add scaling experiment --- garlic/exp/index.nix | 1 + garlic/exp/saiph/scaling.nix | 73 +++++++++++++++++ garlic/fig/index.nix | 3 +- garlic/fig/saiph/scaling.R | 151 +++++++++++++++++++++++++++++++++++ 4 files changed, 227 insertions(+), 1 deletion(-) create mode 100644 garlic/exp/saiph/scaling.nix create mode 100644 garlic/fig/saiph/scaling.R diff --git a/garlic/exp/index.nix b/garlic/exp/index.nix index 68cedd9..1d71c1e 100644 --- a/garlic/exp/index.nix +++ b/garlic/exp/index.nix @@ -34,6 +34,7 @@ saiph = { numcomm = callPackage ./saiph/numcomm.nix { }; granularity = callPackage ./saiph/granularity.nix { }; + scaling = callPackage ./saiph/scaling.nix { }; }; creams = rec { diff --git a/garlic/exp/saiph/scaling.nix b/garlic/exp/saiph/scaling.nix new file mode 100644 index 0000000..3ea0c3b --- /dev/null +++ b/garlic/exp/saiph/scaling.nix @@ -0,0 +1,73 @@ +{ + stdenv +, stdexp +, bsc +, targetMachine +, stages +}: + +with stdenv.lib; + +let + # Initial variable configuration + varConf = with bsc; { + nb = [ 1 2 4 8 16 32 64 ]; + nodes = [ 1 2 4 ]; + gitCommit = [ + "3ecae7c209ec3e33d1108ae4783d7e733d54f2ca" + ]; + }; + + # Generate the complete configuration for each unit + genConf = with bsc; c: targetMachine.config // rec { + expName = "saiph"; + unitName = "${expName}-N${toString nodes}" + + "-nbx${toString nbx}-nby${toString nby}"; + + inherit (targetMachine.config) hw; + + # saiph options + nbx = 1; + nby = c.nb; + nbz = c.nb; + mpi = impi; + gitBranch = "garlic/tampi+isend+oss+task+simd"; + inherit (c) gitCommit; + + # Repeat the execution of each unit 50 times + loops = 10; + + # Resources + qos = "bsc_cs"; + ntasksPerNode = 1; + nodes = c.nodes; + cpusPerTask = hw.cpusPerSocket; + jobName = "${unitName}"; + }; + + # Compute the array of configurations + configs = stdexp.buildConfigs { + inherit varConf genConf; + }; + + exec = {nextStage, conf, ...}: with conf; stages.exec { + inherit nextStage; + env = '' + export OMP_NUM_THREADS=${toString hw.cpusPerSocket} + export ASAN_SYMBOLIZER_PATH=${bsc.clangOmpss2Unwrapped}/bin/llvm-symbolizer + ''; + }; + + program = {nextStage, conf, ...}: + let + customPkgs = stdexp.replaceMpi conf.mpi; + in + customPkgs.apps.saiph.override { + inherit (conf) nbx nby nbz mpi gitBranch gitCommit; + }; + + pipeline = stdexp.stdPipeline ++ [ exec program ]; + +in + + stdexp.genExperiment { inherit configs pipeline; } diff --git a/garlic/fig/index.nix b/garlic/fig/index.nix index 201d68f..0d60563 100644 --- a/garlic/fig/index.nix +++ b/garlic/fig/index.nix @@ -42,7 +42,8 @@ in }; saiph = with exp.saiph; { - granularity = stdPlot ./saiph/granularity.R [ granularity ]; + granularity = rPlotExp ./saiph/granularity.R [ granularity ]; + scaling = rPlotExp ./saiph/scaling.R [ scaling ]; }; heat = with exp.heat; { diff --git a/garlic/fig/saiph/scaling.R b/garlic/fig/saiph/scaling.R new file mode 100644 index 0000000..dc587e3 --- /dev/null +++ b/garlic/fig/saiph/scaling.R @@ -0,0 +1,151 @@ +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.nby, config.nodes, time, total_time) %>% + rename(nby=config.nby, nnodes=config.nodes) + +df$nby = as.factor(df$nby) +df$nodes = as.factor(df$nnodes) + +# Normalize the time by the median +D=group_by(df, nby, nodes) %>% + mutate(tmedian = median(time)) %>% + mutate(ttmedian = median(total_time)) %>% + mutate(tnorm = time / tmedian - 1) %>% + mutate(bad = max(ifelse(abs(tnorm) >= 0.01, 1, 0))) %>% + mutate(tn = tmedian * nnodes) %>% + ungroup() + +D$bad = as.factor(D$bad) + + +print(D) + +ppi=300 +h=5 +w=5 + +png("box.png", width=w*ppi, height=h*ppi, res=ppi) +# +# +# +# Create the plot with the normalized time vs nblocks +p = ggplot(data=D, aes(x=nby, y=tnorm, color=bad)) + + + # Labels + labs(x="nby", y="Normalized time", + title=sprintf("Saiph-Heat3D normalized time"), + subtitle=input_file) + + + # Center the title + #theme(plot.title = element_text(hjust = 0.5)) + + + # Black and white mode (useful for printing) + #theme_bw() + + + # Add the maximum allowed error lines + geom_hline(yintercept=c(-0.01, 0.01), + linetype="dashed", color="gray") + + + # Draw boxplots + geom_boxplot() + + scale_color_manual(values=c("black", "brown")) + + + #scale_y_continuous(breaks = scales::pretty_breaks(n = 10)) + + + theme_bw() + + + theme(plot.subtitle=element_text(size=8)) + + theme(legend.position = "none") + #theme(legend.position = c(0.85, 0.85)) + + + + +# Render the plot +print(p) + +## Save the png image +dev.off() +# +png("scatter.png", width=w*ppi, height=h*ppi, res=ppi) +# +## Create the plot with the normalized time vs nblocks +p = ggplot(D, aes(x=nby, y=time)) + + + labs(x="nby", y="Time (s)", + title=sprintf("Saiph-Heat3D granularity"), + subtitle=input_file) + + theme_bw() + + theme(plot.subtitle=element_text(size=8)) + + theme(legend.position = c(0.5, 0.88)) + + + geom_point(shape=21, size=3) + + #scale_x_continuous(trans=log2_trans()) + + scale_y_continuous(trans=log2_trans()) + +# Render the plot +print(p) + +# Save the png image +dev.off() + +png("wasted.png", width=w*ppi, height=h*ppi, res=ppi) +# +## Create the plot with the normalized time vs nblocks +p = ggplot(D, aes(x=nby, y=time)) + + + labs(x="nby", y="Time (s)", + title=sprintf("Saiph-Heat3D granularity"), + subtitle=input_file) + + theme_bw() + + theme(plot.subtitle=element_text(size=8)) + + + geom_point(shape=21, size=3) + + geom_point(aes(y=total_time), shape=1, size=3, color="red") + + geom_line(aes(y=tmedian, color=nodes, group=nodes)) + + geom_line(aes(y=ttmedian, color=nodes, group=nodes)) + + #scale_x_continuous(trans=log2_trans()) + + scale_y_continuous(trans=log2_trans()) + +# Render the plot +print(p) + +# Save the png image +dev.off() + +png("test.png", width=w*ppi, height=h*ppi, res=ppi) +# +## Create the plot with the normalized time vs nblocks +p = ggplot(D, aes(x=nby, y=tn)) + + + labs(x="nby", y="Time (s) * nodes", + title=sprintf("Saiph-Heat3D granularity"), + subtitle=input_file) + + theme_bw() + + theme(plot.subtitle=element_text(size=8)) + + + geom_point(shape=21, size=3) + + geom_line(aes(color=nodes, group=nodes)) + + #scale_x_continuous(trans=log2_trans()) + + scale_y_continuous(trans=log2_trans()) + +# Render the plot +print(p) + +# Save the png image +dev.off()