From 30ad4219d93b4a5c8716befc14a0669f2794bbd5 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 19 Oct 2020 11:52:47 +0200 Subject: [PATCH] Add example report --- garlic/report.nix | 30 ++++++++++++++++++++++++++++++ garlic/report.tex | 31 +++++++++++++++++++++++++++++++ overlay.nix | 5 +++++ 3 files changed, 66 insertions(+) create mode 100644 garlic/report.nix create mode 100644 garlic/report.tex diff --git a/garlic/report.nix b/garlic/report.nix new file mode 100644 index 0000000..e10e045 --- /dev/null +++ b/garlic/report.nix @@ -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 + ''; + } diff --git a/garlic/report.tex b/garlic/report.tex new file mode 100644 index 0000000..5e6759f --- /dev/null +++ b/garlic/report.tex @@ -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} diff --git a/overlay.nix b/overlay.nix index 843e3cb..d2f8b4b 100644 --- a/overlay.nix +++ b/overlay.nix @@ -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;