Add example report

This commit is contained in:
Rodrigo Arias Mallo 2020-10-19 11:52:47 +02:00
parent 067fb0c0a2
commit 30ad4219d9
3 changed files with 66 additions and 0 deletions

30
garlic/report.nix Normal file
View File

@ -0,0 +1,30 @@
{
stdenv
, fig
, exp
, writeText
, busybox
, jq
, texlive
}:
let
figJSON = writeText "fig.json" (builtins.toJSON fig);
expJSON = writeText "exp.json" (builtins.toJSON exp);
in
stdenv.mkDerivation {
name = "report";
src = ./.;
buildInputs = [ jq texlive.combined.scheme-basic ];
buildPhase = ''
ls -l
sed -i -e "s:@fig\.nbody\.test@:$(jq -r .nbody.test ${figJSON}):g" report.tex
jq . ${figJSON}
jq . ${expJSON}
pdflatex report.tex -o report.pdf
pdflatex report.tex -o report.pdf
'';
installPhase = ''
mkdir $out
cp report.* $out
'';
}

31
garlic/report.tex Normal file
View File

@ -0,0 +1,31 @@
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\title{Example of Nix + \LaTeX{}}
\author{Rodrigo Arias Mallo}
\maketitle
\section{Nbody}
The nbody program has been executed with varying block sizes while the execution
time $t$ is measured, as shown in the figure \ref{fig:nbody.test}.
%
\begin{figure}[h]
\centering
\includegraphics[width=0.45\textwidth]{@fig.nbody.test@/scatter.png}
\includegraphics[width=0.45\textwidth]{@fig.nbody.test@/box.png}
\caption{Nbody times with varying block size}
\label{fig:nbody.test}
\end{figure}
%
The normalized time $\hat t$ is computed with the median time $t_m$ using $ \hat
t = t / t_{m} - 1 $. It can be observed that the normalized times exceed the
maximum allowed interval in most cases, except with the largest block sizes.
Once the experiment \texttt{exp.nbody.test} changes, the hash of the experiment
program will change, therefore the plot will be updated and, lastly, this
report.
\end{document}

View File

@ -162,6 +162,11 @@ let
# Configuration for the machines
machines = callPackage ./garlic/machines.nix {};
report = callPackage ./garlic/report.nix {
fig = self.bsc.garlic.fig;
exp = self.bsc.garlic.exp;
};
# Use the configuration for the following target machine
targetMachine = self.garlic.machines.mn4;