

\frame{ \frametitle{}
 \hspace{1em}
 \begin{centering}
 \hspace{-1cm}\includegraphics[height=3.3cm]{cactuslogo_big}\\
 \vspace{1cm}
 {\Huge Cactus: Advanced Topics}\\
 \end{centering}
}

\section{Kranc}

  \begin{frame}{Kranc}
    \includegraphics[width=0.6\textwidth]{kranc}
    \begin{itemize}
    \item A tool for generating thorns
    \item \only<-1>{\textcolor{cactusgreen}}{Original version by S. Husa, I. Hinder, C. Lechner}
    \item \only<-2>{\textcolor{cactusgreen}}{Used for many scientific papers}
    \item \only<-3>{\textcolor{cactusgreen}}{Allows user to specify continuum problem without
          regard for implementation}
    \end{itemize}
  \end{frame}
  \begin{frame}{Kranc}
    \includegraphics[width=0.6\textwidth]{kranc}
    \begin{itemize}
    \item Minimally, a Kranc script contains
        \begin{itemize}
        \item Cactus Group Definitions
        \item A set of Calculations
        \end{itemize}
    \item A calculation in Kranc is written using
        Mathematica (a symbolic programming language)
        \begin{itemize}
        \item Example: dot[h[la,lb]] $->$ -2 alpha K[la,lb]
        \item dot means ``time derivative''
        \item h[la,lb] and K[la,lb] are matrices
        \end{itemize}
    \end{itemize}
  \end{frame}

  \begin{frame}{Kranc}
    \includegraphics[width=0.6\textwidth]{kranc}
    \begin{itemize}
    \item Included in Cactus-OS distribution: {\tt Cactus/repos/Kranc}.
    \item The state-of-the art numerical relativity code, 
          produced by Kranc: {\tt Cactus/arrangements/McLachlan}.
    \item For more, see: {\tt http://kranccode.org}
    \end{itemize}
  \end{frame}

\section{Simfactory}

  \begin{frame}{Simfactory}
  The Simulation Factory:
    \begin{columns}
    \column{0.25\textwidth}
    \includegraphics[width=\textwidth]{factory.png}
    \column{0.75\textwidth}
    \begin{itemize}
    \item Command-line tools for setting up Cactus distribution
          and managing simulations on a variety of supercomputers,
          including most of the TeraGrid machines.
    \end{itemize}
    \end{columns}
    \begin{itemize}
    \item Captures the best practices of experienced users, ensuring 
          repeatable and well-documented scientific results.
    \item Developed by Erik Schnetter and Michael Thomas.
    \item Included in Cactus-OS distro: {\tt Cactus/simfactory}.
    \item For more, see: {\tt http://simfactory.org}
    \end{itemize}
  \end{frame}

\section{Einstein Toolkit}

  \begin{frame}{Einstein Toolkit}
  Open-source code for the numerial relativity and relativistic astrophysics.
    \begin{columns}
    \column{0.25\textwidth}
    \begin{center}
      \includegraphics[width=0.7\textwidth]{einstein.png}
    \end{center}
    \column{0.75\textwidth}
    {\bf Capabilities:}
    \begin{itemize}
    \item Accurate evolutions of vacuum spacetimes using Einstein equations.
    \item Relativistic hydrodynamics, based on the public version of Whisky code.
    \end{itemize}
    \end{columns}
    \begin{itemize}
    \item Initial data solvers: single and bindary BHs and relativistic stars.
    \item Analysis: finds BH horizon, calculates spacetime curvature, extracts gravitational waves.
    \item More information: \url{http://einsteintoolkit.org}
    \end{itemize}
  \end{frame}

  \begin{frame}{Einstein Toolkit on your virtual box}
  In Eclipse, open "Mojave $>$ Edit variables..." and set parameters 
  for precompiled version of the Einstein toolkit and a parameter file:
  \begin{center}
    \begin{tabular}{||p{.2\textwidth}|p{.5\textwidth}||}
    \hline
    {\bf Name} & {\bf Value}  \\
    \hline
    par       & {\tt par/static\_tov.par}  \\
    \hline
    thornlist & {\tt thornlists/einsteintoolkit.th}  \\
    \hline
    config    & {\tt et}  \\
    \hline
    sim.name  & {\tt tov\_star1}  \\
    \hline
    \end{tabular}
  \end{center}
  Select "Mojave $>$ Create", then "Mojave $>$ Run" to create and run 
  an evolution of a relativistic TOV star!  
\end{frame}

\begin{frame}[containsverbatim]{Simple visualization with {\tt gnuplot}}
  \begin{center}
    \includegraphics[width=0.6\textwidth]{tov_rho_max.png}
  \end{center}
  {\small
  \begin{verbatim}
  cd ~/simulations/tov_star/output-0000
  gnuplot> p "static_tov/hydrobase::rho.maximum.asc" u 2:3 w l
  gnuplot> p "static_tov/admbase::alpha.x.asc" u 10:13 i 0 w l
  \end{verbatim}
  }
\end{frame}

\subsection{HDF5 and VisIt}

\begin{frame}[containsverbatim]{3D output and visualization}
 To enable 3D output, copy {\tt static\_tov.par} to a new parameter
 file (say, {\tt static\_tov\_h5.par}) and append the following lines,
 then use it to create and run a new simulation:
 \begin{verbatim}
 IOHDF5::out_criterion = time
 IOHDF5::out_dt        = 100.0
 IOHDF5::out_vars = "
   grid::coordinates{out_every=10000000}
   HydroBase::rho
 "
 \end{verbatim}

\end{frame}

\begin{frame}[containsverbatim]{Using VisIt}
  VisIt is an interactive 3D visualization tool.\\
  \begin{columns}
  \column{0.35\textwidth}
    \begin{center}
      \includegraphics[width=\textwidth]{visit_vis.png}
    \end{center}
  \column{0.65\textwidth}
  \begin{itemize}
  \item Open VisIt
  \item Open "File $>$ Open File...", navigate to the output of your simulation,
        or use:

\begin{verbatim}
~/simulations/tov_star/output-0000/static_tov
\end{verbatim}
  \item Select filter: {\tt *.h5}
  \item Select the star density: {\tt rho.h5} 
  \end{itemize}
  \end{columns}
  \begin{itemize}
  \item Add contour plot for the second refinement level \\
        ({\tt HYDROBASE::rho it=0 tl=0 rl=2})
  \item Press "Draw" button.
  \end{itemize}
  VisIt website: {\tt https://wci.llnl.gov/codes/visit/}
\end{frame}

\section{HTTPD}

\begin{frame}{Thorn HTTPD}
   Remote steering/monitoring tool
   \begin{itemize}
   \item Mini web server implemented as a thorn
   \item Connect to a running simulation with a web browser
   \item View and steer simulation parameters
   \item Basic remote visualization
   \end{itemize}
\end{frame}

\begin{frame}[containsverbatim]{Adding HTTPD to your configuration}
  Using HTTPD is simple:
   \begin{itemize}
   \item Add the following thorns to your thornlist
   (file \verb|~/Cactus/thornlists/BadWaves.th|):
   \begin{verbatim}
   CactusConnect/HTTPD
   CactusConnect/HTTPDExtra
   CactusConnect/Socket
   \end{verbatim}
   \item Enable these thorns in your parfile
   (for example, in \verb|~/Cactus/pars/BadWaveAMR.par|):
   \begin{verbatim}
   ActiveThorns = "HTTPD HTTPDExtra Socket"
   \end{verbatim}
   \end{itemize}
\end{frame}

\begin{frame}{Sample HTTPD session}
    \begin{center}
      \only<1>{\includegraphics[width=0.7\textwidth]{httpd_sim.png}}
      \only<2>{\includegraphics[width=0.7\textwidth]{httpd_control.png}}
      \only<3>{\includegraphics[width=0.7\textwidth]{httpd_params.png}}
      \only<4>{\includegraphics[width=0.7\textwidth]{httpd_timers.png}}
    \end{center}
  
\end{frame}

\section{Computation and Live Rendering on GPGPUs}
   \begin{frame}{Motivations}
      \begin{figure}
      \vspace{0.0cm}
      \centering
      \includegraphics[width=0.5\textwidth]{gputrend.png}
      \end{figure}
      \begin{itemize}
      \item General Purpose Graphics Processing Units (GPGPUs) are high-performance 
            graphical processors that can be used to accelerate a wide range of applications.
            (CUDA C Programming Guide Version 3.2)
      \end{itemize}
    \end{frame}
   \begin{frame}{GPU vs. CPU}
      \begin{figure}
      \vspace{0.0cm}
      \centering
      \includegraphics[width=0.9\textwidth]{gpuvscpu.png}
      \end{figure}
      \begin{itemize}
      \item Compared to CPU, GPU devotes more transistors to data processing 
        rather than data caching and flow control (CUDA C Programming Guide Version 3.2)
      \end{itemize}
    \end{frame}
   \begin{frame}{Cactus CUDA Toolkit(under development)}
      \begin{itemize}
      \item MPI + CUDA programming in Cactus is made simple.
      \end{itemize}
      \begin{figure}
      \vspace{0.0cm}
      \centering
      \includegraphics[width=0.95\textwidth]{MPI_CUDA}
      \end{figure}
    \end{frame}
   \begin{frame}{CaCUDAViz}
      \begin{itemize}
      \item The volume rendering of a scalar wave spreading from the center.
            using CUDA on a GPU, while the rendering parameters are steerable 
            at runtime via the Cactus web server.
      \end{itemize}
      \begin{figure}
      \vspace{0.0cm}
      \centering
      \includegraphics[width=0.6\textwidth]{cacudaviz.png}
      \end{figure}
    \end{frame}

