From c0531bb852f1c76e369181c5af52f3b5f4d06d60 Mon Sep 17 00:00:00 2001 From: Antoni Navarro Date: Fri, 23 Apr 2021 16:51:39 +0200 Subject: [PATCH 1/3] hpccg: add granularity experiment --- garlic/exp/hpccg/granularity.nix | 62 +++++++++++++++++++++ garlic/exp/index.nix | 5 ++ garlic/fig/hpccg/granularity.R | 92 ++++++++++++++++++++++++++++++++ garlic/fig/index.nix | 6 +++ 4 files changed, 165 insertions(+) create mode 100644 garlic/exp/hpccg/granularity.nix create mode 100644 garlic/fig/hpccg/granularity.R diff --git a/garlic/exp/hpccg/granularity.nix b/garlic/exp/hpccg/granularity.nix new file mode 100644 index 00000000..d7fc8ca4 --- /dev/null +++ b/garlic/exp/hpccg/granularity.nix @@ -0,0 +1,62 @@ +{ + stdenv +, stdexp +, bsc +, targetMachine +, stages +, garlicTools +}: + +with stdenv.lib; +with garlicTools; + +let + # Initial variable configuration + varConf = with bsc; { + blocksize = [ 16 32 64 128 256 512 1024 2048 ]; + gitBranch = [ +# "garlic/mpi+isend+omp+fork" + "garlic/tampi+isend+oss+task" +# "garlic/tampi+isend+oss+taskfor" + ]; + }; + + # Generate the complete configuration for each unit + genConf = c: targetMachine.config // rec { + hw = targetMachine.config.hw; + blocksize = c.blocksize; + gitBranch = c.gitBranch; + + expName = "hpccg-granularity"; + unitName = expName + "-${toString gitBranch}" + "-bs${toString blocksize}"; + + # Modify to 30 + loops = 30; + + qos = "debug"; + ntasksPerNode = 1; + nodes = 1; + time = "02:00:00"; + cpusPerTask = hw.cpusPerSocket; + jobName = unitName; + }; + + # Compute the array of configurations + configs = stdexp.buildConfigs { + inherit varConf genConf; + }; + + exec = {nextStage, conf, ...}: stages.exec { + inherit nextStage; + argv = [ 512 512 256 10 conf.blocksize ]; + }; + + program = {nextStage, conf, ...}: with conf; bsc.garlic.apps.hpccg.override { + inherit (conf) gitBranch; + }; + + pipeline = stdexp.stdPipeline ++ [ exec program ]; + +in + + stdexp.genExperiment { inherit configs pipeline; } diff --git a/garlic/exp/index.nix b/garlic/exp/index.nix index d467881b..238bf991 100644 --- a/garlic/exp/index.nix +++ b/garlic/exp/index.nix @@ -13,6 +13,11 @@ numa = callPackage ./nbody/numa.nix { }; }; + hpccg = { + granularity = callPackage ./hpccg/granularity.nix { }; + ss = callPackage ./hpccg/ss.nix { }; + }; + saiph = { granularity = callPackage ./saiph/granularity.nix { }; ss = callPackage ./saiph/ss.nix { }; diff --git a/garlic/fig/hpccg/granularity.R b/garlic/fig/hpccg/granularity.R new file mode 100644 index 00000000..85871b2e --- /dev/null +++ b/garlic/fig/hpccg/granularity.R @@ -0,0 +1,92 @@ +library(ggplot2) +library(dplyr, warn.conflicts = FALSE) +library(scales) +library(jsonlite) +library(viridis, warn.conflicts = FALSE) + +# Load the arguments (argv) +args = commandArgs(trailingOnly=TRUE) +if (length(args)>0) { input_file = args[1] } else { input_file = "input" } + +df = jsonlite::stream_in(file(input_file), verbose=FALSE) %>% + jsonlite::flatten() %>% + select(config.blocksize, config.gitBranch, unit, time) %>% + rename(blocksize=config.blocksize, branch=config.gitBranch) %>% + + mutate(blocksize = as.factor(blocksize)) %>% + mutate(branch = as.factor(branch)) %>% + mutate(unit = as.factor(unit)) %>% + + group_by(unit) %>% + + mutate(median.time = median(time)) %>% + mutate(normalized.time = time / median.time - 1) %>% + mutate(log.median.time = log(median.time)) %>% + + ungroup() + +dpi = 300 +h = 5 +w = 8 + +# --------------------------------------------------------------------- + +p = ggplot(df, aes(x=blocksize, y=median.time, color=branch)) + + geom_point() + + geom_line(aes(group=branch)) + + theme_bw() + + labs(x="Blocksize", y="Median time (s)", title="HPCCG Granularity: Median Time", + subtitle=input_file) + + theme(plot.subtitle=element_text(size=5)) + + theme(legend.position="bottom") + + theme(legend.text = element_text(size=7)) + +ggsave("median.time.png", plot=p, width=w, height=h, dpi=dpi) +ggsave("median.time.pdf", plot=p, width=w, height=h, dpi=dpi) + +# --------------------------------------------------------------------- + +p = ggplot(df, aes(x=blocksize, y=normalized.time, color=branch)) + + geom_boxplot() + + geom_hline(yintercept=c(-0.01, 0.01), linetype="dashed", color="red") + + facet_wrap(~ branch) + + theme_bw() + + labs(x="Blocksize", y="Normalized Time", title="HPCCG Granularity: Normalized Time", + subtitle=input_file) + + theme(plot.subtitle=element_text(size=5)) + + theme(legend.position="bottom") + + theme(legend.text = element_text(size=7)) + +ggsave("normalized.time.png", plot=p, width=w, height=h, dpi=dpi) +ggsave("normalized.time.pdf", plot=p, width=w, height=h, dpi=dpi) + +# --------------------------------------------------------------------- + +p = ggplot(df, aes(x=blocksize, y=time, color=branch)) + + geom_point(shape=21, size=3) + + theme_bw() + + labs(x="Blocksize", y="Time (s)", title="HPCCG Granularity: Time", + subtitle=input_file) + + theme(plot.subtitle=element_text(size=5)) + + theme(legend.position="bottom") + + theme(legend.text = element_text(size=7)) + +ggsave("time.png", plot=p, width=w, height=h, dpi=dpi) +ggsave("time.pdf", plot=p, width=w, height=h, dpi=dpi) + + +# --------------------------------------------------------------------- + +p = ggplot(df, aes(x=blocksize, y=branch, fill=median.time)) + + geom_raster() + + scale_fill_viridis(option="plasma") + + coord_fixed() + + theme_bw() + + labs(x="Blocksize", y="Branch", title="HPCCG Granularity: Time", + subtitle=input_file) + + theme(plot.subtitle=element_text(size=5)) + + theme(legend.position="bottom") + + theme(legend.text = element_text(size=7)) + +ggsave("time.heatmap.png", plot=p, width=w, height=h, dpi=dpi) +ggsave("time.heatmap.pdf", plot=p, width=w, height=h, dpi=dpi) diff --git a/garlic/fig/index.nix b/garlic/fig/index.nix index 6f6ff4b5..511cfd1f 100644 --- a/garlic/fig/index.nix +++ b/garlic/fig/index.nix @@ -35,6 +35,12 @@ in numa = stdPlot ./nbody/numa.R [ numa ]; }; + hpccg = with exp.hpccg; { + granularity = stdPlot ./hpccg/granularity.R [ granularity ]; + nodesorsockets = stdPlot ./hpccg/nodes-or-sockets.R [ nodesorsockets ]; + scaling = stdPlot ./hpccg/scaling.R [ scaling ]; + }; + hpcg = with exp.hpcg; { ss = stdPlot ./hpcg/ss.R [ ss ]; ws = stdPlot ./hpcg/ws.R [ ws ]; -- GitLab From cca346d3b5ad464f82cc465cc6e2a259d717d4b0 Mon Sep 17 00:00:00 2001 From: Antoni Navarro Date: Fri, 23 Apr 2021 16:51:52 +0200 Subject: [PATCH 2/3] hpccg: add scaling experiment --- garlic/exp/hpccg/ss.nix | 65 ++++++++++++++++++++++++++++ garlic/fig/hpccg/ss.R | 93 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 garlic/exp/hpccg/ss.nix create mode 100644 garlic/fig/hpccg/ss.R diff --git a/garlic/exp/hpccg/ss.nix b/garlic/exp/hpccg/ss.nix new file mode 100644 index 00000000..9d39dd41 --- /dev/null +++ b/garlic/exp/hpccg/ss.nix @@ -0,0 +1,65 @@ +{ + stdenv +, stdexp +, bsc +, targetMachine +, stages +, garlicTools +}: + +with stdenv.lib; +with garlicTools; + +let + # Initial variable configuration + varConf = with bsc; { + blocksize = [ 512 ]; + nodes = [ 1 2 4 8 16 ]; + gitBranch = [ +# "garlic/mpi+isend+omp+fork" + "garlic/tampi+isend+oss+task" +# "garlic/tampi+isend+oss+taskfor" + ]; + }; + + # Generate the complete configuration for each unit + genConf = c: targetMachine.config // rec { + hw = targetMachine.config.hw; + blocksize = c.blocksize; + numNodes = c.nodes; + gitBranch = c.gitBranch; + + zDimm = 256 / numNodes; + + expName = "hpccg-scaling"; + unitName = expName + "-${toString gitBranch}" + "-nodes${toString numNodes}"; + + loops = 30; + + nodes = numNodes; + qos = "debug"; + ntasksPerNode = 2; + time = "02:00:00"; + cpusPerTask = hw.cpusPerSocket; + jobName = unitName; + }; + + # Compute the array of configurations + configs = stdexp.buildConfigs { + inherit varConf genConf; + }; + + exec = {nextStage, conf, ...}: stages.exec { + inherit nextStage; + argv = [ 512 512 zDimm 10 conf.blocksize ]; + }; + + program = {nextStage, conf, ...}: with conf; bsc.garlic.apps.hpccg.override { + inherit (conf) gitBranch; + }; + + pipeline = stdexp.stdPipeline ++ [ exec program ]; + +in + + stdexp.genExperiment { inherit configs pipeline; } diff --git a/garlic/fig/hpccg/ss.R b/garlic/fig/hpccg/ss.R new file mode 100644 index 00000000..cbc6e5da --- /dev/null +++ b/garlic/fig/hpccg/ss.R @@ -0,0 +1,93 @@ +library(ggplot2) +library(dplyr, warn.conflicts = FALSE) +library(scales) +library(jsonlite) +library(viridis, warn.conflicts = FALSE) + +# Load the arguments (argv) +args = commandArgs(trailingOnly=TRUE) +if (length(args)>0) { input_file = args[1] } else { input_file = "input" } + +df = jsonlite::stream_in(file(input_file), verbose=FALSE) %>% + jsonlite::flatten() %>% + select(config.blocksize, config.gitBranch, config.numNodes, unit, time) %>% + rename(nodes = config.numNodes, blocksize=config.blocksize, branch=config.gitBranch) %>% + + mutate(blocksize = as.factor(blocksize)) %>% + mutate(nodes = as.factor(nodes)) %>% + mutate(branch = as.factor(branch)) %>% + mutate(unit = as.factor(unit)) %>% + + group_by(unit) %>% + + mutate(median.time = median(time)) %>% + mutate(normalized.time = time / median.time - 1) %>% + mutate(log.median.time = log(median.time)) %>% + + ungroup() + +dpi = 300 +h = 5 +w = 8 + +# --------------------------------------------------------------------- + +p = ggplot(df, aes(x=nodes, y=median.time, color=branch)) + + geom_point() + + geom_line(aes(group=branch)) + + theme_bw() + + labs(x="Nodes", y="Median time (s)", title="HPCCG Scaling: Median Time", + subtitle=input_file) + + theme(plot.subtitle=element_text(size=5)) + + theme(legend.position="bottom") + + theme(legend.text = element_text(size=7)) + +ggsave("median.time.png", plot=p, width=w, height=h, dpi=dpi) +ggsave("median.time.pdf", plot=p, width=w, height=h, dpi=dpi) + +# --------------------------------------------------------------------- + +p = ggplot(df, aes(x=nodes, y=normalized.time, color=branch)) + + geom_boxplot() + + geom_hline(yintercept=c(-0.01, 0.01), linetype="dashed", color="red") + + facet_wrap(~ branch) + + theme_bw() + + labs(x="Nodes", y="Normalized time (s)", title="HPCCG Scaling: Normalized Time", + subtitle=input_file) + + theme(plot.subtitle=element_text(size=5)) + + theme(legend.position="bottom") + + theme(legend.text = element_text(size=7)) + +ggsave("normalized.time.png", plot=p, width=w, height=h, dpi=dpi) +ggsave("normalized.time.pdf", plot=p, width=w, height=h, dpi=dpi) + +# --------------------------------------------------------------------- + +p = ggplot(df, aes(x=nodes, y=time, color=branch)) + + geom_point(shape=21, size=3) + + theme_bw() + + labs(x="Nodes", y="Time (s)", title="HPCCG Scaling: Time", + subtitle=input_file) + + theme(plot.subtitle=element_text(size=5)) + + theme(legend.position="bottom") + + theme(legend.text = element_text(size=7)) + +ggsave("time.png", plot=p, width=w, height=h, dpi=dpi) +ggsave("time.pdf", plot=p, width=w, height=h, dpi=dpi) + + +# --------------------------------------------------------------------- + +p = ggplot(df, aes(x=nodes, y=branch, fill=median.time)) + + geom_raster() + + scale_fill_viridis(option="plasma") + + coord_fixed() + + theme_bw() + + labs(x="Nodes", y="Branch", title="HPCCG Scaling: Time", + subtitle=input_file) + + theme(plot.subtitle=element_text(size=5)) + + theme(legend.position="bottom") + + theme(legend.text = element_text(size=7)) + +ggsave("time.heatmap.png", plot=p, width=w, height=h, dpi=dpi) +ggsave("time.heatmap.pdf", plot=p, width=w, height=h, dpi=dpi) -- GitLab From a78a184bddcba72d91fe2eb7722658f2be71d6e2 Mon Sep 17 00:00:00 2001 From: Antoni Navarro Date: Mon, 26 Apr 2021 10:38:11 +0200 Subject: [PATCH 3/3] hpccg: rename scaling test --- garlic/exp/hpccg/{ss.nix => scaling.nix} | 2 +- garlic/exp/index.nix | 2 +- garlic/fig/hpccg/{ss.R => scaling.R} | 0 garlic/fig/index.nix | 1 - 4 files changed, 2 insertions(+), 3 deletions(-) rename garlic/exp/hpccg/{ss.nix => scaling.nix} (96%) rename garlic/fig/hpccg/{ss.R => scaling.R} (100%) diff --git a/garlic/exp/hpccg/ss.nix b/garlic/exp/hpccg/scaling.nix similarity index 96% rename from garlic/exp/hpccg/ss.nix rename to garlic/exp/hpccg/scaling.nix index 9d39dd41..73fc7848 100644 --- a/garlic/exp/hpccg/ss.nix +++ b/garlic/exp/hpccg/scaling.nix @@ -51,7 +51,7 @@ let exec = {nextStage, conf, ...}: stages.exec { inherit nextStage; - argv = [ 512 512 zDimm 10 conf.blocksize ]; + argv = [ 512 512 conf.zDimm 10 conf.blocksize ]; }; program = {nextStage, conf, ...}: with conf; bsc.garlic.apps.hpccg.override { diff --git a/garlic/exp/index.nix b/garlic/exp/index.nix index 238bf991..5681f2ec 100644 --- a/garlic/exp/index.nix +++ b/garlic/exp/index.nix @@ -15,7 +15,7 @@ hpccg = { granularity = callPackage ./hpccg/granularity.nix { }; - ss = callPackage ./hpccg/ss.nix { }; + scaling = callPackage ./hpccg/scaling.nix { }; }; saiph = { diff --git a/garlic/fig/hpccg/ss.R b/garlic/fig/hpccg/scaling.R similarity index 100% rename from garlic/fig/hpccg/ss.R rename to garlic/fig/hpccg/scaling.R diff --git a/garlic/fig/index.nix b/garlic/fig/index.nix index 511cfd1f..9b5d99e1 100644 --- a/garlic/fig/index.nix +++ b/garlic/fig/index.nix @@ -37,7 +37,6 @@ in hpccg = with exp.hpccg; { granularity = stdPlot ./hpccg/granularity.R [ granularity ]; - nodesorsockets = stdPlot ./hpccg/nodes-or-sockets.R [ nodesorsockets ]; scaling = stdPlot ./hpccg/scaling.R [ scaling ]; }; -- GitLab