\begin{frame}[fragile]{Numerical analysis with Verificarlo}


    \textbf{Verificarlo} is a tool for assessing the precision of floating point operations. 
    It can be used to :

    \begin{columns}
        \column{0.3\textwidth}
            {\centering
            \includegraphics[width=80px, keepaspectratio]{img/verificarlo.png}
            }\\%
            
            {\footnotesize
            \url{https://github.com/verificarlo/verificarlo} GPL v3 \\
            }
        \column{0.7\textwidth}
        
            \begin{itemize}
                \item \textbf{Find numerical bugs} in codes \footnotemark[1]
                \begin{itemize}
                    \item Stochastic arithmetic to simulate round-off and cancellations
                    \item Localization techniques to pinpoint source of errors
                \end{itemize}

                \item \textbf{Optimize precision} \footnotemark[2]
                \begin{itemize}
                    \item Simulate custom formats for mixed precision \\(float, bf16) 
                    \item Tune precision in math library calls
                \end{itemize}
            \end{itemize}

    \end{columns} 
\footnotetext[1]{
C. Denis \textit{et al.} \href{https://dx.doi.org/10.1109/ARITH.2016.31}{doi:10.1109/ARITH.2016.31}
}
\footnotetext[2]{
Y Chatelain \textit{et al.} \href{https://dx.doi.org/10.1007/978-3-030-29400-7\_34}{doi:10.1007/978-3-030-29400-7\_34}
}
    
\end{frame}

\begin{frame}[fragile]{The Verificarlo pipeline}
  \begin{itemize}
      \item Each Floating-Point (FP) operation may introduce a $\delta$ error
  $$ z = fl[x+y] = (x+y)(1+\delta) $$
      \item When chaining multiple operations, errors can accumulate and snowball
      \item \structure{Monte Carlo Arithmetic key principle}
        \begin{itemize}
          \item Make $\delta$ a \structure{random variable}
          \item Use a Monte Carlo simulation to empirically estimate the FP error distribution
        \end{itemize}
  \end{itemize}
  
  \begin{center}
    \includegraphics[width=.8\textwidth]{img/verificarlo_pipeline.png}
  \end{center}
\end{frame}

\begin{frame}{Continuous-Integration precision tracking}

\begin{itemize}
    \item Each push to \structure{QMCkl} triggers a Verificarlo analysis.
    \item QMCkl kernels unit tests are augmented with probes: 
    \begin{itemize}
        \item track a scalar value precision
        \item ensure that a target precision is reached
    \end{itemize}
\end{itemize}
\vspace{2cm}\vfill

vfc\_probe(\tikzmark{kernel}"Sherman-Morisson", \tikzmark{var}"residual", res) \\ 
vfc\_probe\_assert("Sherman-Morisson", "res", res, \tikzmark{target}1e-7)

\begin{tikzpicture}[
  remember picture,
  overlay,
  expl/.style={draw=orange,fill=orange!30,rounded corners,text width=3cm},
  arrow/.style={red!80!black,ultra thick,->,>=latex}
]
\node[expl] 
  (kernelex) 
  at (2,3cm)
  {Kernel name};
\node[expl] 
  (varex) 
  at (7,3cm)
  {Variable name};
\node[expl] 
  (targetex) 
  at (12,3cm)
  {Target precision};
\draw[arrow]
  (kernelex.south) to[out=-90,in=90] ([yshift=1.2ex, xshift=1.7cm]{pic cs:kernel});  
\draw[arrow]
  (varex.south) to[out=-90,in=90] ([yshift=1.2ex, xshift=1cm]{pic cs:var});  
\draw[arrow]
  (targetex.south) to[out=-90,in=90] ([yshift=1.2ex, xshift=.5cm]{pic cs:target});  
\end{tikzpicture}


