heat: Add test experiment and plot

This commit is contained in:
Rodrigo Arias 2020-11-05 19:56:26 +01:00
parent 074a75facb
commit 11ac02da08
3 changed files with 176 additions and 3 deletions

66
garlic/exp/heat/test.nix Normal file
View File

@ -0,0 +1,66 @@
{
stdenv
, stdexp
, bsc
, targetMachine
, stages
}:
with stdenv.lib;
let
# Initial variable configuration
varConf = with bsc; {
bsx = [ 1024 2048 4096 ];
};
machineConfig = targetMachine.config;
# Generate the complete configuration for each unit
genConf = with bsc; c: targetMachine.config // rec {
expName = "heat";
unitName = "${expName}.bsx-${toString bsx}";
inherit (machineConfig) hw;
# heat options
inherit (c) bsx;
timesteps = 10;
# Repeat the execution of each unit 30 times
loops = 10;
# Resources
qos = "debug";
ntasksPerNode = 1;
nodes = 1;
time = "02:00:00";
# Assign one socket to each task (only one process)
cpuBind = "verbose,sockets";
jobName = unitName;
};
# Compute the array of configurations
configs = stdexp.buildConfigs {
inherit varConf genConf;
};
exec = {nextStage, conf, ...}: with conf; stages.exec {
inherit nextStage;
argv = [ "-s" 1024 "-t" timesteps ];
env = ''
export LD_DEBUG=libs
export NANOS6_LOADER_VERBOSE=1
cp ${nextStage}/etc/heat.conf .
'';
};
program = {nextStage, conf, ...}: with conf;
bsc.garlic.apps.heat.override {
inherit bsx;
};
pipeline = stdexp.stdPipeline ++ [ exec program ];
in
stdexp.genExperiment { inherit configs pipeline; }

95
garlic/fig/heat/test.R Normal file
View File

@ -0,0 +1,95 @@
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.bsx, time) %>%
rename(bsx=config.bsx)
df$bsx = as.factor(df$bsx)
# Normalize the time by the median
D=group_by(df, bsx) %>%
mutate(tnorm = time / median(time) - 1)
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=bsx, y=tnorm)) +
# Labels
labs(x="bsx", y="Normalized time",
title=sprintf("Heat 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="red") +
# Draw boxplots
geom_boxplot() +
#scale_y_continuous(breaks = scales::pretty_breaks(n = 10)) +
theme_bw() +
theme(plot.subtitle=element_text(size=8)) +
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=bsx, y=time)) +
labs(x="bsx", y="Time (s)",
title=sprintf("Heat 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()

View File

@ -340,6 +340,10 @@ let
mpi_omp = callPackage ./garlic/exp/hpcg/mpi+omp.nix { }; mpi_omp = callPackage ./garlic/exp/hpcg/mpi+omp.nix { };
oss = callPackage ./garlic/exp/hpcg/oss.nix { }; oss = callPackage ./garlic/exp/hpcg/oss.nix { };
}; };
heat = {
test = callPackage ./garlic/exp/heat/test.nix { };
};
}; };
# Datasets used in the figures # Datasets used in the figures
@ -353,27 +357,35 @@ let
hpcg = with exp.hpcg; { hpcg = with exp.hpcg; {
oss = merge [ oss ]; oss = merge [ oss ];
}; };
heat = with exp.heat; {
test = merge [ test ];
};
}; };
# Figures generated from the experiments # Figures generated from the experiments
fig = with self.bsc.garlic; { fig = with self.bsc.garlic; {
nbody = { nbody = {
baseline = pp.rPlot { baseline = pp.rPlot {
script = ./garlic/fig/nbody/baseline.R; script = ./garlic/fig/nbody/baseline.R;
dataset = ds.nbody.baseline; dataset = ds.nbody.baseline;
}; };
jemalloc = pp.rPlot { jemalloc = pp.rPlot {
script = ./garlic/fig/nbody/jemalloc.R; script = ./garlic/fig/nbody/jemalloc.R;
dataset = ds.nbody.jemalloc; dataset = ds.nbody.jemalloc;
}; };
freeCpu = pp.rPlot { freeCpu = pp.rPlot {
script = ./garlic/fig/nbody/freeCpu.R; script = ./garlic/fig/nbody/freeCpu.R;
dataset = ds.nbody.freeCpu; dataset = ds.nbody.freeCpu;
}; };
};
heat = {
test = with ds.heat; pp.rPlot {
script = ./garlic/fig/heat/test.R;
dataset = test;
};
}; };
}; };
}; };