Simulation and Scientific Computing 2

Seminar
Kristina Pickl, Dominik Bartuschat
SS 2012
Chair for System Simulation
Outline
Full Multi-Grid (FMG)
Introduction to Parallel Programming
Distributed vs. Shared Memory
OpenMP
MPI-Message Passing Interface
Introduction to LaTeX Beamer
Some LaTeX Background
The Document Head
Markups
Figures, Tables, and Columns
Spacings
Mathematical Formula
Sequence Control
Source Code in the Presentation
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 2
Full Multi-Grid (FMG)
Finite State Machine
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 4
Introduction to Parallel Programming
Distributed vs. Shared Memory
CPU 0 CPU 1 CPU 2 CPU 3
Memory Memory Memory Memory
CPU 0 CPU 1 CPU 2 CPU 3
Memory
• Hardware
• same program on each processor/machine
• explicit programming required
• Programming
• all variables process-local, no implicit
knowledge of data on other processors
• send/receive messages of suitable library
• Languages
• e.g. MPI
• http://www.mpi-forum.org/
• Hardware
• single program on single machine
• workload distributed among threads
• Programming
• all variables either shared among all
threads or duplicated for each thread
• threads communicate by sharing variables
• Languages
• e.g. OpenMP
• http://www.openmp.org/
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 6
OpenMP Programming Model
• based on the #pragma compiler directives
#pragma omp directive [clause list]
• OpenMP programs execute serially until they encounter parallel
directive
/* serial code segment
#pragma omp parallel [clause list]
{
/* parallel code segment
}
/* rest of serial code segment */
• each thread executes structured block specified by the parallel directive
• the clause list specifies the conditional parallelization, number of
threads and data handling
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 7
Execution Model
Fork-Join Model
master thread
time
fork
join
fork
join
parallel region
parallel region
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 8
Data Handling
• private ( variable list ): indicates that the set of variables is local
to each thread (i.e. each thread has its own copy of each variable in the
list)
• shared ( variable list ): indicates that all variables in the list are
shared across all the threads, i.e., there is only one copy
#include <omp.h>
int main()
{
int i=5; // a shared variable
#pragma omp parallel
{
int c; // a variable private to each thread
c = omp_get_thread_num();
std::cout << "c: " << c << ", i: " << i << std::endl;
}
}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 9
Data Handling
• reduction ( operator list ): specifies how multiple local copies of a
variable are combined into a single copy at the master when threads exit
• possible operators: +, *, -, &, |, &&,
#include <omp.h>
int main()
{
double sum ( 0.0 );
#pragma omp parallel reduction (+: sum)
{
/* compute local sums here */
}
/* sum here contains sum of all local instances of sum */
}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 10
Synchronization Constructs
• #pragma omp barrier
• synchronizes all threads in the team
• #pragma omp single
• only executed by exactly one thread
• all other threads skip this region
• implicit barrier at end of single construct
• #pragma omp master
• only executed by the master thread
• all other threads skip this region
• no implicit barrier associated
• #pragma omp critical
• executed by all threads
• but only one thread at a time
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 11
Runtime Library Functions
• Setting total number of threads
• at runtime: via omp_set_num_threads
#include <omp.h>
void omp_set_num_threads( int num_threads )
• via environment variable OMP_NUM_THREADS
export OMP_NUM_THREADS=4
• getting total number of threads
#include <omp.h>
void omp_get_num_threads( void )
• getting ID of specific thread
#include <omp.h>
void omp_get_thread_num( void )
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 12
MPI Programming Model
• each processor runs a sub-program
• variables of each sub-program have
• the same name
• but different locations and different data
• i.e. all variables are private
• communicate via special send and receive routines
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 13
Hello World
#include <mpi.h>
int main( int argc,char **argv )
{
// Definition of the variables
int size; //The total number of processes
int rank; //The rank/number of this process
// MPI initialization
MPI_Init( &argc, &argv );
// Determining the number of CPUs and the rank for each CPU
MPI_Comm_size( MPI_COMM_WORLD, &size );
MPI_Comm_rank( MPI_COMM_WORLD, &rank );
...
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 14
Hello World
...
// ’Hello World’ output for CPU 0
if( rank == 0 )
std::cout << "Hello World" << std::endl;
// Output of the own rank and size of each CPU
std::cout << "I am CPU " << rank << " of " << size << " CPUs" << std::endl;
// MPI finalizations
MPI_Finalize();
return 0;
}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 15
Blocking Operations
• some operations may block until another process acts:
• synchronous send operation blocks until receive is posted
• receive operation blocks until message is sent
• send buffer may be reused after MPI_Send returns
• MPI call returns after completion of the corresponding send/receive
operation
int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm)
int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Status *status)
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 16
Non-Blocking Operations
• return immediately and allow the sub-program to perform other work
• at some later time the sub-program must test or wait for the completion of
non-blocking operation
• all non-blocking operations must have matching wait (or test) operations
• a non-blocking operation immediately followed by a matching wait is
equivalent to a blocking operation
int MPI_Isend(void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request)
int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Request *request)
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 17
Collective Communications
• Broadcast operation: a one-to-many communication
int MPI_Bcast( void *buffer, int count, MPI_Datatype datatype,
int root, MPI_Comm comm )
• Reduction operation: combine data from several processes to produce
single result
int MPI_Reduce( void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm )
• Barriers: synchronizes processes, blocks until all processes in the
communicator have reached this routine
int MPI_Barrier( MPI_Comm comm )
• Wait: waits for an MPI send or receive to complete
int MPI_Wait ( MPI_Request *request, MPI_Status *status)
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 18
Introduction to LaTeX Beamer
Some LaTeX Background
LaTeX Beamer
• Beamer is a LaTeX class for creating slides for presentations
• Provides all necessary features for presentations
• Visual presentation is defined by styles
• Offers the output of PDF files, handouts, and articles
LaTeX editors (e.g. Kile)
• push PDFLaTeX-button
• push ViewPDF-button
• provides a toolbar for inserting e.g. special characters, formulas
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 20
The Document Head
\documentclass{beamer} % class beamer
\usepackage[T1]{fontenc} % encoding of the Computer Modern TeX text fonts
\usepackage[utf8]{inputenc} % support UTF-8 coding
\usepackage[ngerman,english]{babel} % package for correct formatting of e.g. dates
\usepackage{graphicx} % package for including graphics files
\usepackage{subfigure} % package for using subfigures
\usepackage{listings} % allows to include source code of any programming
% language, provides more features than verbatim
\usepackage{lssbeamer_FAU}
% Title page
\title[SiWiR 2 - Seminar]{Simulation and Scientific Computing 2 \\Seminar}
\author{Kristina Pickl, Dominik Bartuschat}
\date{SS 2012}
\institute{Chair for System Simulation}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 21
Simulation and Scientific Computing 2
Seminar
Kristina Pickl, Dominik Bartuschat
SS 2012
Chair for System Simulation
The Title Page
The title page is very small. All the information has been set before the
actual slide.
\frame[plain,c]{\titlepage}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 23
Outline
Full Multi-Grid (FMG)
Introduction to Parallel Programming
Distributed vs. Shared Memory
OpenMP
MPI-Message Passing Interface
Introduction to LaTeX Beamer
Some LaTeX Background
The Document Head
Markups
Figures, Tables, and Columns
Spacings
Mathematical Formula
Sequence Control
Source Code in the Presentation
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 24
The Outline Page
Structure your LaTeX text using \section and \subsection commands and
use \tableofcontents to automatically display Outline
• Outline of all Sections and Subsections
\frame[squeeze]{\frametitle{Outline}\tableofcontents}
• Outline of current section
\section{LaTeX Beamer}
\begin{frame}\frametitle{Outline}
\tableofcontents[currentsection]
\end{frame}
• Outline of current subsection
\subsection{Markups}
\begin{frame}\frametitle{Outline}
\tableofcontents[currentsubsection]
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 25
Markups
Text Markups
This block contains some possible markups:
• Bold text
• Italic text
• Emphasized text
• Colored text
• Verbatim text
Attention!
Note that for the Verbatim text the frame was declared fragile!
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 26
Markups
\begin{frame}[fragile]\frametitle{Markups}
\begin{block}{Text Markups}
This block contains some possible markups:
\begin{itemize}
\item {\bf Bold text}
\item {\it Italic text}
\item {\em Emphasised text}
\item \textcolor{red}{Colored }\textcolor{blue}{text}
\item \verb|Verbatim text|
\end{itemize}
\end{block}
\begin{block}{Attention!}
Note that for the \verb|Verbatim text| the frame was declared
fragile!
\end{block}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 27
Markups
Font Sizes
This is an example for a really \tiny text.
\scriptsize may be too small for a presentation.
\footnotesize should be the minimum font size.
\small is slightly smaller than the default.
\normalsize is the usual default font size.
\large is obviously pretty large.
\Large is even larger!
If it is still not large enough, use \LARGE
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 28
Markups
\begin{frame}[fragile]\frametitle{Markups}
\begin{block}{Font Sizes}
{\tiny This is an example for a really \verb|\tiny| text.}\\
{\scriptsize \verb|\scriptsize| is too small for a presentation.}\\
{\footnotesize \verb|\footnotesize| is the minimum font size.}\\
{\small \verb|\small| is slightly smaller than the default.}\\
{\normalsize \verb|\normalsize| is the usual default font size.}\\
{\large \verb|\large| is obvioulsy pretty large.}\\
{\Large \verb|\Large| is even larger!}\\
{\LARGE If it is still not large enough, use \verb|\LARGE|}
\end{block}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 29
Markups
Font Sizes
It is also possible to start a font size environment:
This entire paragraph is contained in a \scriptsize environment.
This paragraph on the other hand is contained in a \large environment.
And this one is contained in a \tiny environment and nicely demonstrates that this font size is way too small for the audience!!
Also note: too many different font sizes on one slide are distracting!
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 30
Markups
\begin{frame}[fragile]\frametitle{Markups}
\begin{block}{Font Sizes}
It is also possible to start a font size environment:\\
\begin{scriptsize}
This entire paragraph is contained in a \verb|\scriptsize|
environment.\\
\end{scriptsize}
\begin{large}
This paragraph on the other hand is contained in a
\verb|\large| environement.\\
\end{large}
\begin{tiny}
And this one is contained in a \verb|\tiny| environment
and nicely demonstrates that this font size is way too
small for the audience!!\\
\end{tiny}
\begin{footnotesize}
Also note: too many different font sizes on one slide
are distracting!
\end{footnotesize}
\end{block}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 31
Figures
Images are included via the figure environment. In order to move the
image to the center of the frame, use a center environment.
Figure: Caption above the figures.
Figure: Caption below the figures.
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 32
Figures
\begin{frame}[fragile]\frametitle{The LaTeX Environment}
Images are included via the \verb|figure| environment. In order
to move the image to the center of the frame, use a \verb|center|
environment.
\begin{center}
\begin{figure}
\caption{Caption above the figures.}
\includegraphics[scale=0.2]{pics/pic0}
\caption{Caption below the figures.}
\end{figure}
\end{center}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 33
Multiple Figures
In order to arrange two figures next to each other, you can use the
\subfigure command. Note the different scaling in contrast to the previous
picture.
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 34
Multiple Figures
\begin{frame}[fragile]\frametitle{Multiple Figures}
In order to arrange two figures next to each other, you can
use the \verb|\subfigure| command. Note the different scaling
in contrast to the previous picture.
\begin{center}
\begin{figure}
\subfigure{
\includegraphics[width=.3\textwidth]{pics/pic1}
}
\hspace{1.0cm}
\subfigure{
\includegraphics[width=.3\textwidth]{pics/pic2}
}
\end{figure}
\end{center}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 35
Tables
left center right 5cm paragraph $ 2.50
one and two three 1 2 four $ 1.50
For more information about tables, see
http://latex.computersci.org/Reference/TableEnvironments
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 36
Tables
\begin{frame}\frametitle{Tables}
\begin{block}{}
\begin{tabular}{l|c|r||p{5cm}|r@{.}l}
left & center & right & 5cm paragraph & \$ 2 & 50 \\
\hline
\multicolumn{2}{c|}{one and two} & three 1 \vline{} 2 & four & \$ 1 & 50 \\
\cline{1-2}
\end{tabular}
\end{block}
\begin{block}{}
For more informations about tables, see
\url{http://latex.computersci.org/Reference/TableEnvironments}
\end{block}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 37
Columns
Left Block
Content of the left block
Right Block
Content of the right block
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 38
Columns
\begin{frame}[fragile]\frametitle{Columns}
\begin{columns}
\begin{column}{0.45\textwidth}
\begin{block}{Left Block}
Content of the left block
\begin{figure}
\includegraphics[width=.8\textwidth]{pics/pic1}
\end{figure}
\end{block}
\end{column}
\begin{column}{0.45\textwidth}
\begin{block}{Right Block}
Content of the right block
\begin{figure}
\includegraphics[width=.8\textwidth]{pics/pic2}
\end{figure}
\end{block}
\end{column}
\end{columns}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 39
Spacings
• Use \vspace{...} for a vertical spacing
• Use \hspace{...} for a horizontal spacing
Top left block
Bottom left block
Top right block
Bottom right block
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 40
Spacings
\begin{frame}[fragile]\frametitle{Spacings}
\begin{block}{}
\begin{itemize}
\item Use \verb|\vspace{...}| for a vertical spacing
\item Use \verb|\hspace{...}| for a horizontal spacing
\end{itemize}
\end{block}
\begin{columns}[c]
\begin{column}{0.4\textwidth}
\begin{block}{Top left block}\end{block}
\vspace{1cm}
\begin{block}{Bottom left block}\end{block}
\end{column}
\hspace{1cm}
\begin{column}{0.4\textwidth}
\begin{block}{Top right block}\end{block}
\vspace{2cm}
\begin{block}{Bottom right block}\end{block}
\end{column}
\end{columns}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 41
Mathematical Formula
Formula Environments
The first example is an in-line formula: x = a +b. The next formula is slightly
more complicated and therefore out-of-line:
|

v| =
_
v
2
0
+ v
2
1
+ · · · + v
2
n
For a more sophisticated formula the math environment is used:

N
n=0
g
n
(x) =

N
n=0
g
n
(x) =
_
b
a
f (x) dx =
b
_
a
f (x) dx =
_
d
c
F(z) dz
You can even number the equations in an equation array:
x = a + b (1)
y = a − b
z = a · b (2)
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 42
Mathematical Formula
\begin{frame}[fragile]\frametitle{Mathematical Formula}
\begin{block}{Formula Environments}
The first example is an in-line formula: $x = a + b$. The next formula
is slightly more complicated and therefore out-of-line:
$$ |\vec{v}| = \sqrt{v_0^2 + v_1^2 + \cdots + v_n^2} $$
For a more sophisticated formula the \verb|math| environment is used:
\begin{center}
\begin{math}
\sum_{n=0}^N g_n(x) = \sum\nolimits_{n=0}^N g_n(x)
= \int_a^b f(x) \,\mbox{d}x
= \int\limits_a^b f(x) \,\mbox{d}x
= \oint_c^d F(z) \,\mbox{d}z
\end{math}
\end{center}
You can even number the equations in an equation array:
\begin{eqnarray}
x & = & a + b \\
y & = & a - b \nonumber \\
z & = & a \cdot b
\end{eqnarray}
\end{block}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 43
Mathematical Formula
Automatic Brackets
_
x
2
_
4
= [f (x)]
2
Manual Brackets
Manual brackets are created via the keywords \big, \Big, \bigg, or Bigg:
_
x
2
_
4
=
_
f (x)
_
2
Spacings
xx x xx x x
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 44
Mathematical Formula
\begin{frame}[fragile]\frametitle{Mathematical Formula}
\begin{block}{Automatic Brackets}
\begin{center}
$\left(x^2\right)^4 = \left[f(x)\right]^2$
\end{center}
\end{block}
\begin{block}{Manual Brackets}
Manual brackets are created via the keywords \verb|\big|,
\verb|\Big|, \verb|\bigg|, or \verb|Bigg|:\\
\begin{center}
$\Big(x^2\big)^4 = \Bigg[f(x)\Bigg]^2$
\end{center}
\end{block}
\begin{block}{Spacings}
\begin{center}
$x x \, x \; x \! x \quad x \qquad x$
\end{center}
\end{block}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 45
Mathematical Formula
Text in Formula
a > c follows from a > b and b > c
Matrices
_
_
a
11
a
12
· · · a
1n
.
.
.
.
.
.
.
.
.
.
.
.
a
n1
a
n2
· · · a
nn
_
_
Mathematical Symbols
http://latex.computersci.org/Reference/MathSymbols
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 46
Mathematical Formula
\begin{frame}[fragile]\frametitle{Mathematical Formula}
\begin{block}{Text in Formula}
\begin{center}
$a > c \mbox{ follows from } a > b \mbox{ and } b > c$
\end{center}
\end{block}
\begin{block}{Matrices}
\begin{eqnarray*}
\left( \begin{array}{*{4}{c}}
a_{11} & a_{12} & \cdots & a_{1n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{n1} & a_{n2} & \cdots & a_{nn} \\
\end{array}
\right)
\end{eqnarray*}
\end{block}
\begin{block}{Mathematical Symbols}
\url{http://latex.computersci.org/Reference/MathSymbols}
\end{block}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 47
Sequence Control (1)
First Block
This slide demonstrates some sequence control mechanisms. This block, for
instance, is visible on all slides for this frame.
Second Block
This block however is visible only from the second slide on. It contains an
itemization where every item appears on a new slide.
• First item
• Second item
• Third item
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 48
Sequence Control (1)
First Block
This slide demonstrates some sequence control mechanisms. This block, for
instance, is visible on all slides for this frame.
Second Block
This block however is visible only from the second slide on. It contains an
itemization where every item appears on a new slide.
• First item
• Second item
• Third item
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 48
Sequence Control (1)
First Block
This slide demonstrates some sequence control mechanisms. This block, for
instance, is visible on all slides for this frame.
Second Block
This block however is visible only from the second slide on. It contains an
itemization where every item appears on a new slide.
• First item
• Second item
• Third item
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 48
Sequence Control (1)
First Block
This slide demonstrates some sequence control mechanisms. This block, for
instance, is visible on all slides for this frame.
Second Block
This block however is visible only from the second slide on. It contains an
itemization where every item appears on a new slide.
• First item
• Second item
• Third item
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 48
Sequence Control (1)
\begin{frame}\frametitle{Sequence Control (1)}
\begin{block}{First Block}
This slide demonstrates some sequence control mechanisms.
This block, for instance, is visible on all slides for this
frame.
\end{block}
\pause
\begin{block}{Second Block}
This block however is visible only from the second slide on. It
constains an itemization where every item appears on a new slide.
\begin{itemize}[<+->]
\item First item
\item Second item
\item Third item
\end{itemize}
\end{block}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 49
Sequence Control (2)
First block
This block is visible only on the first and third slide of this frame. On the
second slide, it is replaced by the second block. Good thing is, it needs no
space while it is invisible!
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 50
Sequence Control (2)
Second block
This block replaces the first one, so this one is visible on the second slide of
this frame.
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 50
Sequence Control (2)
First block
This block is visible only on the first and third slide of this frame. On the
second slide, it is replaced by the second block. Good thing is, it needs no
space while it is invisible!
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 50
Sequence Control (2)
\begin{frame}\frametitle{Sequence Control (2)}
\only<1,3> {
\begin{block}{First block}
\vspace{0.3cm}
This block is visible only on the first and third slide of
this frame. On the second slide, it is replaced by the second
block. Good thing is, it needs no space while it is invisible!
\vspace{0.3cm}
\end{block}
}
\only<2> {
\begin{block}{Second block}
\vspace{0.3cm}
This block replaces the first one, so this one is visible on
the second slide of this frame.
\vspace{0.3cm}
\end{block}
}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 51
Source Code in the Presentation
C++ example
using namespace std;
typedef istream_iterator<string> in;
typedef ostream_iterator<string> out;
vector<string> source( in(cin), in() );
sort( source.begin(), source.end() );
copy( source.begin(), source.end(), out( cout, "\n" ) );
Attention!
Note that for the source code the frame was declared fragile!
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 52
Source Code in the Presentation
\begin{frame}[fragile]\frametitle{Source Code in the Presentation}
\begin{block}{C++ example}
\begin{verbatim}
using namespace std;
typedef istream_iterator<string> in;
typedef ostream_iterator<string> out;
vector<string> source( in(cin), in() );
sort( source.begin(), source.end() );
copy( source.begin(), source.end(), out( cout, "\n" ) );
\end{verbatim }
\end{block}
\begin{block}{Attention!}
Note that for the \verb|source code| the frame was declared
fragile!
\end{block}
\end{frame}
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 53
Thank you for your attention!
References
• Parallel Programming References
• MPI:
• http://www.mpi-forum.org/
• http://www10.informatik.uni-erlangen.de/Teaching/Courses/WS2011/
SiWiR/exerciseSheets/ex03/MPI-Slides.pdf
• OpenMP:
• http://www.openmp.org/
• https://computing.llnl.gov/tutorials/openMP/
• http://www10.informatik.uni-erlangen.de/Teaching/Courses/WS2011/
SiWiR/exerciseSheets/ex02/RBGS_OpenMP.pdf
• LaTeX References
• LaTeX Beamer reference (German):
http://mo.mathematik.uni-stuttgart.de/kurse/kurs44/
• LaTeX reference (English):
http://latex.computersci.org/Reference/Reference
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 55

Outline
Full Multi-Grid (FMG) Introduction to Parallel Programming Distributed vs. Shared Memory OpenMP MPI-Message Passing Interface Introduction to LaTeX Beamer Some LaTeX Background The Document Head Markups Figures, Tables, and Columns Spacings Mathematical Formula Sequence Control Source Code in the Presentation
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 2

Full Multi-Grid (FMG)

Seminar 4 .Finite State Machine SS 2012 | Kristina Pickl. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .

Introduction to Parallel Programming .

mpi-forum.Distributed vs. no implicit knowledge of data on other processors • send/receive messages of suitable library • Hardware • single program on single machine • workload distributed among threads • Programming • all variables either shared among all threads or duplicated for each thread • threads communicate by sharing variables • Languages • e. Dominik Bartuschat | Chair for System Simulation • Languages • e. Shared Memory CPU 0 CPU 1 CPU 2 CPU 3 CPU 0 CPU 1 CPU 2 CPU 3 Memory Memory Memory Memory Memory • Hardware • same program on each processor/machine • explicit programming required • Programming • all variables process-local.g.org/ SS 2012 | Kristina Pickl.openmp.org/ | SiWiR 2 . MPI • http://www.g. OpenMP • http://www.Seminar 6 .

Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .OpenMP Programming Model • based on the #pragma compiler directives #pragma omp directive [clause list] • OpenMP programs execute serially until they encounter parallel directive /* serial code segment #pragma omp parallel [clause list] { /* parallel code segment } /* rest of serial code segment */ • each thread executes structured block specified by the parallel directive • the clause list specifies the conditional parallelization.Seminar 7 . number of threads and data handling SS 2012 | Kristina Pickl.

Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Execution Model Fork-Join Model master thread fork parallel region time join fork parallel region join SS 2012 | Kristina Pickl.Seminar 8 .

each thread has its own copy of each variable in the list) • shared ( variable list ): indicates that all variables in the list are shared across all the threads. // a shared variable #pragma omp parallel { int c. i: " << i << std::endl.. } } SS 2012 | Kristina Pickl.e. std::cout << "c: " << c << ".h> int main() { int i=5. // a variable private to each thread c = omp_get_thread_num().Seminar 9 . i. there is only one copy #include <omp.e. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Data Handling • private ( variable list ): indicates that the set of variables is local to each thread (i.

Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Data Handling • reduction ( operator list ): specifies how multiple local copies of a variable are combined into a single copy at the master when threads exit • possible operators: +.Seminar 10 . &&.h> int main() { double sum ( 0. |. &. #include <omp. -. *. #pragma omp parallel reduction (+: sum) { /* compute local sums here */ } /* sum here contains sum of all local instances of sum */ } SS 2012 | Kristina Pickl.0 ).

Synchronization Constructs • #pragma omp barrier • synchronizes all threads in the team • #pragma omp single • only executed by exactly one thread • all other threads skip this region • implicit barrier at end of single construct • #pragma omp master • only executed by the master thread • all other threads skip this region • no implicit barrier associated • #pragma omp critical • executed by all threads • but only one thread at a time SS 2012 | Kristina Pickl.Seminar 11 . Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .

Seminar 12 .h> void omp_set_num_threads( int num_threads ) • via environment variable OMP_NUM_THREADS export OMP_NUM_THREADS=4 • getting total number of threads #include <omp.Runtime Library Functions • Setting total number of threads • at runtime: via omp_set_num_threads #include <omp. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .h> void omp_get_num_threads( void ) • getting ID of specific thread #include <omp.h> void omp_get_thread_num( void ) SS 2012 | Kristina Pickl.

MPI Programming Model • each processor runs a sub-program • variables of each sub-program have • the same name • but different locations and different data • i. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 . all variables are private • communicate via special send and receive routines SS 2012 | Kristina Pickl.Seminar 13 .e.

//The rank/number of this process // MPI initialization MPI_Init( &argc.. .char **argv ) { // Definition of the variables int size.h> int main( int argc. //The total number of processes int rank. MPI_Comm_rank( MPI_COMM_WORLD. SS 2012 | Kristina Pickl. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Hello World #include <mpi. &size ).. &rank ).Seminar 14 . &argv ). // Determining the number of CPUs and the rank for each CPU MPI_Comm_size( MPI_COMM_WORLD.

// MPI finalizations MPI_Finalize(). // Output of the own rank and size of each CPU std::cout << "I am CPU " << rank << " of " << size << " CPUs" << std::endl. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 ...Hello World . return 0. // ’Hello World’ output for CPU 0 if( rank == 0 ) std::cout << "Hello World" << std::endl.Seminar 15 . } SS 2012 | Kristina Pickl.

MPI_Status *status) SS 2012 | Kristina Pickl. MPI_Datatype datatype. int tag. int source.Seminar 16 .Blocking Operations • some operations may block until another process acts: • synchronous send operation blocks until receive is posted • receive operation blocks until message is sent • send buffer may be reused after MPI_Send returns • MPI call returns after completion of the corresponding send/receive operation int MPI_Send(void *buf. int count. int count. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 . int dest. MPI_Datatype datatype. int tag. MPI_Comm comm. MPI_Comm comm) int MPI_Recv(void *buf.

Non-Blocking Operations
• return immediately and allow the sub-program to perform other work • at some later time the sub-program must test or wait for the completion of
non-blocking operation • all non-blocking operations must have matching wait (or test) operations • a non-blocking operation immediately followed by a matching wait is equivalent to a blocking operation
int MPI_Isend(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request)

SS 2012

|

Kristina Pickl, Dominik Bartuschat

|

Chair for System Simulation

|

SiWiR 2 - Seminar

17

Collective Communications
• Broadcast operation: a one-to-many communication
int MPI_Bcast( void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm )

• Reduction operation: combine data from several processes to produce
single result
int MPI_Reduce( void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm )

• Barriers: synchronizes processes, blocks until all processes in the
communicator have reached this routine
int MPI_Barrier( MPI_Comm comm )

• Wait: waits for an MPI send or receive to complete
int MPI_Wait ( MPI_Request *request, MPI_Status *status)
SS 2012 | Kristina Pickl, Dominik Bartuschat | Chair for System Simulation | SiWiR 2 - Seminar 18

Introduction to LaTeX Beamer

and articles LaTeX editors (e.Some LaTeX Background LaTeX Beamer • Beamer is a LaTeX class for creating slides for presentations • Provides all necessary features for presentations • Visual presentation is defined by styles • Offers the output of PDF files. special characters. handouts. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 . Kile) • push PDFLaTeX-button • push ViewPDF-button • provides a toolbar for inserting e.g.Seminar 20 . formulas SS 2012 | Kristina Pickl.g.

Dominik Bartuschat | Chair for System Simulation | SiWiR 2 . provides more features than verbatim \usepackage{lssbeamer_FAU} % Title page \title[SiWiR 2 . dates package for including graphics files package for using subfigures allows to include source code of any programming language.english]{babel} \usepackage{graphicx} \usepackage{subfigure} \usepackage{listings} % % % % % % % encoding of the Computer Modern TeX text fonts support UTF-8 coding package for correct formatting of e.Seminar]{Simulation and Scientific Computing 2 \\Seminar} \author{Kristina Pickl. Dominik Bartuschat} \date{SS 2012} \institute{Chair for System Simulation} SS 2012 | Kristina Pickl.Seminar 21 .The Document Head \documentclass{beamer} % class beamer \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[ngerman.g.

Dominik Bartuschat SS 2012 Chair for System Simulation .Simulation and Scientific Computing 2 Seminar Kristina Pickl.

\frame[plain.c]{\titlepage} SS 2012 | Kristina Pickl. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 . All the information has been set before the actual slide.The Title Page The title page is very small.Seminar 23 .

Seminar 24 . and Columns Spacings Mathematical Formula Sequence Control Source Code in the Presentation SS 2012 | Kristina Pickl. Shared Memory OpenMP MPI-Message Passing Interface Introduction to LaTeX Beamer Some LaTeX Background The Document Head Markups Figures. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 . Tables.Outline Full Multi-Grid (FMG) Introduction to Parallel Programming Distributed vs.

The Outline Page Structure your LaTeX text using \section and \subsection commands and use \tableofcontents to automatically display Outline • Outline of all Sections and Subsections \frame[squeeze]{\frametitle{Outline}\tableofcontents} • Outline of current section \section{LaTeX Beamer} \begin{frame}\frametitle{Outline} \tableofcontents[currentsection] \end{frame} • Outline of current subsection \subsection{Markups} \begin{frame}\frametitle{Outline} \tableofcontents[currentsubsection] \end{frame} SS 2012 | Kristina Pickl.Seminar 25 . Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .

Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Markups Text Markups This block contains some possible markups: • Bold text • Italic text • Emphasized text • Colored text • Verbatim text Attention! Note that for the Verbatim text the frame was declared fragile! SS 2012 | Kristina Pickl.Seminar 26 .

Markups \begin{frame}[fragile]\frametitle{Markups} \begin{block}{Text Markups} This block contains some possible markups: \begin{itemize} \item {\bf Bold text} \item {\it Italic text} \item {\em Emphasised text} \item \textcolor{red}{Colored }\textcolor{blue}{text} \item \verb|Verbatim text| \end{itemize} \end{block} \begin{block}{Attention!} Note that for the \verb|Verbatim text| the frame was declared fragile! \end{block} \end{frame} SS 2012 | Kristina Pickl. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Seminar 27 .

\scriptsize may be too small for a presentation.Markups Font Sizes This is an example for a really \tiny text. \Large is even larger! If it is still not large enough. use \LARGE SS 2012 | Kristina Pickl. \normalsize is the usual default font size. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Seminar 28 . \large is obviously pretty large. \small is slightly smaller than the default. \footnotesize should be the minimum font size.

use \verb|\LARGE|} \end{block} \end{frame} SS 2012 | Kristina Pickl.}\\ {\scriptsize \verb|\scriptsize| is too small for a presentation.}\\ {\small \verb|\small| is slightly smaller than the default.Markups \begin{frame}[fragile]\frametitle{Markups} \begin{block}{Font Sizes} {\tiny This is an example for a really \verb|\tiny| text.}\\ {\normalsize \verb|\normalsize| is the usual default font size.Seminar 29 .}\\ {\Large \verb|\Large| is even larger!}\\ {\LARGE If it is still not large enough.}\\ {\large \verb|\large| is obvioulsy pretty large.}\\ {\footnotesize \verb|\footnotesize| is the minimum font size. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .

Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Seminar 30 . And this one is contained in a \tiny environment and nicely demonstrates that this font size is way too small for the audience!! Also note: too many different font sizes on one slide are distracting! SS 2012 | Kristina Pickl.Markups Font Sizes It is also possible to start a font size environment: This entire paragraph is contained in a \scriptsize environment. This paragraph on the other hand is contained in a \large environment.

Markups \begin{frame}[fragile]\frametitle{Markups} \begin{block}{Font Sizes} It is also possible to start a font size environment:\\ \begin{scriptsize} This entire paragraph is contained in a \verb|\scriptsize| environment.Seminar 31 .\\ \end{scriptsize} \begin{large} This paragraph on the other hand is contained in a \verb|\large| environement.\\ \end{large} \begin{tiny} And this one is contained in a \verb|\tiny| environment and nicely demonstrates that this font size is way too small for the audience!!\\ \end{tiny} \begin{footnotesize} Also note: too many different font sizes on one slide are distracting! \end{footnotesize} \end{block} \end{frame} SS 2012 | Kristina Pickl. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .

Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Seminar 32 . use a center environment. Figure: Caption above the figures. Figure: Caption below the figures. SS 2012 | Kristina Pickl. In order to move the image to the center of the frame.Figures Images are included via the figure environment.

Figures \begin{frame}[fragile]\frametitle{The LaTeX Environment} Images are included via the \verb|figure| environment.Seminar 33 . In order to move the image to the center of the frame.} \end{figure} \end{center} \end{frame} SS 2012 | Kristina Pickl. use a \verb|center| environment. \begin{center} \begin{figure} \caption{Caption above the figures.2]{pics/pic0} \caption{Caption below the figures.} \includegraphics[scale=0. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .

Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Seminar 34 . you can use the \subfigure command.Multiple Figures In order to arrange two figures next to each other. Note the different scaling in contrast to the previous picture. SS 2012 | Kristina Pickl.

Note the different scaling in contrast to the previous picture. \begin{center} \begin{figure} \subfigure{ \includegraphics[width=.0cm} \subfigure{ \includegraphics[width=.3\textwidth]{pics/pic1} } \hspace{1.3\textwidth]{pics/pic2} } \end{figure} \end{center} \end{frame} SS 2012 | Kristina Pickl. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 . you can use the \verb|\subfigure| command.Multiple Figures \begin{frame}[fragile]\frametitle{Multiple Figures} In order to arrange two figures next to each other.Seminar 35 .

computersci.Tables left center right 5cm paragraph one and two three 1 2 four $ 2.Seminar 36 .50 For more information about tables. see http://latex.50 $ 1. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .org/Reference/TableEnvironments SS 2012 | Kristina Pickl.

org/Reference/TableEnvironments} \end{block} \end{frame} SS 2012 | Kristina Pickl.Tables \begin{frame}\frametitle{Tables} \begin{block}{} \begin{tabular}{l|c|r||p{5cm}|r@{.}l} left & center & right & 5cm paragraph & \$ 2 & 50 \\ \hline \multicolumn{2}{c|}{one and two} & three 1 \vline{} 2 & four & \$ 1 & 50 \\ \cline{1-2} \end{tabular} \end{block} \begin{block}{} For more informations about tables.computersci. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Seminar 37 . see \url{http://latex.

Columns Left Block Content of the left block Right Block Content of the right block SS 2012 | Kristina Pickl.Seminar 38 . Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .

Columns \begin{frame}[fragile]\frametitle{Columns} \begin{columns} \begin{column}{0.8\textwidth]{pics/pic2} \end{figure} \end{block} \end{column} \end{columns} \end{frame} SS 2012 | Kristina Pickl. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Seminar 39 .45\textwidth} \begin{block}{Right Block} Content of the right block \begin{figure} \includegraphics[width=.8\textwidth]{pics/pic1} \end{figure} \end{block} \end{column} \begin{column}{0.45\textwidth} \begin{block}{Left Block} Content of the left block \begin{figure} \includegraphics[width=.

.Seminar 40 .} for a horizontal spacing Top left block Top right block Bottom left block Bottom right block SS 2012 | Kristina Pickl.} for a vertical spacing • Use \hspace{..Spacings • Use \vspace{. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 ...

Spacings \begin{frame}[fragile]\frametitle{Spacings} \begin{block}{} \begin{itemize} \item Use \verb|\vspace{.4\textwidth} \begin{block}{Top right block}\end{block} \vspace{2cm} \begin{block}{Bottom right block}\end{block} \end{column} \end{columns} \end{frame} SS 2012 | Kristina Pickl.}| for a horizontal spacing \end{itemize} \end{block} \begin{columns}[c] \begin{column}{0.Seminar 41 .. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 ...4\textwidth} \begin{block}{Top left block}\end{block} \vspace{1cm} \begin{block}{Bottom left block}\end{block} \end{column} \hspace{1cm} \begin{column}{0.}| for a vertical spacing \item Use \verb|\hspace{..

Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Seminar (1) (2) 42 .Mathematical Formula Formula Environments The first example is an in-line formula: x = a + b. The next formula is slightly more complicated and therefore out-of-line: |v | = 2 2 2 v0 + v1 + · · · + vn For a more sophisticated formula the math environment is used: N n=0 gn (x ) = N n=0 gn (x ) = b a b f (x ) dx = a f (x ) dx = d c F (z ) dz You can even number the equations in an equation array: x = a+b y = a−b z = a·b SS 2012 | Kristina Pickl.

Mathematical Formula \begin{frame}[fragile]\frametitle{Mathematical Formula} \begin{block}{Formula Environments} The first example is an in-line formula: $x = a + b$.Seminar 43 .\mbox{d}x = \oint_c^d F(z) \.\mbox{d}x = \int\limits_a^b f(x) \. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .b \nonumber \\ z & = & a \cdot b \end{eqnarray} \end{block} \end{frame} SS 2012 | Kristina Pickl.\mbox{d}z \end{math} \end{center} You can even number the equations in an equation array: \begin{eqnarray} x & = & a + b \\ y & = & a . The next formula is slightly more complicated and therefore out-of-line: $$ |\vec{v}| = \sqrt{v_0^2 + v_1^2 + \cdots + v_n^2} $$ For a more sophisticated formula the \verb|math| environment is used: \begin{center} \begin{math} \sum_{n=0}^N g_n(x) = \sum\nolimits_{n=0}^N g_n(x) = \int_a^b f(x) \.

\Big. \bigg.Mathematical Formula Automatic Brackets x2 4 = [f (x )]2 Manual Brackets Manual brackets are created via the keywords \big. or Bigg: 2 x2 4 = f (x ) Spacings xx x xx x x SS 2012 | Kristina Pickl.Seminar 44 . Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .

Seminar 45 . x \! x \quad x \qquad x$ \end{center} \end{block} \end{frame} SS 2012 | Kristina Pickl.Mathematical Formula \begin{frame}[fragile]\frametitle{Mathematical Formula} \begin{block}{Automatic Brackets} \begin{center} $\left(x^2\right)^4 = \left[f(x)\right]^2$ \end{center} \end{block} \begin{block}{Manual Brackets} Manual brackets are created via the keywords \verb|\big|. or \verb|Bigg|:\\ \begin{center} $\Big(x^2\big)^4 = \Bigg[f(x)\Bigg]^2$ \end{center} \end{block} \begin{block}{Spacings} \begin{center} $x x \. \verb|\Big|. x \. \verb|\bigg|. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .

. .org/Reference/MathSymbols SS 2012 | Kristina Pickl.computersci. . an1 an2 · · · ann Mathematical Symbols  http://latex.  . . Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Seminar 46 .. .Mathematical Formula Text in Formula a > c follows from a > b and b > c Matrices  a11 a12 · · · a1n . .  .. .

org/Reference/MathSymbols} \end{block} \end{frame} SS 2012 | Kristina Pickl. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Seminar 47 .Mathematical Formula \begin{frame}[fragile]\frametitle{Mathematical Formula} \begin{block}{Text in Formula} \begin{center} $a > c \mbox{ follows from } a > b \mbox{ and } b > c$ \end{center} \end{block} \begin{block}{Matrices} \begin{eqnarray*} \left( \begin{array}{*{4}{c}} a_{11} & a_{12} & \cdots & a_{1n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{n1} & a_{n2} & \cdots & a_{nn} \\ \end{array} \right) \end{eqnarray*} \end{block} \begin{block}{Mathematical Symbols} \url{http://latex.computersci.

This block. SS 2012 | Kristina Pickl.Sequence Control (1) First Block This slide demonstrates some sequence control mechanisms. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 . is visible on all slides for this frame. for instance.Seminar 48 .

It contains an itemization where every item appears on a new slide.Sequence Control (1) First Block This slide demonstrates some sequence control mechanisms. Second Block This block however is visible only from the second slide on. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 . This block. for instance.Seminar 48 . is visible on all slides for this frame. • First item SS 2012 | Kristina Pickl.

This block.Sequence Control (1) First Block This slide demonstrates some sequence control mechanisms. It contains an itemization where every item appears on a new slide. Second Block This block however is visible only from the second slide on. • First item • Second item SS 2012 | Kristina Pickl.Seminar 48 . for instance. is visible on all slides for this frame. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .

Seminar 48 . • First item • Second item • Third item SS 2012 | Kristina Pickl. is visible on all slides for this frame. It contains an itemization where every item appears on a new slide. for instance. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 . Second Block This block however is visible only from the second slide on. This block.Sequence Control (1) First Block This slide demonstrates some sequence control mechanisms.

\begin{itemize}[<+->] \item First item \item Second item \item Third item \end{itemize} \end{block} \end{frame} SS 2012 | Kristina Pickl. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .Sequence Control (1) \begin{frame}\frametitle{Sequence Control (1)} \begin{block}{First Block} This slide demonstrates some sequence control mechanisms. It constains an itemization where every item appears on a new slide. for instance. is visible on all slides for this frame. \end{block} \pause \begin{block}{Second Block} This block however is visible only from the second slide on. This block.Seminar 49 .

Dominik Bartuschat | Chair for System Simulation | SiWiR 2 . Good thing is.Sequence Control (2) First block This block is visible only on the first and third slide of this frame. On the second slide. it needs no space while it is invisible! SS 2012 | Kristina Pickl.Seminar 50 . it is replaced by the second block.

Dominik Bartuschat | Chair for System Simulation | SiWiR 2 . SS 2012 | Kristina Pickl.Seminar 50 .Sequence Control (2) Second block This block replaces the first one. so this one is visible on the second slide of this frame.

it is replaced by the second block. On the second slide.Sequence Control (2) First block This block is visible only on the first and third slide of this frame. Good thing is. it needs no space while it is invisible! SS 2012 | Kristina Pickl.Seminar 50 . Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .

Seminar 51 . Good thing is. it is replaced by the second block.3> { \begin{block}{First block} \vspace{0.Sequence Control (2) \begin{frame}\frametitle{Sequence Control (2)} \only<1. On the second slide. it needs no space while it is invisible! \vspace{0.3cm} \end{block} } \only<2> { \begin{block}{Second block} \vspace{0. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .3cm} This block replaces the first one.3cm} \end{block} } \end{frame} SS 2012 | Kristina Pickl.3cm} This block is visible only on the first and third slide of this frame. \vspace{0. so this one is visible on the second slide of this frame.

Source Code in the Presentation C++ example using namespace std. out( cout. source. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 . in() ). vector<string> source( in(cin).Seminar 52 . sort( source. source.end() ).begin(). copy( source. typedef istream_iterator<string> in.begin(). Attention! Note that for the source code the frame was declared fragile! SS 2012 | Kristina Pickl.end(). typedef ostream_iterator<string> out. "\n" ) ).

vector<string> source( in(cin). "\n" ) ). in() ).end().Source Code in the Presentation \begin{frame}[fragile]\frametitle{Source Code in the Presentation} \begin{block}{C++ example} \begin{verbatim} using namespace std. source. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .end() ). typedef istream_iterator<string> typedef ostream_iterator<string> in. copy( source.begin(). out( cout. source.begin(). sort( source. out.Seminar 53 . \end{verbatim } \end{block} \begin{block}{Attention!} Note that for the \verb|source code| the frame was declared fragile! \end{block} \end{frame} SS 2012 | Kristina Pickl.

Thank you for your attention! .

pdf • OpenMP: • http://www.computersci.uni-erlangen.pdf • LaTeX References • LaTeX Beamer reference (German): http://mo.mpi-forum.uni-stuttgart.mathematik.gov/tutorials/openMP/ • http://www10.org/ • http://www10.de/Teaching/Courses/WS2011/ SiWiR/exerciseSheets/ex03/MPI-Slides.org/Reference/Reference SS 2012 | Kristina Pickl.References • Parallel Programming References • MPI: • http://www.openmp.uni-erlangen.informatik.org/ • https://computing.de/kurse/kurs44/ • LaTeX reference (English): http://latex.informatik. Dominik Bartuschat | Chair for System Simulation | SiWiR 2 .de/Teaching/Courses/WS2011/ SiWiR/exerciseSheets/ex02/RBGS_OpenMP.Seminar 55 .llnl.