heat: add cache miss experiment and figure

This commit is contained in:
Rodrigo Arias Mallo 2021-03-05 18:31:31 +01:00
parent 14fbb1499b
commit b600f64fcc
4 changed files with 140 additions and 0 deletions

87
garlic/exp/heat/cache.nix Normal file
View File

@ -0,0 +1,87 @@
{
stdenv
, stdexp
, bsc
, targetMachine
, stages
, garlicTools
}:
with stdenv.lib;
with garlicTools;
let
# Initial variable configuration
varConf = with bsc; {
cbs = range2 8 4096;
rbs = range2 32 4096;
};
machineConfig = targetMachine.config;
# Generate the complete configuration for each unit
genConf = with bsc; c: targetMachine.config // rec {
expName = "heat";
unitName = expName +
".cbs-${toString cbs}" +
".rbs-${toString rbs}";
inherit (machineConfig) hw;
# heat options
timesteps = 10;
cols = 1024 * 16; # Columns
rows = 1024 * 16; # Rows
cbs = c.cbs;
rbs = c.rbs;
gitBranch = "garlic/tampi+isend+oss+task";
# 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)
cpusPerTask = hw.cpusPerSocket;
jobName = unitName;
};
# Compute the array of configurations
configs = stdexp.buildConfigs {
inherit varConf genConf;
};
perf = {nextStage, conf, ...}: stages.perf {
inherit nextStage;
perfOptions = "stat -o .garlic/perf.csv -x , " +
"-e cycles,instructions,cache-references,cache-misses";
};
exec = {nextStage, conf, ...}: stages.exec {
inherit nextStage;
argv = [
"--rows" conf.rows
"--cols" conf.cols
"--rbs" conf.rbs
"--cbs" conf.cbs
"--timesteps" conf.timesteps
];
# The next stage is the program
env = ''
ln -sf ${nextStage}/etc/heat.conf heat.conf || true
'';
};
program = {nextStage, conf, ...}: bsc.garlic.apps.heat.override {
inherit (conf) gitBranch;
};
pipeline = stdexp.stdPipeline ++ [ perf exec program ];
in
stdexp.genExperiment { inherit configs pipeline; }

View File

@ -65,6 +65,7 @@
heat = {
granul = callPackage ./heat/granul.nix { };
cache = callPackage ./heat/cache.nix { };
};
bigsort = rec {

51
garlic/fig/heat/cache.R Normal file
View File

@ -0,0 +1,51 @@
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.cbs, config.rbs, perf.cache_misses) %>%
rename(cbs=config.cbs, rbs=config.rbs)
df$cbs = as.factor(df$cbs)
df$rbs = as.factor(df$rbs)
# Normalize the time by the median
df=group_by(df, cbs, rbs) %>%
mutate(median.misses = median(perf.cache_misses)) %>%
mutate(log.median.misses = log(median.misses)) %>%
ungroup()
ppi=300
h=5
w=5
png("heatmap.png", width=1.5*w*ppi, height=h*ppi, res=ppi)
#
## Create the plot with the normalized time vs nblocks
p = ggplot(df, aes(x=cbs, y=rbs, fill=log.median.misses)) +
geom_raster() +
scale_fill_gradient(high="black", low="white") +
coord_fixed() +
theme_bw() +
theme(plot.subtitle=element_text(size=8)) +
labs(x="cbs", y="rbs",
title=sprintf("Heat granularity: cache misses"),
subtitle=input_file)
# Render the plot
print(p)
# Save the png image
dev.off()

View File

@ -46,6 +46,7 @@ in
heat = with exp.heat; {
granul = stdPlot ./heat/granul.R [ granul ];
cache = customPlot ./heat/cache.R (ds.perf.stat cache.result);
};
creams = with exp.creams; {