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; mpi = self.bsc.mpi;
}; };
# Post processing tools # Experiments
hist = callPackage ./garlic/postprocess/hist { };
exp = { exp = {
nbody = { nbody = {
test = callPackage ./garlic/exp/nbody/test.nix { }; test = callPackage ./garlic/exp/nbody/test.nix { };
tampi = callPackage ./garlic/exp/nbody/tampi.nix { };
}; };
saiph = { saiph = {
@ -286,6 +285,23 @@ 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 { };
}; };
};
# 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 = { test = {
exec = callPackage ./test/garlic/exec.nix { exec = callPackage ./test/garlic/exec.nix {
@ -294,7 +310,6 @@ let
}; };
}; };
}; };
};
in in
{ {
@ -302,6 +317,5 @@ in
# Aliases # Aliases
garlic = bsc.garlic; garlic = bsc.garlic;
exp = bsc.garlic.exp; inherit (bsc.garlic) exp fig apps;
apps = bsc.garlic.apps;
} }