WIP: Add experimental figure pipeline

This commit is contained in:
Rodrigo Arias 2020-10-15 18:51:55 +02:00
parent 65745e0aaf
commit f33137a55e
2 changed files with 87 additions and 8 deletions

65
garlic/fig/nbody/test.nix Normal file
View File

@ -0,0 +1,65 @@
{
stdenv
, gnuplot
, jq
, experiments
, garlicTools
, getExpResult
, writeText
}:
with garlicTools;
with stdenv.lib;
let
experiment = builtins.elemAt experiments 0;
expResult = getExpResult {
garlicTemp = "/tmp/garlic-temp";
inherit experiment;
};
#set xrange [16:1024]
plotScript = writeText "plot.plg" ''
set terminal png size 800,800
set output 'out.png'
set xrange [*:*]
set nokey
set logscale x 2
set logscale y 2
set grid
set xlabel "blocksize"
set ylabel "time (s)"
plot filename using 1:2 with points
'';
in stdenv.mkDerivation {
name = "plot";
phases = [ "installPhase" ];
buildInputs = [ jq gnuplot ];
preferLocalBuild = true;
dontPatchShebangs = true;
installPhase = ''
mkdir $out
for unit in ${expResult}/*/*; do
name=$(basename $unit)
log="$unit/stdout.log"
conf="$unit/garlic_config.json"
bs=$(jq .blocksize $conf)
awk "/^time /{print $bs, \$2}" $log >> $out/data.csv
done
gnuplot -e "filename='$out/data.csv'" ${plotScript}
cp out.png $out/out.png
'';
#installPhase = ''
# mkdir $out
# for unit in ${expResult}/*/*; do
# name=$(basename $unit)
# log="$unit/stdout.log"
# bs=$(jq .blocksize $log)
# awk "/^time /{print $bs, \$2}" $log >> $out/data.csv
# done
#'';
#gnuplot -e "filename='$out/data.csv'" ${plotScript}
}

View File

@ -260,12 +260,11 @@ let
mpi = self.bsc.mpi;
};
# Post processing tools
hist = callPackage ./garlic/postprocess/hist { };
# Experiments
exp = {
nbody = {
test = callPackage ./garlic/exp/nbody/test.nix { };
tampi = callPackage ./garlic/exp/nbody/tampi.nix { };
};
saiph = {
@ -286,13 +285,29 @@ let
mpi_omp = callPackage ./garlic/exp/hpcg/mpi+omp.nix { };
oss = callPackage ./garlic/exp/hpcg/oss.nix { };
};
};
test = {
exec = callPackage ./test/garlic/exec.nix {
exec = self.bsc.garlic.stages.exec;
# Post processing tools
hist = callPackage ./garlic/postprocess/hist { };
getExpResult = callPackage ./garlic/postprocess/result.nix { };
fetchExperiment = callPackage ./garlic/postprocess/fetch.nix { };
# Figures generated from the experiments
fig = {
nbody = {
test = callPackage ./garlic/fig/nbody/test.nix {
experiments = [
self.bsc.garlic.exp.nbody.tampi
];
};
};
};
test = {
exec = callPackage ./test/garlic/exec.nix {
exec = self.bsc.garlic.stages.exec;
};
};
};
};
@ -302,6 +317,5 @@ in
# Aliases
garlic = bsc.garlic;
exp = bsc.garlic.exp;
apps = bsc.garlic.apps;
inherit (bsc.garlic) exp fig apps;
}