\documentclass[english,serif,mathserif,xcolor=pdftex,dvipsnames,table]{beamer}
\usepackage{lsci}

\title[AppPot]{%
  Introduction to AppPot, II
}
\author[R. Murri]{%
  \textbf{Riccardo Murri} \\
  Grid Computing Competence Center, \\
  Organisch-Chemisches Institut, \\
  University of Zurich
}
\date{Dec.~15,~2011}

% for typesetting "C++", see
% http://stackoverflow.com/questions/2724760/how-to-write-c-in-latex
\usepackage{relsize}
\newcommand\ifmonospace{%
  \ifdim\fontdimen3\font=0pt%
}
\newcommand\Cpp{%
  \ifmonospace%
  C++%
  \else%
  C\kern-.0667em\raise.20ex\hbox{\relsize{-2}{++}}%
  \fi%
  \spacefactor1000%
}


\begin{document}

% title frame
\maketitle


\section{Introduction}

\begin{frame}
  \frametitle{Today's class}
  
  How to submit and control AppPot execution over ARC.

  \+
  Benchmarking code running in AppPot.

  \+
  {\small These slides are available for download from: 
    \url{http://www.gc3.uzh.ch/teaching/lsci2011/lab12.pdf}}

  \+
  (You might want to have slides from the past lab session ready
  for reference on how to use AppPot.)
\end{frame}

% use `ocikbgtw` (need good bandwidth)


\begin{frame}[fragile]
  For the ARC submission exercises we shall work from the
  \texttt{ocikbgtw.uzh.ch} machine, to have larger bandwidth.

  \+
  \emph{1.} Log in to \texttt{ocikbgtw.uzh.ch}

  \+
  \emph{2.} Change to the \texttt{lab12} directory.  You should have
  the needed files already copied in there:
\begin{semiverbatim}\tiny
\$ \textbf{cd lab12}
\$ \textbf{ls -l}
total 2179788
-rw-r--r-- 1 murri murri 2147483648 Dec 15 12:32 apppot0.26-32bit.disk.img
-rwxr-xr-x 1 murri murri   82429409 Dec 15 12:32 kernel32-2.6.39.4
\end{semiverbatim}

  \emph{3.} Check that you can run AppPot by starting it in
  interactive mode:
\begin{semiverbatim}\tiny
\$ \textbf{apppot-start} --linux kernel32-2.6.39.4 --apppotapppot0.26-32bit.disk.img
\end{semiverbatim}

\end{frame}


\section{Running AppPot on a Grid}

% exercise: write an xRSL to run "hello, world" in AppPot
\begin{frame}
  \frametitle{AppPot as a Grid job}
  An AppPot VM runs as a regular Linux process.

  \+
  So it can be sent over ARC to a cluster for execution.

  \+
  \begin{exercise}
    Write an xRSL file to run an AppPot appliance on cluster
    \emph{idgc3grid01} and execute the command \texttt{cat
      /proc/cpuinfo}.  Execute it and get the output back.
    How long does it take to \emph{submit} the job?  
    How long does it take to retrieve the output once the job is done?
  \end{exercise}

  \+
  \begin{exercise}
    Modify the xRSL file from the previous exercise to run the command
    \texttt{date} within AppPot.  Based on the output you get, can you
    determine how much time takes an AppPot applicance to start?
  \end{exercise}
\end{frame}

% exercise: install CODEML in AppPot (locally) and run it on a test file over ARC (remotely)
\begin{frame}[fragile]
  \frametitle{The ``changes'' mechanism}
  AppPot supports a ``changes'' mechanism to send only the
  differences with a base over the network.  

  \+
  The changes are merged at the execution site with a ``base'' image
  that is already deployed.

  \+
  To create a snapshot of the changes, use this command:
\begin{semiverbatim}
\$ sudo \textbf{apppot-snap changes}
\end{semiverbatim}
  This saves the changes into file: \texttt{/home/user/job/apppot-changes.tar.gz}

  \+
  If a file with the name \texttt{apppot-changes.tar.gz} is present in
  the directory where \texttt{apppot-start} is run, it will be extracted
  in the root AppPot VM filesystem.
\end{frame}


\begin{frame}[fragile]
  \frametitle{ARC Run-Time Environments}
  ARC supports \emph{Run-Time Environments} (RTE), which are tags
  specifying what software is installed/supported at a site.

  \+
  A job can request a particular RTE by including in the xRSL
  description a line like the one below.
\begin{semiverbatim}
(runTimeEnvironment="\emph{RTE/NAME}")
\end{semiverbatim}

  \+
  The RTE name for this current version of AppPot is: \texttt{ENV/APPPOT32BIT-0.26}
\end{frame}


\begin{frame}
  \frametitle{Submitting a ``changes'' file.}
  \begin{exercise}
    \begin{enumerate}[\sl (a)]
    \item Install
      \href{http://wiki.isb-sib.ch/grid-selectome/Codeml_Requirements_Form#Installation_instructions}{CODEML}
      (see previous lab slides) into your local copy of AppPot.
    \item 
      Create a snapshot of the AppPot with CODEML installed in file
      \texttt{apppot-changes.tar.gz}
    \item 
      Write an xRSL job description to send an AppPot job and run
      CODEML on the test data.  The xRSL shall \emph{not} transfer the
      whole VM disk image, but just the ``changes'' file.
    \item 
      How much time does the job submission take now?  And how much
      time does the VM startup phase take?
    \end{enumerate}
  \end{exercise}
\end{frame}


\section{Benchmarking AppPot}

% Benchmarks:
% - codeml (CPU-bound)
% - Rheinfall (memory-bound)
% - compilation (disk-bound)

\begin{frame}
  \frametitle{Benchmark: CPU-bound code}
  \begin{exercise}
    Install CODEML on your local machine, then time its execution on
    the sample test data:
    \begin{enumerate}[\sl (a)]
    \item Directly (from your laptop's shell prompt).
    \item In the AppPot VM.
    \end{enumerate}
    What's the performance hit of running within AppPot?
    
    \+
    (You probably want to have at least three runs of each and take
    the minimum of the three, to minimize impact of jitter.)
  \end{exercise}
\end{frame}


\begin{frame}
  \frametitle{Benchmark: I/O-bound code}
  \begin{exercise}
    Use the compilation of CODEML as a \emph{rough} estimator of disk
    I/O performance.

    \+
    Time the execution of CODEML's \texttt{make clean; make} 
    compilation cycle:
    \begin{enumerate}[{\sl (a)}]
    \item directly from your laptop's shell prompt.
    \item in the AppPot VM.
    \end{enumerate}
    What's the performance hit of running within AppPot?
    
    \+
    (You probably want to have at least three runs of each and take
    the minimum of the three, to minimize impact of jitter.)
  \end{exercise}
\end{frame}


\begin{frame}
  \frametitle{Benchmark: memory-bound code}
  \begin{exercise}
    Use the Gaussian Elimination program \texttt{rank-int.i386} to
    measure how much memory allocation impacts AppPot/UML performance.

    \+
    Run the command \texttt{rank-int.i386 M0,6-D7.sms}
    \begin{enumerate}[{\sl (a)}]
    \item directly from your laptop's shell prompt.
    \item in the AppPot VM.
    \end{enumerate}
    What's the performance hit of running within AppPot?
    
    \+
    (You probably want to have at least three runs of each and take
    the minimum of the three, to minimize impact of jitter.)
  \end{exercise}
\end{frame}


\section{The End}

\begin{frame}
  \frametitle{More stuff}
  \begin{center}
    AppPot home page: \href{http://AppPot.googlecode.com}{http://AppPot.googlecode.com}

    \+
    Source code: \texttt{svn co http://AppPot.googlecode.com/svn}
    
    \+
    e-mail: \texttt{riccardo.murri@gmail.com}, \texttt{sergio.maffioletti@gc3.uzh.ch}
  \end{center}
\end{frame}


\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

