Vous êtes sur la page 1sur 60

Simulation and Scientic 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 specied by the parallel directive
the clause list species 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 ): species 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 specic 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 dened by styles
Offers the output of PDF les, 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 Scientic 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 gures.
Figure: Caption below the gures.
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 gures 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 rst 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 rst 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 rst 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 rst 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

Vous aimerez peut-être aussi