diff --git a/garlic/apps/saiph/default.nix b/garlic/apps/saiph/default.nix index 1af0775..9fe5f74 100644 --- a/garlic/apps/saiph/default.nix +++ b/garlic/apps/saiph/default.nix @@ -8,10 +8,15 @@ , boost , gitBranch ? "master" , numComm ? null +, nbx ? null +, nby ? null +, nbz ? null , vectFlags ? null #, breakpointHook }: +with stdenv.lib; + stdenv.mkDerivation rec { name = "saiph"; @@ -20,7 +25,7 @@ stdenv.mkDerivation rec { ref = "${gitBranch}"; }; - programPath = "/bin/ExHeat3D"; + programPath = "/bin/Heat3D_vect"; enableParallelBuilding = true; dontStrip = true; @@ -49,15 +54,18 @@ stdenv.mkDerivation rec { makeFlags = [ "-f" "Makefile.${cc.cc.CC}" "apps" - "APP=ExHeat3D" - ( if (numComm != null) then "NUM_COMM=${toString numComm}" else "" ) - ( if (vectFlags != null) then "VECT_FLAGS=${toString vectFlags}" else "" ) - ]; - + "APP=Heat3D_vect" + ] ++ optional (nbx != null) "NB_X=${toString nbx}" + ++ optional (nby != null) "NB_Y=${toString nby}" + ++ optional (nbz != null) "NB_Z=${toString nbz}" + ++ optional (numComm != null) "NUM_COMM=${toString numComm}" + ++ optional (vectFlags != null) "VECT_FLAGS=${toString vectFlags}" + ; + installPhase = '' mkdir -p $out/lib mkdir -p $out/bin cp obj/libsaiphv2.so $out/lib/ - cp bin/ExHeat3D $out/bin/ + cp bin/Heat3D_vect $out/bin/ ''; } diff --git a/garlic/exp/saiph/granularity.nix b/garlic/exp/saiph/granularity.nix new file mode 100644 index 0000000..1efd56e --- /dev/null +++ b/garlic/exp/saiph/granularity.nix @@ -0,0 +1,68 @@ +{ + stdenv +, stdexp +, bsc +, targetMachine +, stages +}: + +with stdenv.lib; + +let + # Initial variable configuration + varConf = with bsc; { + nb = [ 1 2 4 8 ]; + }; + + # Generate the complete configuration for each unit + genConf = with bsc; c: targetMachine.config // rec { + expName = "saiph.granularity"; + unitName = "${expName}.nbx-nby-nbz-${toString nbx}-${toString nby}-${toString nbz}"; + + # saiph options + nbx = c.nb; + nby = c.nb; + nbz = c.nb; + mpi = impi; + gitBranch = "garlic/tampi+isend+oss+task+simd"; + + # Repeat the execution of each unit 50 times + loops = 50; + + # Resources + qos = "debug"; + time = "00:30:00"; + ntasksPerNode = 1; + nodes = 1; + cpuBind = "sockets,verbose"; + jobName = "${unitName}-${gitBranch}"; + }; + + # 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 NANOS6_REPORT_PREFIX="#" + export I_MPI_THREAD_SPLIT=1 + export ASAN_SYMBOLIZER_PATH=${bsc.clangOmpss2Unwrapped}/bin/llvm-symbolizer + ''; + }; + + program = {nextStage, conf, ...}: with conf; + let + customPkgs = stdexp.replaceMpi conf.mpi; + in + customPkgs.apps.saiph.override { + inherit nbx nby nbz mpi gitBranch; + }; + + pipeline = stdexp.stdPipeline ++ [ exec program ]; + +in + + stdexp.genExperiment { inherit configs pipeline; } diff --git a/garlic/fig/saiph/granularity.R b/garlic/fig/saiph/granularity.R new file mode 100644 index 0000000..2b7f377 --- /dev/null +++ b/garlic/fig/saiph/granularity.R @@ -0,0 +1,100 @@ +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.nbx, time) %>% + rename(nbx=config.nbx) + +df$nbx = as.factor(df$nbx) + +# Normalize the time by the median +D=group_by(df, nbx) %>% + mutate(tnorm = time / median(time) - 1) %>% + mutate(bad = max(ifelse(abs(tnorm) >= 0.01, 1, 0))) + +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=nbx, y=tnorm, color=bad)) + + + # Labels + labs(x="nbx", 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=nbx, y=time)) + + + labs(x="nbx", 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() diff --git a/overlay.nix b/overlay.nix index f7eac52..8ad4a9b 100644 --- a/overlay.nix +++ b/overlay.nix @@ -330,6 +330,7 @@ let saiph = { numcomm = callPackage ./garlic/exp/saiph/numcomm.nix { }; + granularity = callPackage ./garlic/exp/saiph/granularity.nix { }; }; creams = { @@ -371,6 +372,7 @@ let saiph = with exp.saiph; { numcomm = merge [ numcomm ]; + granularity = merge [ granularity ]; }; heat = with exp.heat; { @@ -402,6 +404,13 @@ let }; }; + saiph = { + granularity = with ds.saiph; pp.rPlot { + script = ./garlic/fig/saiph/granularity.R; + dataset = granularity; + }; + }; + heat = { test = with ds.heat; pp.rPlot { script = ./garlic/fig/heat/test.R;