thesis version

This commit is contained in:
Alexis Pereda 2021-07-19 14:59:37 +02:00
commit 655faa15f2
150 changed files with 9593 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build/

78
CMakeLists.txt Normal file
View File

@ -0,0 +1,78 @@
cmake_minimum_required(VERSION 3.1)
project(defense)
set(LATEX_COMPILER_FLAGS "-interaction=batchmode -file-line-error -shell-escape"
CACHE STRING "Flags passed to latex.")
include(UseLATEX.cmake)
# Global
set(LATEX_USE_SYNCTEX ON)
set(imgdir img)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pdf)
# Functions
macro(subdirlist result curdir)
file(GLOB children RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${curdir}/*)
foreach(child ${children})
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${child})
subdirlist(${result} ${child})
list(APPEND ${result} ${child})
endif()
endforeach()
endmacro()
set(imgdirs ${imgdir})
subdirlist(imgdirs ${imgdir})
# Document
set(modes default notes)
set(srcdir src)
set(stydir sty)
file(GLOB_RECURSE src RELATIVE ${CMAKE_SOURCE_DIR} ${srcdir}/*.tex)
file(GLOB_RECURSE bib RELATIVE ${CMAKE_SOURCE_DIR} ${srcdir}/*.bib)
file(GLOB_RECURSE sty RELATIVE ${CMAKE_SOURCE_DIR} ${stydir}/*.sty)
set(other_in raw/cpplogo.pdf_tex raw/cpplogo.pdf)
set(latex_document_options)
set(custom_command_options ALL)
foreach(mode ${modes})
set(maintex main_${mode})
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_CURRENT_BINARY_DIR}/${srcdir}/${maintex}.tex
${CMAKE_CURRENT_BINARY_DIR}/${maintex}.tex
)
add_latex_document(
${srcdir}/main_${mode}.tex
INPUTS ${src} ${lst} ${sty} ${other_in}
# BIBFILES ${bib}
IMAGE_DIRS ${imgdirs}
# USE_BIBLATEX
# USE_GLOSSARY
${latex_document_options}
)
if(NOT ${mode} STREQUAL genfigures)
set(synctex_file ${CMAKE_PROJECT_NAME}_${mode}.synctex.gz)
add_custom_target(pdf_${synctex_file} ${custom_command_options}
DEPENDS ${maintex}.pdf
COMMAND ${CMAKE_COMMAND} -E copy ${maintex}.synctex.gz pdf/${synctex_file}
)
set(pdf_file ${CMAKE_PROJECT_NAME}_${mode}.pdf)
add_custom_target(pdf_${pdf_file} ${custom_command_options}
DEPENDS ${maintex}.pdf
COMMAND ${CMAKE_COMMAND} -E copy ${maintex}.pdf pdf/${pdf_file}
)
add_custom_target(pdf_${CMAKE_PROJECT_NAME}_${mode} DEPENDS pdf_${synctex_file} pdf_${pdf_file})
endif()
set(latex_document_options EXCLUDE_FROM_ALL)
set(custom_command_options)
endforeach()

101
README.md Normal file
View File

@ -0,0 +1,101 @@
# About
Thesis title: using template metaprogramming to design active libraries for assisted parallelisation.
(French: *application de la métaprogrammation template à la conception de bibliothèques actives
de parallélisation assitée*)
## Download
- [Slides](https://phd.pereda.fr/assets/thesis/alexis_pereda_defense.pdf).
## Abstract
<div align="justify">
Hardware performance has been increasing through the addition of computing cores rather than through
increasing their frequency since the early 2000s.
This means that parallel programming is no longer optional should you need to make the best use of
the hardware at your disposal.
Yet many programs are still written sequentially: parallel programming introduces numerous
difficulties.
Amongst these, it is notably hard to determine whether a sequence of a program can be executed in
parallel, i.e. preserving its behaviour as well as its overall result.
Even knowing that it is possible to parallelise a piece of code, doing it correctly is another
problem.
In this thesis, we present two approaches to make writing parallel software easier.
We present an active library (using C++ template metaprogramming to operate during the compilation
process) whose purpose is to analyse and parallelise loops.
To do so, it builds a representation of each processed loop using expression templates through an
embedded language.
This allows to know which variables are used and how they are used.
For the case of arrays, which are common within loops, it also acquires the index functions.
The analysis of this information enables the library to identify which instructions in the loop can
be run in parallel.
Interdependent instructions are detected by knowing the variables and their access mode for each
instruction.
Given a group of interdependent instructions and the known index functions, the library decides if
the instructions can be run in parallel or not.
We want this library to help developers writing loops that will be automatically parallelised
whenever possible and run sequentially as without the library otherwise.
Another focus is to provide this to serve as a framework to integrate new methods for parallelising
programs and extended analysis rules.
We introduce another active library that aims to help developers by assisting them in writing
parallel software instead of fully automating it.
This library uses algorithmic skeletons to let the developer describe its algorithms with both its
sequential and parallel parts by assembling atomic execution patterns such as a series of tasks or a
parallel execution of a repeated task.
This description includes the data flow, that is how parameters and function returns are
transmitted.
Usually, this is automatically set by the algorithmic skeleton library, however it gives the
developer greater flexibility and it makes it possible, amongst other things, for our library to
automatically transmit special parameters that must not be shared between parallel tasks.
One feature that this allows is to ensure repeatability from one execution to another even for
stochastic algorithms.
Considering the distribution of tasks on the different cores, we even reduce the number of these
non-shared parameters.
Once again, this library provides a framework at several levels.
Low-level extensions consist of the implementation of new execution patterns to be used to build
skeletons.
Another low-level axis is the integration of new execution policies that decide how tasks are
distributed on the available computing cores.
High-level additions will be libraries using ours to offer ready-to-use algorithmic skeletons for
various fields.
</div>
Keywords: template metaprogramming; assisted parallelisation; automatic parallelisation; active libraries; algorithmic skeletons; repeatability.
## Related publications
- "Repeatability with Random Numbers Using Algorithmic Skeletons", ESM 2020 (https://hal.archives-ouvertes.fr/hal-02980472);
- "Modeling Algorithmic Skeletons for Automatic Parallelization Using Template Metaprogramming", HPCS 2019 (IEEE) [10.1109/HPCS48598.2019.9188128](https://doi.org/10.1109/HPCS48598.2019.9188128);
- "Processing Algorithmic Skeletons at Compile-Time", ROADEF 2020 (https://hal.archives-ouvertes.fr/hal-02573660);
- "Algorithmic Skeletons Using Template Metaprogramming", ICAST 2019;
- "Parallel Algorithmic Skeletons for Metaheuristics", ROADEF 2019 (https://hal.archives-ouvertes.fr/hal-02059533);
- "Static Loop Parallelization Decision Using Template Metaprogramming", HPCS 2018 (IEEE) [10.1109/HPCS.2018.00159](https://doi.org/10.1109/HPCS.2018.00159).
## Related projects
- [AlSk](https://phd.pereda.fr/dev/alsk), an algorithmic skeletons active library;
- [pfor](https://phd.pereda.fr/dev/pfor), an automatic parallelisation active library;
- [ROSA](https://phd.pereda.fr/dev/rosa), an algorithmic skeletons collection for [OR](https://en.wikipedia.org/wiki/Operations_research) algorithms;
- [TMP](https://phd.pereda.fr/dev/tmp), template metaprogramming library used to implement this library.
## Usage
To produce the `Makefile`:
```bash
mkdir build
cd build
cmake ..
```
Compilation has been tested with `texlive-full` version 2020.20210202-3.
To build the project:
```
make
```
PDF files are generated in `build/pdf/`.

2074
UseLATEX.cmake Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
img/pfor/ct.pdf Normal file

Binary file not shown.

BIN
img/pfor/rt_par_1.pdf Normal file

Binary file not shown.

BIN
img/pfor/rt_par_10.pdf Normal file

Binary file not shown.

BIN
img/pfor/rt_par_12.pdf Normal file

Binary file not shown.

BIN
img/pfor/rt_par_14.pdf Normal file

Binary file not shown.

BIN
img/pfor/rt_par_16.pdf Normal file

Binary file not shown.

BIN
img/pfor/rt_par_18.pdf Normal file

Binary file not shown.

BIN
img/pfor/rt_par_2.pdf Normal file

Binary file not shown.

BIN
img/pfor/rt_par_4.pdf Normal file

Binary file not shown.

BIN
img/pfor/rt_par_6.pdf Normal file

Binary file not shown.

BIN
img/pfor/rt_par_8.pdf Normal file

Binary file not shown.

BIN
img/pfor/rt_seq.pdf Normal file

Binary file not shown.

BIN
img/repeat/exp_0.pdf Normal file

Binary file not shown.

BIN
img/repeat/exp_1.pdf Normal file

Binary file not shown.

BIN
img/repeat/exp_2.pdf Normal file

Binary file not shown.

BIN
raw/cpplogo.pdf Normal file

Binary file not shown.

58
raw/cpplogo.pdf_tex Normal file
View File

@ -0,0 +1,58 @@
%% Creator: Inkscape 1.0.2 (e86c870879, 2021-01-15), www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'cpplogo.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics{<filename>.pdf}
%% To scale the image, write
%% \def\svgwidth{<desired width>}
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%% \usepackage{import}
%% in the preamble, and then including the image with
%% \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%% \graphicspath{{<path to file>/}}
%%
%% For more information, please see info/svg-inkscape on CTAN:
%% http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\begingroup%
\makeatletter%
\providecommand\color[2][]{%
\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
\renewcommand\color[2][]{}%
}%
\providecommand\transparent[1]{%
\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
\renewcommand\transparent[1]{}%
}%
\providecommand\rotatebox[2]{#2}%
\newcommand*\fsize{\dimexpr\f@size pt\relax}%
\newcommand*\lineheight[1]{\fontsize{\fsize}{#1\fsize}\selectfont}%
\ifx\svgwidth\undefined%
\setlength{\unitlength}{229.5bp}%
\ifx\svgscale\undefined%
\relax%
\else%
\setlength{\unitlength}{\unitlength * \real{\svgscale}}%
\fi%
\else%
\setlength{\unitlength}{\svgwidth}%
\fi%
\global\let\svgwidth\undefined%
\global\let\svgscale\undefined%
\makeatother%
\begin{picture}(1,1.12532353)%
\lineheight{1}%
\setlength\tabcolsep{0pt}%
\put(0,0){\includegraphics[width=\unitlength,page=1]{raw/cpplogo.pdf}}%
\end{picture}%
\endgroup%

80
src/acronyms.tex Normal file
View File

@ -0,0 +1,80 @@
\newacronym{ABI}{ABI}{\en{Application Binary Interface}}
\newacronym{API}{API}{\en{Application Programming Interface}}
\newacronym{ASA}{ASA}{arbre syntaxique abstrait}
\newacronym{AST}{AST}{\en{Abstract Syntax Tree}}
\newacronym{AVX}{AVX}{\en{Advanced Vector eXtensions}}
\newacronym{BLP}{BLP}{\en{Bit-Level Parallelism}}
\newacronym{C++ AMP}{C++ AMP}{C++ {\en{Accelerated Massive Parallelism}}}
\newacronym{CPP}{CPP}{\en{C PreProcessor}}
\newacronym{CPU}{CPU}{\en{Central Processing Unit}}
\newacronym{CTAD}{CTAD}{\en{Class Template Argument Deduction}}
\newacronym{CUDA}{CUDA}{\en{Compute Unified Device Architecture}}
\newacronym{DSL}{DSL}{\en{Domain Specific Language}}
\newacronym{DSP}{DSP}{\en{Digital Signal Processor}}
\newacronym{EBO}{EBO}{\en{Empty Base Optimization}}
\newacronym{EDSL}{EDSL}{\en{Embedded Domain Specific Language}}
\newacronym{ELS}{ELS}{\en{Evolutionary Local Search}}
\newacronym{ET}{ET}{\en{Expression Templates}}
\newacronym{FIFO}{FIFO}{\en{First In, First Out}}
\newacronym{FPGA}{FPGA}{\en{Field-Programmable Gate Array}}
\newacronym{GPGPU}{GPGPU}{\en{General-Purpose computing on \gls{GPU}}}
\newacronym{GPPL}{GPPL}{\en{General Purpose Programming Language}}
\newacronym{GPU}{GPU}{\en{Graphics Processing Unit}}
\newacronym{GRASP}{GRASP}{\en{Greedy Randomized Adaptive Search Procedure}}
\newacronym{HPC}{HPC}{\en{High Performance Computing}}
\newacronym{ID}{ID}{\en{Instruction Decode}}
\newacronym{IEEE}{IEEE}{\en{Institute of Electrical and Electronics Engineers}}
\newacronym{IF}{IF}{\en{Instruction Fetch}}
\newacronym{ILP}{ILP}{\en{Instruction-Level Parallelism}}
\newacronym{ILS}{ILS}{\en{Iterative Local Search}}
\newacronym{IPC}{IPC}{\en{Inter-Process Communication}}
\newacronym{MA}{MA}{\en{Memory Access}}
\newacronym{MIMD}{MIMD}{\en{Multiple-Instruction stream -- Multiple-Data stream}}
\newacronym{MISD}{MISD}{\en{Multiple-Instruction stream -- Single-Data stream}}
\newacronym{MMX}{MMX}{\en{multimedia extensions}}
\newacronym{MPI}{MPI}{\en{Message Passing Interface}}
\newacronym{MPT}{MPT}{métaprogrammation template}
\newacronym{NUMA}{NUMA}{\en{Non-Uniform Memory Access}}
\newacronym{OpenCL}{OpenCL}{\en{Open Computing Language}}
\newacronym{OpenMP}{OpenMP}{\en{Open Multi-Processing}}
\newacronym{PEPS}{PEPS}{Premier Entré, Premier Sorti}
\newacronym{PGCD}{PGCD}{plus grand commun diviseur}
\newacronym{POO}{POO}{Programmation Orientée Objet}
\newacronym{POSIX}{POSIX}{\en{Portable Operating System Interface}}
\newacronym{PRNG}{PRNG}{\en{Pseudorandom Number Generator}}
\newacronym{RAII}{RAII}{\en{Resource Acquisition Is Initialisation}}
\newacronym{RAW}{RAW}{\en{Read After Write}}
\newacronym{RO}{RO}{Recherche Opérationnelle}
\newacronym{RRID}{RRID}{\en{Resource Release Is Destruction}}
\newacronym{SFINAE}{SFINAE}{\en{Substitution Failure Is Not An Error}}
\newacronym{SIMD}{SIMD}{\en{Single-Instruction stream -- Multiple-Data stream}}
\newacronym{SISD}{SISD}{\en{Single-Instruction stream -- Single-Data stream}}
\newacronym{SMP}{SMP}{\en{Symmetric MultiProcessing}}
\newacronym{SSE}{SSE}{\en{Streaming \gls{SIMD} Extension}}
\newacronym{TAD}{TAD}{\en{Template Argument Deduction}}
\newacronym{TBB}{TBB}{\en{Threading Building Blocks}}
\newacronym{TMP}{TMP}{\en{template metaprogramming}}
\newacronym{TSP}{TSP}{\en{Travelling Salesman Problem}}
\newacronym{UAL}{UAL}{Unité Arithmétique et Logique}
\newacronym{UMA}{UMA}{\en{Uniform Memory Access}}
\newacronym{UVF}{UVF}{Unité de calcul en Virgule Flottante}
\newacronym{WAR}{WAR}{\en{Write After Read}}
\newacronym{WAW}{WAW}{\en{Write After Write}}
\newacronym{WB}{WB}{\en{WriteBack}}

10
src/alg/alsk/grasp.tex Normal file
View File

@ -0,0 +1,10 @@
\begin{algorithmic}
\Function{GRASP}{$\textcolor<4>{colLinkIn}{N}, \textcolor<4>{colLinkIn}{P}$}
\For{$i = 1..N$}
\State $\textcolor<4>{colLinkOut}{S_i} \gets \Call{\textcolor<2>{colMuscle!80!black}{heuristiqueConstructive}}{\textcolor<4>{colLinkIn}{P}}$
\State $\textcolor<4>{colLinkOut}{S_i} \gets \Call{\textcolor<2>{colMuscle!80!black}{rechercheLocale}}{\textcolor<4>{colLinkIn}{P}, \textcolor<4>{colLinkIn}{S_i}}$
\EndFor
\State $\textcolor<4>{colLinkOut}{S^*} \gets \Call{\textcolor<2>{colMuscle!80!black}{sélection}}{\{\textcolor<4>{colLinkIn}{S_1}, \textcolor<4>{colLinkIn}{S_2}, \dots, \textcolor<4>{colLinkIn}{S_{N}}\}}$
\State \Return $\textcolor<4>{colLinkOut}{S^*}$
\EndFunction
\end{algorithmic}

20
src/alg/app/els.tex Normal file
View File

@ -0,0 +1,20 @@
\begin{algorithmic}
\Function{ELS}{$P, S, N, M$}
\State $S \gets \Call{rechercheLocaleInitiale}{P, S}$
\State $S^* \gets S$
\For{$i = 1..N$}
\For{$j = 1..M$}
\State $S_j \gets \Call{mutation}{S}$
\State $S_j \gets \Call{rechercheLocale}{P, S_j}$
\EndFor
\State $S' \gets \Call{sélection1}{\{S_1, S_2, \dots, S_{M}\}}$
\State $S^* \gets \Call{sélection2}{S^*, S'}$
\If{\Call{critèreAcceptation}{$S'$}}
\State $S \gets S'$
\EndIf
\EndFor
\State \Return $S^*$
\EndFunction
\end{algorithmic}

10
src/alg/app/grasp.tex Normal file
View File

@ -0,0 +1,10 @@
\begin{algorithmic}
\Function{GRASP}{$N, P$}
\For{$i = 1..N$}
\State $S_i \gets \Call{heuristiqueConstructive}{P}$
\State $S_i \gets \Call{rechercheLocale}{P, S_i}$
\EndFor
\State $S^* \gets \Call{sélection}{\{S_1, S_2, \dots, S_{N}\}}$
\State \Return $S^*$
\EndFunction
\end{algorithmic}

10
src/alg/app/graspels.tex Normal file
View File

@ -0,0 +1,10 @@
\begin{algorithmic}
\Function{GRASP\textcolor{red}{$\times$ELS}}{$N, P$}
\For{$i = 1..N$}
\State $S_i \gets \Call{heuristiqueConstructive}{P}$
\State $S_i \gets \Call{\textcolor{red}{ELS}}{P, S_i}$
\EndFor
\State $S^* \gets \Call{sélection}{\{S_1, S_2, \dots, S_{N}\}}$
\State \Return $S^*$
\EndFunction
\end{algorithmic}

12
src/alg/app/greedy.tex Normal file
View File

@ -0,0 +1,12 @@
\begin{algorithmic}
\Function{glouton}{$P$}
\State $S \gets \emptyset$
\State Construire la liste $L$ des éléments insérables dans $S$ à partir de $P$
\While{$L \neq \emptyset$}
\State Évaluer le coût d'insertion de chaque élément de $L$
\State Retirer de $L$ l'élément de coût minimal
\State Insérer cet élément dans $S$
\EndWhile
\State \Return $S$
\EndFunction
\end{algorithmic}

4
src/commands.tex Normal file
View File

@ -0,0 +1,4 @@
%{{{ alsk "
\newcommand*{\graspils}{GRASP\raisebox{.175ex}{\texttimes}ILS}
\newcommand*{\graspels}{GRASP\raisebox{.175ex}{\texttimes}ELS}
%}}}

25
src/defense/0_intro.tex Normal file
View File

@ -0,0 +1,25 @@
\section*{Introduction}
\begin{frame}{Introduction}
%{{{ frame "
\begin{itemize}
\item[] Performances $\propto$ nombre de cœurs
\item[$\implies$] besoin de bénéficier du parallélisme des cœurs
\item[mais] difficile donc sous-exploité
\end{itemize}
\vspace{5ex}
Problématique :
\begin{itemize}
\item[] expertise parallélisation $\neq$ expertise métier
\item[$\implies$] besoin d'outils pour assister la parallélisation
\end{itemize}
%}}}
\end{frame}
\begin{frame}{Plan}
%{{{ frame "
\tableofcontents[sectionstyle=show,subsectionstyle=show]
%}}}
\end{frame}

View File

@ -0,0 +1,5 @@
\section{Contexte}
\input{src/defense/1_context/0_par}
\input{src/defense/1_context/1_app}
\input{src/defense/1_context/2_mp}

View File

@ -0,0 +1,56 @@
\subsection{Parallélisation}
%{{{
\begin{frame}{Idée générale}
%{{{ frame "
\framesubtitle<1-2>{Exécution séquentielle}
\framesubtitle<3>{Exécution parallèle idéale}
\begin{columns}<only@1-2>
\begin{column}{.1\paperwidth}\end{column}
\begin{column}{.4\paperwidth}
\fig{context/seq}
\end{column}
\begin{column}<2>{.5\paperwidth}
\begin{itemize}
\item matériel multicœur
\item tâches m\textsubscript{\{0..N-1\}} indépendantes
\end{itemize}
\end{column}
\end{columns}
\figonly<3>{context/par}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Difficultés de la parallélisation}
%{{{ frame "
\begin{alertblock}{Difficultés et inconvénients}
\begin{itemize}
\item<+-> déterminer les parties parallélisables
\begin{itemize}
\item[$\to$] analyse de dépendances
\end{itemize}
\vspace{.5ex}
\item<+-> parallélisation correcte et maintenable
\begin{itemize}
\item[$\to$] composition de fonctions parallèles
\item[$\to$] séparation des domaines d'expertise
\end{itemize}
\vspace{.5ex}
\item<+-> besoin de synchronisation
\begin{itemize}
\item[$\to$] attente de la fin de tâches
\item[$\to$] partage de ressources
\end{itemize}
\vspace{.5ex}
\item<+-> non répétabilité des exécutions
\begin{itemize}
\item[$\to$] cas des nombres pseudo-aléatoires
\end{itemize}
\end{itemize}
\end{alertblock}
%}}}
\end{frame}
%}}}

View File

@ -0,0 +1,106 @@
\subsection{Application : \graspels}
%{{{
\begin{frame}{Problème du voyageur de commerce}
\framesubtitle<1>{Instance}
\framesubtitle<2>{Solution quelconque}
\framesubtitle<3>{Solution optimale}
%{{{ frame "
\begin{columns}
\begin{column}{.4\paperwidth}
\figonly<1>{app/tspinstance}
\figonly<2>{app/tspsolution}
\figonly<3>{app/tspopti}
\end{column}
\begin{column}{.5\paperwidth}
\begin{itemize}
\item<1-> Graphe $G = (V, A, c)$
\item<2-> coût $c_s = \displaystyle\sum_{i=2}^{\vert V \vert}{c((s[i-1], s[i]))}$
\item<3-> Problème d'optimisation
\item<3-> NP-difficile
\end{itemize}
\end{column}
\end{columns}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Algorithme stochastique glouton}
%{{{ frame "
\begin{columns}
\begin{column}{.5\paperwidth}
\alg{app/greedy}
\end{column}
\begin{column}{.5\paperwidth}
\def\tspstart{0}
\def\istep{9}
\only<1>{\def\istep{0}}
\only<2>{\def\istep{1}}
\only<3>{\def\istep{2}}
\only<4>{\def\istep{3}}
\only<5>{\def\istep{4}}
\only<6>{\def\istep{5}}
\only<7>{\def\istep{6}}
\only<8>{\def\istep{7}}
\only<9>{\def\istep{8}}
\only<10>{\def\istep{9}}
\only<11>{\def\tspstart{1}}
\only<12>{\def\tspstart{2}}
\only<13>{\def\tspstart{3}}
\fig{app/tspgreedysolution}
\end{column}
\end{columns}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Métaheuristique \graspels}
\setbeamercovered{still covered={\opaqueness<1->{15}},again covered={\opaqueness<1->{50}}}
%{{{ frame "
\begin{columns}
\begin{column}{.5\paperwidth}
\begin{overprint}
\onslide+<1>
\vspace*{7ex}
\scriptsize
\alg{app/grasp}
\onslide+<2-7>
\fig{app/tspels}
\onslide+<8>
\vspace*{7ex}
\scriptsize
\alg{app/graspels}
\end{overprint}
\end{column}
\begin{column}{.5\paperwidth}
\uncover<2->{
\scriptsize
\alg{app/els}
}
\end{column}
\end{columns}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Points clés}
%{{{ frame "
\begin{block}{Intérêt de cette application}
\begin{itemize}
\item Plusieurs niveaux de parallélisation possible
\vspace{1ex}
\item Stochastique $\implies$ répétabilité difficile
\vspace{1ex}
\item Composabilité (exemple : \graspils)
\end{itemize}
\end{block}
%}}}
\end{frame}
%}}}

View File

@ -0,0 +1,249 @@
\subsection{Métaprogrammation template}
%{{{
\begin{frame}{Métaprogrammation}
%{{{ frame "
\begin{block}{Définition de métaprogramme}
programme dont les données traitées sont des programmes
\end{block}
En C++ :
\begin{itemize}
\item notamment basé sur les templates
\item exécution du métaprogramme durant la compilation
\item génération d'un programme C++
\end{itemize}
\fig{mp/metaprogram}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Métaprogrammation template}
\framesubtitle{Généricité}
%{{{ frame "
\begin{block}{Résultats d'un template}
\begin{itemize}
\item structure / classe / union
\item fonction
\item variable
\end{itemize}
\end{block}
\lstvisible<2->{mp/tmptype}
\visible<3->{
\begin{columns}
\begin{column}{.33\paperwidth}
\lst{mp/tmptype_int_5}
\end{column}
\begin{column}{.33\paperwidth}
\lst{mp/tmptype_float_3}
\end{column}
\begin{column}{.33\paperwidth}
\lst{mp/tmptype_Foo_256}
\end{column}
\end{columns}
\tikz[remember picture,overlay]\draw[->,>=stealth]
(mp tmptype) -- node[midway,left]{\cppinline{Array<int, 5>}} (mp tmptype int 5);
\tikz[remember picture,overlay]\draw[->,>=stealth]
(mp tmptype) -- node[midway]{\cppinline{Array<float, 3>}} (mp tmptype float 3);
\tikz[remember picture,overlay]\draw[->,>=stealth]
(mp tmptype) -- node[midway,right]{\cppinline{Array<Foo, 256>}} (mp tmptype Foo 256);
}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Puissance avec exposant connu}
%{{{ frame "
\vspace*{-3ex}
\begin{columns}
\begin{column}{.25\paperwidth}\end{column}
\begin{column}{.5\paperwidth}
\only<-9>{\center Fonction puissance\vspace{-2ex}}
\lstonly<-9>{mp/pow.rt}
\only<10-12>{\setminted{highlightcolor=yellow!80!black!30,highlightlines={1-4}}}
\only<13>{\setminted{highlightcolor=yellow!80!black!30,highlightlines={6-9}}}
\only<9->{\center Métafonction puissance\vspace{-2ex}}
\lstonly<9->{mp/pow.ct}
\end{column}
\begin{column}{.25\paperwidth}\end{column}
\end{columns}
\vspace{-2ex}
\begin{columns}[t]
\begin{column}{.066\paperwidth}\end{column}
\begin{column}{.4\paperwidth}
\only<2-8,10->{\center Exemple d'appel\vspace{-2ex}}
\only<-8>{\lstvisible<2-8>{mp/pow.rt.call}}
\only<8>{
\vspace{2ex}
\begin{itemize}
\item $n$ multiplications
\item $n$ soustractions
\item structures de contrôle
\end{itemize}
}
\lstvisible<10->{mp/pow.ct.call}
\end{column}
\begin{column}{.066\paperwidth}\end{column}
\begin{column}{.4\paperwidth}
\visible<3-8,15->{\center Assembleur produit\vspace{-2ex}}
\only<-8>{\lstvisible<3-8>{mp/pow.rt.asm}}
\lstonly<15>{mp/pow.ct.asm}
\only<15->{\vspace{7pt}}
\end{column}
\begin{column}{.066\paperwidth}\end{column}
\end{columns}
\only<10-14>{\center C++ généré\\\vspace{-1pt}}
\only<10>{\small\center\texttt{\hlbox{yellow!80!black!30}{pow<24>(x)}}}
\only<11>{\small\center\texttt{x*\hlbox{yellow!80!black!30}{pow<23>(x)}}}
\only<12>{\small\center\texttt{x*x*\hlbox{yellow!80!black!30}{pow<22>(x)}}}
\only<13>{\small\center\texttt{x*\dots*x*\hlbox{yellow!80!black!30}{pow<0>(x)}}}
\only<14>{%
\small\center\texttt{\phantom{p}\tikzmark{powx0}x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x\tikzmark{powxn}*1\phantom{p}}%
\tikz[remember picture,overlay]{%
\draw[decorate,decoration={brace,amplitude=4pt,raise=2pt,mirror}]
(pic cs:powx0) -- node[below=4pt]{\num{24} occurrences de \texttt{x}} (pic cs:powxn);
}%
}
\only<10-14>{\vspace{11pt}}
\only<15>{\vspace{-3ex}\center $\implies$ exponentiation rapide par le compilateur}
\tikz[remember picture,overlay,->,>=stealth,rounded corners,thick]{%
\only<4>{
\draw[<-] ([shift={(-.1em,.5ex)}]pic cs:powimul) -- +(-10mm,0) node[left]{\texttt{r *= x}};
}
\only<5>{
\draw[<-] ([shift={(-.1em,.5ex)}]pic cs:powsub) -- +(-10mm,0) node[left]{\texttt{n-{}-}};
}
\only<6>{
\draw ([shift={(-.1em,.5ex)}]pic cs:powjend) -- ++(-12mm,0)
|- node[pos=.25,left]{si \textcolor[rgb]{.53,0,0}{\texttt{esi}} $\leqslant 0$} ([shift={(-.1em,.5ex)}]pic cs:powlend);
\draw ([shift={(-.1em,.5ex)}]pic cs:powjloop) -- ++(-8mm,0) |- ([shift={(-.1em,.5ex)}]pic cs:powlloop);
}
\only<7>{
\draw ([shift={(-.1em,.5ex)}]pic cs:powjloop) -- ++(-8mm,0)
|- node[pos=.25,left]{tant que \textcolor[rgb]{.53,0,0}{\texttt{eax}} $>0$} ([shift={(-.1em,.5ex)}]pic cs:powlloop);
}
}%
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Patrons d'expression}
%{{{ frame "
\framesubtitle{Concept}
\begin{itemize}
\item traitement d'arbre syntaxiques abstraits
\item acquisition avec un langage embarqué
\end{itemize}
\begin{columns}<only@-5>
\begin{column}{.32\paperwidth}
\vspace{1mm}
\lstvisible<2->{mp/edsl_basic}
\lstvisible<4->{mp/et_basic}
\end{column}
\begin{column}{.56\paperwidth}
\figonly<3-4>{mp/et_basic}
\only<5>{\vspace{1mm}}
\lstonly<5>{mp/opmul}
\lstonly<5>{mp/opadd}
\end{column}
\end{columns}
\only<6->{\vspace{15.75mm}}% fix v pos
\begin{exampleblock}<only@6->{Applications}
\begin{itemize}
\item Eigen : optimisation de calculs matriciels
\item Adept : optimisation de dérivées de fonctions
\item Parallélisation assistée/automatique
\end{itemize}
\end{exampleblock}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Patrons d'expression}
%{{{ frame "
\framesubtitle{Exemple d'optimisation}
\only<-3>{\vspace{-2ex}}
\begin{columns}<only@-3>
\begin{column}{.4\paperwidth}
\lst{mp/edsl_linexpr}
\lstvisible<2->{mp/et}
\end{column}
\begin{column}{.55\paperwidth}
% \vspace{-39mm}
\visible<3>{
\center Motif \og affine \fg\vspace{-1ex}
\lst{mp/et_pattern_lin}
\center Motif \og constante \texttimes{} affine \fg\vspace{-1ex}
\lst{mp/et_pattern_mulcstlin}
\center Motif \og affine $-$ affine \fg\vspace{-1ex}
\lst{mp/et_pattern_sublinlin}
}
\end{column}
\end{columns}
\begin{columns}<only@4>
\begin{column}{.3995\paperwidth}
\lst{mp/edsl_linexpr}
\end{column}
\end{columns}
\begin{columns}<only@5>
\begin{column}{.3275\paperwidth}
\lst{mp/edsl_linexpr_opti0}
\end{column}
\end{columns}
\begin{columns}<only@6-7>
\begin{column}{.17\paperwidth}
\lst{mp/edsl_linexpr_opti}
\end{column}
\end{columns}
\begin{overprint}
\onslide+<4>
\fig{mp/et_linexpr}
\onslide+<5>
\fig{mp/et_linexpr_opti0}
\onslide+<6->
\fig{mp/et_linexpr_opti1}
\only<7>{
\begin{itemize}
\item code effectif produit
\item analyse durant la compilation
\end{itemize}
}
\end{overprint}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Atouts de la métaprogrammation template}
%{{{ frame "
\begin{itemize}
\item Analyse et génération de code durant la compilation
\vspace{1ex}
\item Possibilité de le faire sans surcoût
\vspace{1ex}
\item C++ standard
\end{itemize}
%}}}
\end{frame}
%}}}

6
src/defense/2_alsk.tex Normal file
View File

@ -0,0 +1,6 @@
\section{Parallélisation assistée}
\input{src/defense/2_alsk/0_alsk}
\input{src/defense/2_alsk/1_exec}
\input{src/defense/2_alsk/2_repeat}
\input{src/defense/2_alsk/3_conclusion}

View File

@ -0,0 +1,154 @@
\subsection{Squelettes algorithmiques}
%{{{
\begin{frame}{Concept}
%{{{ frame "
\begin{itemize}
\item Motifs d'exécution parallèle
\item Composition
\item<3>[$\to$] \graspels
\end{itemize}
\vspace{-4ex}
\begin{overprint}
\onslide+<2>
\fig{alsk/forkjoin}
\onslide+<3>
\vspace{-4ex}
\begin{columns}
\begin{column}{.2\paperwidth}
\vspace*{2ex}
\center Serial\vspace{-6ex}
\fig{alsk/seq}
\end{column}
\begin{column}{.5\paperwidth}
\vspace*{2ex}
\center FarmSel\vspace{-6ex}
\fig{alsk/farmsel}
\end{column}
\end{columns}
\end{overprint}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{\graspels}
%{{{ frame "
\fig{alsk/graspels}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Composition}
%{{{ frame "
\begin{columns}
\begin{column}{.33\paperwidth}
\fig{alsk/grasp}
\end{column}
\begin{column}{.66\paperwidth}
\only<1-4>{
\begin{itemize}[<alert@+(1)>]
\item Muscles\visible<2->{~: fonctions \og domaine \fg{}}
\item Structure\visible<3->{~: motifs d'exécution}
\item Liens\visible<4->{~: flux de données}
\end{itemize}
\vspace{1cm}
\alg{alsk/grasp}%
\visible<3>{%
\tikz[overlay,colStruct]{%
\fill[rounded corners,opacity=.2] (9mm,23.5mm) rectangle +(33mm,4.25mm);%
\draw[decorate,decoration={brace,amplitude=4pt}] (3mm,5mm) -- +(0mm,27mm);%
\draw[decorate,decoration={brace,amplitude=3pt}] (9mm,9.5mm) -- +(0mm,18mm);%
\draw[decorate,decoration={brace,amplitude=2pt}] (15mm,14.75mm) -- +(0mm,8mm);%
}%
}%
}
\end{column}
\end{columns}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Structure}
%{{{ frame "
\begin{columns}
\begin{column}{.33\paperwidth}
\fig{alsk/grasp_struct}
\end{column}
\begin{column}{.62\paperwidth}
\only<2>{\setminted{highlightcolor=colStruct!30,highlightlines={5,10}}}
\only<3>{\setminted{highlightcolor=colMuscle!30,highlightlines={6-8,9}}}
\only<4>{\setminted{highlightcolor=colStruct!30,highlightlines={6,8}}}
\only<5>{\setminted{highlightcolor=colMuscle!30,highlightlines={7}}}
\lst{alsk/grasp_struct}
\end{column}
\begin{column}{.04\paperwidth}\end{column}
\end{columns}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Liens}
%{{{ frame "
\begin{columns}
\begin{column}{.33\paperwidth}
\fig{alsk/grasp_links}
\end{column}
\begin{column}{.62\paperwidth}
\colorletonly<2>{colFSr}{colLinkOut} \colorletonly<2>{colFSp0}{colLinkIn}
\colorletonly<3>{colFSp0}{colLinkIn} \colorletonly<3>{colSp0}{colLinkIn}
\colorletonly<4>{colSp0}{colLinkIn} \colorletonly<4>{colCHp0}{colLinkIn}
\colorletonly<5>{colCHr}{colLinkOut} \colorletonly<5>{colLSp0}{colLinkIn}
\colorletonly<6>{colSr}{colLinkOut} \colorletonly<6>{colLSr}{colLinkOut}
\colorletonly<7>{colSr}{colLinkOut} \colorletonly<7>{colSelp}{colLinkIn}
\colorletonly<8>{colFSr}{colLinkOut} \colorletonly<8>{colSelr}{colLinkOut}
\colorletonly<9>{colCHp1}{colLinkCtx} \colorletonly<9>{colLSp1}{colLinkCtx}
\begin{itemize}
\item[\texttt{P<i>}] paramètre d'indice \texttt{i}
\item[\texttt{R<i>}] résultat d'indice \texttt{i}
\item[\texttt{RNG}] générateur de nombres pseudo-aléatoires
\end{itemize}
\lst{alsk/grasp_links}
\end{column}
\begin{column}{.04\paperwidth}\end{column}
\end{columns}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Corps : instanciation d'un squelette}
%{{{ frame "
\texttt{SkelEls} $=$ \texttt{SkelElsStruct} $+$ \texttt{SkelElsLinks}
\bigskip
\only<2>{\setminted{highlightlines={2},highlightcolor=colStruct!30}}
\only<3>{\setminted{highlightlines={3},highlightcolor=colStruct!30}}
\lstvisible<1->{alsk/elsbody}
\lstvisible<4->{alsk/graspbody}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Exécution}
%{{{ frame "
\only<1>{\setminted{lastline={1}}}
\only<2>{\setminted{lastline={5}}}
\only<3>{\setminted{lastline={7}}}
\only<4>{\setminted{lastline={9}}}
\vbox to 4cm {
\lst{alsk/graspexec}
}
%}}}
\end{frame}
%}}}

View File

@ -0,0 +1,121 @@
\subsection{Politiques d'exécution}
%{{{
\begin{frame}{\texttt{DynamicPool} : \en{Thread pool}}
%{{{ frame "
\fig{exec/threadpool}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Répartition équilibrée}
%{{{ frame "
\only<1>{\def\N{12}\def\T{4}}
\only<2>{\def\N{10}\def\T{4}}
\fig{exec/firstlevel}
\only<1>{
\vspace{-1ex}
\[
12\text{ tâches} = 3\text{ tâches/\en{thread}} \times 4\text{ \en{threads}} + 0\text{ tâche}
\]
\[
\implies \text{accélération idéale : }4
\]
}
\only<2>{
\vspace{-1ex}
\[
10\text{ tâches} = 2\text{ tâches/\en{thread}} \times 4\text{ \en{threads}} + 2\text{ tâches}
\]
\[
\implies \text{accélération idéale : }3.\overline{3}
\]
}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Répartition équilibrée multi-niveaux}
%{{{ frame "
\def\N{10}\def\T{4}
\figonly<1>{exec/firstleveldetails}
\only<2>{
\fig{exec/multilevel}
\vspace{6.5mm}
}
\only<1>{
\vspace{-1ex}
\[
10 \times 2\text{ tâches} = 2 \times 2\text{ tâches/\en{thread}} \times 4\text{ \en{threads}}
+ 2 \times 2\text{ tâches}
\]
\[
\implies \text{accélération idéale : }3.\overline{3}
\]
}
\only<2>{
\vspace{-1ex}
\[
10 \times 2\text{ tâches} = (2 \times 2 + 1)\text{ tâches/\en{thread}} \times 4\text{ \en{threads}}
\]
\[
\implies \text{accélération idéale : }4
\]
}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Performances}
%{{{ frame "
\framesubtitle<2>{Temps moyen (exécutions séquentielles)}
\framesubtitle<3>{Temps moyen (exécutions parallèles)}
\framesubtitle<4>{Accélération (exécutions parallèles)}
\only<1>{
Contexte matériel et logiciel :
\vspace{1ex}
\begin{itemize}
\item Intel Xeon E7-8890 v3 -- \SI{2.5}{\GHz}
\vspace{1ex}
\item \num{18} cœurs
\vspace{1ex}
\item GCC 8.2.0 -- \texttt{-O2}
\vspace{1ex}
\item Résolution de \graspels{} (194 sommets)
\vspace{1ex}
\item moyennes sur \num{20} exécutions
\vspace{1ex}
\item exécutions répétables
\end{itemize}
}
\only<2>{
\begin{columns}
\begin{column}{.7\paperwidth}
\includegraphics{img/exec/rt_graspels_qa194_24_20_20_seq.pdf}
\end{column}
\begin{column}{.25\paperwidth}
\begin{itemize}
\item[hw\_\ldots] \og à la main \fg
\item[sk\_\ldots] avec squelettes
\end{itemize}
\end{column}
\end{columns}
}
\only<3>{
\includegraphics{img/exec/rt_graspels_qa194_20_20_20_speedup.pdf}
\vspace{-2ex}
\center Nombre d'itérations du GRASP : \num{20}
}
\only<4>{
\includegraphics{img/exec/rt_graspels_qa194_4_20_20_speedup.pdf}
\vspace{-2.5ex}
\center Nombre d'itérations du GRASP : \num{4}
}
%}}}
\end{frame}
%}}}

View File

@ -0,0 +1,314 @@
\subsection{Répétabilité}
%{{{
\begin{frame}{Problème}
%{{{ frame "
\framesubtitle{Exécution séquentielle}
\colorlet{a}{colThread0}
\colorlet{b}{colThread1}
\begin{columns}
\begin{column}{\paperwidth}
\fig{repeat/prng/seq}
\end{column}
\end{columns}
\vfill
\begin{columns}
\begin{column}{.47\paperwidth}
\begin{itemize}
\item \textcolor{a}{$\frac{\text{tâche }0}{\text{\en{thread }0}} \to $ \visible<2->{12}%
\foreach[count=\i from 3] \n in {2,34,85,4,91} {\visible<\i->{, \n}}}
\vspace{1em}
\item<8-> \textcolor{b}{$\frac{\text{tâche }1}{\text{\en{thread }0}} \to $ \visible<8->{29}%
\foreach[count=\i from 9] \n in {85,98,3,35,65} {\visible<\i->{, \n}}}
\end{itemize}
\end{column}
\begin{column}{.37\paperwidth}% fix alignment with next frame
\end{column}
\begin{column}{.12\paperwidth}
\end{column}
\end{columns}
\only<14>{}% create overlay
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Problème}
%{{{ frame "
\framesubtitle{Exécution parallèle}
\colorlet{a}{colThread0}
\colorlet{b}{colThread1}
\begin{columns}
\begin{column}{\paperwidth}
\fig{repeat/prng/par}
\end{column}
\end{columns}
\vfill
\begin{columns}
\begin{column}{.47\paperwidth}
\begin{itemize}
\item \textcolor{a}{$\frac{\text{tâche }0}{\text{\en{thread }0}} \to $ \visible<2->{12}%
\foreach \n/\os in {34/4,4/6,29/8,98/10,65/13} {\visible<\os->{, \n}}}
\vspace{1em}
\item<3-> \textcolor{b}{$\frac{\text{tâche }1}{\text{\en{thread }0}} \to $ \visible<3->{2}%
\foreach[count=\i from 9] \n/\os in {85/5,91/7,85/9,3/11,35/12} {\visible<\os->{, \n}}}
\end{itemize}
\end{column}
\begin{column}{.37\paperwidth}
\only<14->{
\begin{itemize}
\setbeamertemplate{itemize items}{\raisebox{.4ex}{\textit{ou}}}
\item \raisebox{.4ex}{\textcolor{a}{34, 85, 91, 29, 98, 35}}
\vspace{1em}
\setbeamertemplate{itemize items}{\raisebox{.1ex}{\textit{ou}}}
\item \raisebox{.1ex}{\textcolor{b}{12, 2, 4, 85, 3, 65}}
\end{itemize}
}
\end{column}
\begin{column}{.12\paperwidth}
\only<15->{
\begin{itemize}
\setbeamertemplate{itemize items}{\raisebox{.4ex}{\textit{ou}}}
\item \raisebox{.4ex}{\dots}
\vspace{1em}
\setbeamertemplate{itemize items}{\raisebox{.1ex}{\textit{ou}}}
\item \raisebox{.1ex}{\dots}
\end{itemize}
}
\end{column}
\end{columns}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Solutions possibles}
%{{{ frame "
\begin{itemize}
\item un PRNG global $\implies$ aucune répétabilité
\vspace{1em}
\item un PRNG par \en{thread} $\implies$ répétabilité partielle
\vspace{1em}
\item un PRNG par tâche parallèle $\implies$ répétabilité totale
\end{itemize}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Solutions possibles}
%{{{ frame "
\framesubtitle{$\to$ Un PRNG par \en{thread}}
\colorlet{a}{colThread0}
\colorlet{b}{colThread1}
\colorlet{c}{b}
\only<1>{\colorlet{c}{black}}
\begin{columns}
\begin{column}{\paperwidth}
\fig{repeat/prng/parthread}
\end{column}
\end{columns}
\vfill
\begin{columns}
\begin{column}{.47\paperwidth}
\begin{itemize}
\item \textcolor{a}{$\frac{\text{tâche }0}{\text{\en{thread }0}} \to $ 12, 2, 34, 85, 4, 91}
\vspace{1em}
\item \textcolor{b}{$\frac{\text{tâche }1}{\text{\en{thread }1}} \to $ 42, 8, 9, 54, 95, 80}
\end{itemize}
\end{column}
\begin{column}{.47\paperwidth}
\only<2>{
\begin{itemize}
\setbeamertemplate{itemize items}{{$=$}}
\item \hspace{.5em}{\textcolor{a}{$\frac{\text{tâche }0}{\text{\en{thread }0}} \to $ 12, 2, 34, 85, 4, 91}}
\vspace{1em}
\setbeamertemplate{itemize items}{{$\neq$}}
\item \hspace{.5em}{\textcolor{b}{$\frac{\text{tâche }1}{\text{\en{thread }0}} \to $ 29, 85, 98, 3, 35, 65}}
\end{itemize}
}
\end{column}
\begin{column}{.02\paperwidth}
\end{column}
\end{columns}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Solutions possibles}
%{{{ frame "
\framesubtitle{$\to$ Un PRNG par tâche parallèle}
\begin{block}{Pré-requis}
\begin{itemize}
\item Système de liens (\texttt{RNG})
\item Identifier les tâches parallèles
\begin{itemize}
\item parcours de l'arbre du squelette algorithmique
\item connaissance de la nature des motifs d'exécution
\end{itemize}
\end{itemize}
\end{block}
\begin{alertblock}{Inconvénient}
\begin{itemize}
\item Beaucoup de PRNG créés
\begin{itemize}
\item[$\to$] réduction grâce à la connaissance des politiques d'exécution
\end{itemize}
\end{itemize}
\end{alertblock}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}<0>[noframenumbering]{Identification des tâches}
%{{{ frame "
\vspace*{-1.5ex}
\begin{columns}
\begin{column}{\paperwidth}
\fig{repeat/identify}
\end{column}
\end{columns}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Optimiser le nombre de PRNG}
%{{{ frame "
\def\N{9}
\begin{columns}
\begin{column}{.3\paperwidth}
\figonly<1>{repeat/seq}
\only<2>{\vspace*{-2.8ex}\def\T{2}\fig{repeat/par}}
\end{column}
\begin{column}{.6\paperwidth}
\only<1>{
\vspace*{-5ex}
Contraintes \#\en{threads} $\implies$ moins de PRNG
\vspace{4ex}
}
\only<2>{\vspace*{-3.25ex}}
\[
\only<1>{S_1 = \{\{m_0, m_1, m_2, m_3, m_4, m_5, m_6, m_7, m_8\}\}}
\only<2>{S_2 = \{\{m_0, m_1, m_2, m_3, m_4\}, \{m_5, m_6, m_7, m_8\}\}}
\]
\end{column}
\end{columns}
\only<3>{
\def\T{3}\fig{repeat/par}
\[
S_3 = \{\{m_0, m_1, m_2\},\{m_3, m_4, m_5\}, \{m_6, m_7, m_8\}\}
\]
}
\only<4>{
\def\T{4}\fig{repeat/par}
\[
S_4 = \{\{m_0, m_1, m_2\},\{m_3, m_4\},\{m_5, m_6\}, \{m_7, m_8\}\}
\]
}
\only<5>{
\def\T{5}\fig{repeat/par}
\vspace{13mm}
\[
S_5 = \{\{m_0, m_1\},\{m_2, m_3\},\{m_4, m_5\},\{m_6, m_7\},\{m_8\}\}
\]
}
\only<6>{
\def\T{6}\fig{repeat/par}
\vspace{13mm}
\[
S_6 = \{\{m_0, m_1\},\{m_2, m_3\},\{m_4, m_5\},\{m_6\},\{m_7\},\{m_8\}\}
\]
}
\only<7>{
\def\T{7}\fig{repeat/par}
\vspace{13mm}
\[
S_7 = \{\{m_0, m_1\},\{m_2,m_3\},\{m_4\},\{m_5\},\{m_6\},\{m_7\},\{m_8\}\}
\]
}
\only<8>{
\def\T{8}\fig{repeat/par}
\vspace{13mm}
\[
S_8 = \{\{m_0, m_1\},\{m_2\},\{m_3\},\{m_4\},\{m_5\},\{m_6\},\{m_7\},\{m_8\}\}
\]
}
\only<9>{
\begin{columns}
\begin{column}{\paperwidth}
\def\T{9}\fig{repeat/par}
\end{column}
\end{columns}
\vspace{25.8mm}
\[
S_9 = \{\{m_0\},\{m_1\},\{m_2\},\{m_3\},\{m_4\},\{m_5\},\{m_6\},\{m_7\},\{m_8\}\}
\]
}
% \begin{align*}
% \visible<1->{S_1 &= \{\{m_0, m_1, m_2, m_3, m_4, m_5, m_6, m_7, m_8\}\}}
% \visible<2->{\\S_2 &= \{\{m_0, m_1, m_2, m_3, m_4\}, \{m_5, m_6, m_7, m_8\}\}}
% \visible<3->{\\S_3 &= \{\{m_0, m_1, m_2\},\{m_3, m_4, m_5\}, \{m_6, m_7, m_8\}\}}
% \visible<4->{\\S_4 &= \{\{m_0, m_1, m_2\},\{m_3, m_4\},\{m_5, m_6\}, \{m_7, m_8\}\}}
% \end{align*}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Optimiser le nombre de PRNG}
%{{{ frame "
\begin{align*}
S_1 &= \{\{\tikzmark{s1e0b}m_0, m_1, m_2\tikzmark{s1e0e}, \tikzmark{s1e1b}m_3, m_4\tikzmark{s1e1e}, \tikzmark{s1e2b}m_5\tikzmark{s1e2e}, \tikzmark{s1e3b}m_6\tikzmark{s1e3e}, \tikzmark{s1e4b}m_7, m_8\tikzmark{s1e4e}\}\}\\
S_2 &= \{\{\tikzmark{s2e0b}m_0, m_1, m_2\tikzmark{s2e0e}, \tikzmark{s2e1b}m_3, m_4\tikzmark{s2e1e}\},\{\tikzmark{s2e2b}m_5\tikzmark{s2e2e}, \tikzmark{s2e3b}m_6\tikzmark{s2e3e}, \tikzmark{s2e4b}m_7, m_8\tikzmark{s2e4e}\}\}\\
S_3 &= \{\{\tikzmark{s3e0b}m_0, m_1, m_2\tikzmark{s3e0e}\},\{\tikzmark{s3e1b}m_3, m_4\tikzmark{s3e1e}, \tikzmark{s3e2b}m_5\tikzmark{s3e2e}\},\{\tikzmark{s3e3b}m_6\tikzmark{s3e3e}, \tikzmark{s3e4b}m_7, m_8\tikzmark{s3e4e}\}\}\\
S_4 &= \{\{\tikzmark{s4e0b}m_0, m_1, m_2\tikzmark{s4e0e}\},\{\tikzmark{s4e1b}m_3, m_4\tikzmark{s4e1e}\},\{\tikzmark{s4e2b}m_5\tikzmark{s4e2e}, \tikzmark{s4e3b}m_6\tikzmark{s4e3e}\},\{\tikzmark{s4e4b}m_7, m_8\tikzmark{s4e4e}\}\}
\end{align*}
\visible<2->{
\[
S = \{\{\tikzmark{se0b}m_0, m_1, m_2\tikzmark{se0e}\},\{\tikzmark{se1b}m_3, m_4\tikzmark{se1e}\},\{\tikzmark{se2b}m_5\tikzmark{se2e}\},\{\tikzmark{se3b}m_6\tikzmark{se3e}\},\{\tikzmark{se4b}m_7, m_8\tikzmark{se4e}\}\}
\]
}
\foreach[count=\s from 0] \col in
{red!90!black,yellow!80!black,green!90!black,cyan!80!black,blue!90!black} {%
\visible<+(2),8>{%
\tikz[remember picture,overlay,every node/.append style={common/rhl=\col}]{%
\foreach \i in {1,...,4} {%
\node[fit=(pic cs:s\i e\s b)(pic cs:s\i e\s e)]{};
}%
\node[fit=(pic cs:se\s b)(pic cs:se\s e)]{};
}%
}%
}%
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Nombre de PRNG nécessaires}
%{{{ frame "
\only<1>{\includegraphics{img/repeat/exp_0.pdf}}
\only<2>{\includegraphics{img/repeat/exp_1.pdf}}
\only<3>{\includegraphics{img/repeat/exp_2.pdf}}
%}}}
\end{frame}
%}}}

View File

@ -0,0 +1,26 @@
\subsection*{Résumé}
%{{{
\begin{frame}
%{{{ frame "
Plusieurs niveaux d'utilisation :
\begin{itemize}
\item conception de motifs d'exécution
\vspace{1ex}
\item implémentation de politiques d'exécution
\vspace{1ex}
\item définition de squelettes (bibliothèques spécialisées)
\vspace{1ex}
\item utilisation finale d'un squelette existant
\end{itemize}
\bigskip
Répétabilité :
\begin{itemize}
\item indépendante du nombre de \en{threads}
\item optimisée en fonction de la politique d'exécution
\end{itemize}
%}}}
\end{frame}
%}}}

5
src/defense/3_pfor.tex Normal file
View File

@ -0,0 +1,5 @@
\section{Parallélisation automatique de boucles}
\input{src/defense/3_pfor/0_ctanalysis}
\input{src/defense/3_pfor/1_edsl}
\input{src/defense/3_pfor/2_results}

View File

@ -0,0 +1,98 @@
\subsection{Analyse durant la compilation}
\tikzset{local/rhl/.style={common/rhl=#1,minimum height=2.3ex,rounded corners=.5mm}}
%{{{
\begin{frame}{Besoin}
%{{{ frame "
Temps d'exécution concentré dans les boucles
$\implies$ parallélisation des boucles
\bigskip
\begin{columns}
\begin{column}{.5\paperwidth}
\lstvisible<2->{intro/loop_par}
\lstvisible<3->{intro/loop_seq}
\lstvisible<4->{intro/loop_par_hard}
\end{column}
\end{columns}
\bigskip
\visible<5>{
Objectif de la bibliothèque :
\begin{itemize}
\item analyse automatique durant la compilation
\item génération automatique
\end{itemize}
}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Analyse}
%{{{ frame "
\framesubtitle<-5>{Conditions de Bernstein}
\framesubtitle<6-7>{Identification des boucles parallélisables}
\framesubtitle<8>{Résultat}
\begin{columns}
\begin{column}{.5\paperwidth}
\begin{overprint}
\onslide+<1-5>
\lst{pfor/loop}
\def\x{x}\def\y{y}
\only<4>{\def\x{2}\def\y{4}}
\only<5>{\def\x{3}\def\y{5}}
\begin{exampleblock}<2-4>{Indépendance de deux instructions x et y selon Bernstein}
\vspace{-3ex}
\begin{align*}
\only<3-4>{\color{red!80!black}}W_\y \cap R_\x &\only<3-4>{\color{red!80!black}}= \alt<3-4>{\{\alt<3>{b}{d}\}}{\emptyset}\\
\only<4>{\color{red!80!black}}R_\y \cap W_\x &\only<4>{\color{red!80!black}}= \alt<4>{\{c\}}{\emptyset}\\
W_\x \cap W_\y &= \emptyset
\end{align*}
\end{exampleblock}
\foreach \l/\os/\col in {b/3/red,c/4/green!60!red,d/4/green!60!blue} {
\visible<\os>{
\tikz[remember picture,overlay,every node/.append style={local/rhl=\col}]{
\node[fit=(pic cs:pforloop\l rb)(pic cs:pforloop\l re)]{};
\node[fit=(pic cs:pforloop\l wb)(pic cs:pforloop\l we)]{};
}
}
}
\visible<5>{
\tikz[remember picture,overlay]{
\foreach \l/\col in {2/red,3/green,4/red,5/green,6/blue} {
\node[fit=(pic cs:pforloopl\l b)(pic cs:pforloopl\l e),local/rhl=\col]{};
\node[fit=(pic cs:pforloopl\l b)(pic cs:pforloopl\l e),local/rhl=\col]{};
}
}
\vspace{-39pt}
\begin{itemize}
\item[$\to$] analyse des variables
\end{itemize}
}
\onslide+<6-7>
\lst{pfor/loop_split}
\visible<7>{
\tikz[remember picture,overlay,every node/.append style={local/rhl=red}]{
\node[fit=(pic cs:pforloopsplitcrb)(pic cs:pforloopsplitcre)]{};
\node[fit=(pic cs:pforloopsplitcwb)(pic cs:pforloopsplitcwe)]{};
}
\begin{itemize}
\item[$\to$] analyse des fonctions d'indice
\end{itemize}
}
\onslide+<8>
\lst{pfor/loop_par}
\end{overprint}
\end{column}
\end{columns}
%}}}
\end{frame}
%}}}

View File

@ -0,0 +1,18 @@
\subsection{Syntaxe du langage embarqué}
%{{{
\begin{frame}{Utilisation}
%{{{ frame "
\begin{columns}
\begin{column}{.49\paperwidth}
\center Boucle originale
\lst{pfor/loop_noanim}
\end{column}
\begin{column}{.49\paperwidth}
\center Boucle active
\lst{pfor/loop_pfor}
\end{column}
\end{columns}
%}}}
\end{frame}
%}}}

View File

@ -0,0 +1,37 @@
\subsection*{Performances}
%{{{
\begin{frame}{Performances}
%{{{ frame "
\framesubtitle<2>{Exécutions séquentielles}
\framesubtitle<3>{Exécutions parallèles}
\only<1>{
Contexte matériel et logiciel :
\vspace{1ex}
\begin{itemize}
\item Intel Xeon E7-8890 v3 -- \SI{2.5}{\GHz}
\vspace{1ex}
\item \num{18} cœurs
\vspace{1ex}
\item GCC 8.2.0 -- \texttt{-O2}
\vspace{1ex}
\item moyennes sur \num{20} exécutions
\vspace{1ex}
\item exécutions répétables
\end{itemize}
}
\only<2>{\includegraphics{img/pfor/rt_seq.pdf}}
\only<3>{\includegraphics{img/pfor/rt_par_18.pdf}}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Performances -- compilation}
%{{{ frame "
\includegraphics{img/pfor/ct.pdf}
%}}}
\end{frame}
%}}}

View File

@ -0,0 +1,59 @@
\section*{Conclusion}
%{{{
\begin{frame}{Bilan}
%{{{ frame "
\num{2} bibliothèques actives de parallélisation :
\begin{itemize}
\item abstraction sans surcoût à l'exécution
\item parallélisation assistée ou automatique
\end{itemize}
\bigskip
\begin{itemize}
\item Bibliothèque active de parallélisation assistée :
\begin{itemize}
\item squelettes algorithmiques
\item choix de la politique d'exécution
\item répétabilité garantie automatiquement
\item quelques squelettes pour la recherche opérationnelle
\end{itemize}
\vspace{1ex}
\item Bibliothèque active de parallélisation automatique de boucles :
\begin{itemize}
\item analyse à la compilation de l'AST
\begin{itemize}
\item \dots des variables pour les dépendances
\item \dots des fonctions d'indice pour la parallélisabilité
\end{itemize}
\end{itemize}
\end{itemize}
%}}}
\end{frame}
%}}}
%{{{
\begin{frame}{Limites et perspectives}
%{{{ frame "
Bibliothèque de parallélisation assistée :
\begin{itemize}
\item nouveaux motifs :
\begin{itemize}
\item \en{pipeline}
\item \en{divide and conquer}
\item \dots
\end{itemize}
\item politique d'exécution équilibrée pondérée
\end{itemize}
\bigskip
Bibliothèque de parallélisation automatique de boucles :
\begin{itemize}
\item généralisation de l'analyse des fonctions d'indice
\item transformation d'un code non parallélisable
\end{itemize}
%}}}
\end{frame}
%}}}

23
src/document.tex Normal file
View File

@ -0,0 +1,23 @@
\begin{document}
\begin{frame}[plain]
\titlepage
\end{frame}
{
\input{src/defense/0_intro}
{
\AtBeginSection{
\begin{frame}
\frametitle{Plan}
\tableofcontents[currentsection]
\end{frame}
}
\input{src/defense/1_context}
\input{src/defense/2_alsk}
\input{src/defense/3_pfor}
}
\input{src/defense/4_conclusion}
}
\end{document}

26
src/fig/alsk/farmsel.tex Normal file
View File

@ -0,0 +1,26 @@
\begin{tikzpicture}
\input{src/tikz/parallel}
\begin{scope}[node distance=6mm]
\begin{scope}[start chain=going below,every node/.style={on chain,join},parallel/arrow]
\node[parallel/block] (input) {};
\node[parallel/point] (fork) {};
\node[parallel/task] (main) {\dots};
\node[parallel/point] (join) {};
\node[parallel/task] (select) {T\textsubscript{S}};
\node[parallel/block] (output) {};
\end{scope}
\node[parallel/task,left=of main] (thread 0) {T\textsubscript{0}};
\node[parallel/task,right=of main] (thread n) {T\textsubscript{n-1}};
\end{scope}
\begin{scope}[on background layer]
\node[parallel/region=(thread 0)(main)(thread n)] {};
\end{scope}
\begin{scope}[parallel/arrow]
\draw (fork) -| (thread 0) |- (join);
\draw (fork) -| (thread n) |- (join);
\end{scope}
\end{tikzpicture}

23
src/fig/alsk/forkjoin.tex Normal file
View File

@ -0,0 +1,23 @@
\begin{tikzpicture}
\input{src/tikz/parallel}
\begin{scope}[node distance=8mm]
\begin{scope}[start chain=going below,every node/.style={on chain,join},parallel/arrow]
\node[parallel/block] (input) {};
\node[parallel/point] (fork) {};
\node[parallel/task] (main) {T\textsubscript{0}};
\node[parallel/point] (join) {};
\node[parallel/block] (output) {};
\end{scope}
\node[parallel/task,right=of main] (thread) {T\textsubscript{1}};
\end{scope}
\begin{scope}[on background layer]
\node[parallel/region=(main)(thread)] {};
\end{scope}
\begin{scope}[parallel/arrow]
\draw (fork) -| node[above,pos=.2]{\en{fork}} (thread) |- node[below,pos=.8]{\en{join}} (join);
\end{scope}
\end{tikzpicture}

72
src/fig/alsk/grasp.tex Normal file
View File

@ -0,0 +1,72 @@
\begin{tikzpicture}
\input{src/tikz/alsk}
%{{{ GRASP "
% Nodes
\matrix[row sep=3mm, column sep=-1mm] {
& \node[alsk/scheme/split] (split) {}; \\
\\
\node[alsk/scheme/task] (ch0) {CH}; & \node[alsk/label] (chi) {\bf\scriptsize\dots}; &
\node[alsk/scheme/task] (chn) {CH}; \\
\node[alsk/scheme/task] (ls0) {LS}; & \node[alsk/label] (lsi) {\bf\scriptsize\dots}; &
\node[alsk/scheme/task] (lsn) {LS}; \\
\\
& \node[alsk/scheme/join] (merge) {}; \\
& \node[alsk/scheme/task] (select) {S}; \\
};
\node[above=3mm of split] (entry) {};
\node[below=3mm of select] (return) {};
% Frames
\node[alsk/scheme/frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(ch0)(ls0),only on=<3>{ultra thick}] (serial0) {};
\node[alsk/scheme/frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(chn)(lsn),only on=<3>{ultra thick}] (serialn) {};
\node[alsk/scheme/frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(split)(select)(serial0)(serialn),only on=<3>{ultra thick}] (grasp) {};
% Links
\begin{scope}[alsk/scheme/link,only on=<4>{ultra thick}]
\draw[only on=<4>{colLinkIn}] (entry) -- (split);
\draw[only on=<4>{colLinkIn}] (split.210) -- (serial0.north);
\draw[only on=<4>{colLinkIn}] (split.330) -- (serialn.north);
\draw[only on=<4>{colLinkIn}] (serial0.north) -- (ch0);
\draw[only on=<4>{colLinkIn}] (serialn.north) -- (chn);
\draw[only on=<4>{colLinkOut!50!colLinkIn}] (ch0) -- (ls0);
\draw[only on=<4>{colLinkOut!50!colLinkIn}] (chn) -- (lsn);
\draw[only on=<4>{colLinkOut}] (ls0) -- (serial0.south);
\draw[only on=<4>{colLinkOut}] (lsn) -- (serialn.south);
\draw[only on=<4>{colLinkOut}] (serial0.south) -- (merge.150);
\draw[only on=<4>{colLinkOut}] (serialn.south) -- (merge.30);
\draw[only on=<4>{colLinkIn}] (merge) -- (select);
\draw[only on=<4>{colLinkOut}] (select) -- (return);
\end{scope}
%}}}
%{{{ animations "
%{{{ Muscles "
\visible<2>{
\node[alsk/scheme/task,ultra thick] at (ch0) {CH};
\node[alsk/scheme/task,ultra thick] at (chn) {CH};
\node[alsk/scheme/task,ultra thick] at (ls0) {LS};
\node[alsk/scheme/task,ultra thick] at (lsn) {LS};
\node[alsk/scheme/task,ultra thick] at (select) {S};
}
%}}}
%{{{ Structure "
\visible<3>{
\node[alsk/scheme/split,ultra thick] at (split) {};
\node[alsk/scheme/join,ultra thick] at (merge) {};
}
%}}}
%}}}
\end{tikzpicture}

View File

@ -0,0 +1,54 @@
\begin{tikzpicture}
\input{src/tikz/alsk}
%{{{ GRASP "
% Nodes
\matrix[row sep=3mm, column sep=-1mm] {
& \node[alsk/scheme/split] (split) {}; \\
\\
\node[alsk/scheme/task] (ch0) {CH}; & \node[alsk/label] (chi) {\bf\scriptsize\dots}; &
\node[alsk/scheme/task] (chn) {CH}; \\
\node[alsk/scheme/task] (ls0) {LS}; & \node[alsk/label] (lsi) {\bf\scriptsize\dots}; &
\node[alsk/scheme/task] (lsn) {LS}; \\
\\
& \node[alsk/scheme/join] (merge) {}; \\
& \node[alsk/scheme/task] (select) {S}; \\
};
\node[above=3mm of split] (entry) {};
\node[below=3mm of select] (return) {};
% Frames
\node[alsk/scheme/frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(ch0)(ls0)] (serial0) {};
\node[alsk/scheme/frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(chn)(lsn)] (serialn) {};
\node[alsk/scheme/frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(split)(select)(serial0)(serialn)] (grasp) {};
% Links
\begin{scope}[alsk/scheme/link]
\draw[only on=<2>{ultra thick,colLinkIn}] (entry) -- (split);
\draw[only on=<3>{ultra thick,colLinkIn}] (split.210) -- (serial0.north);
\draw[only on=<3>{ultra thick,colLinkIn}] (split.330) -- (serialn.north);
\draw[only on=<4>{ultra thick,colLinkIn}] (serial0.north) -- (ch0);
\draw[only on=<4>{ultra thick,colLinkIn}] (serialn.north) -- (chn);
\draw[only on=<5>{ultra thick,colLinkOut!50!colLinkIn}] (ch0) -- (ls0);
\draw[only on=<5>{ultra thick,colLinkOut!50!colLinkIn}] (chn) -- (lsn);
\draw[only on=<6>{ultra thick,colLinkOut}] (ls0) -- (serial0.south);
\draw[only on=<6>{ultra thick,colLinkOut}] (lsn) -- (serialn.south);
\draw[only on=<7>{ultra thick,colLinkOut}] (serial0.south) -- (merge.150);
\draw[only on=<7>{ultra thick,colLinkOut}] (serialn.south) -- (merge.30);
\draw[only on=<7>{ultra thick,colLinkIn}] (merge) -- (select);
\draw[only on=<{2,8}>{ultra thick,colLinkOut}] (select) -- (return);
\end{scope}
%}}}
\end{tikzpicture}

View File

@ -0,0 +1,75 @@
\begin{tikzpicture}
\input{src/tikz/alsk}
%{{{ GRASP "
% Nodes
\matrix[row sep=3mm, column sep=-1mm] {
& \node[alsk/scheme/split] (split) {}; \\
\\
\node[alsk/scheme/task] (ch0) {CH}; & \node[alsk/label] (chi) {\bf\scriptsize\dots}; &
\node[alsk/scheme/task] (chn) {CH}; \\
\node[alsk/scheme/task] (ls0) {LS}; & \node[alsk/label] (lsi) {\bf\scriptsize\dots}; &
\node[alsk/scheme/task] (lsn) {LS}; \\
\\
& \node[alsk/scheme/join] (merge) {}; \\
& \node[alsk/scheme/task] (select) {S}; \\
};
\node[above=3mm of split] (entry) {};
\node[below=3mm of select] (return) {};
% Frames
\node[alsk/scheme/frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(ch0)(ls0),only on=<3>{ultra thick},only on=<3>{solid,common/drawfill=colMuscle},
only on=<4>{ultra thick}] (serial0) {\only<3>{T}};
\node[alsk/scheme/frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(chn)(lsn),only on=<3>{ultra thick},only on=<3>{solid,common/drawfill=colMuscle},
only on=<4>{ultra thick}] (serialn) {\only<3>{T}};
\node[alsk/scheme/frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(split)(select)(serial0)(serialn),only on=<1>{ultra thick}] (grasp) {};
% Links
\begin{scope}[alsk/scheme/link]
\draw (entry) -- (split);
\draw (split.210) -- (serial0.north);
\draw (split.330) -- (serialn.north);
\visible<-2,4->{
\draw (serial0.north) -- (ch0);
\draw (serialn.north) -- (chn);
\draw (ch0) -- (ls0);
\draw (chn) -- (lsn);
\draw (ls0) -- (serial0.south);
\draw (lsn) -- (serialn.south);
}
\draw (serial0.south) -- (merge.150);
\draw (serialn.south) -- (merge.30);
\draw (merge) -- (select);
\draw (select) -- (return);
\end{scope}
%}}}
%{{{ animations "
\visible<2>{
\node[alsk/scheme/split,ultra thick] at (split) {};
\node[alsk/scheme/join,ultra thick] at (merge) {};
}
\visible<3>{
\node[alsk/scheme/task,ultra thick] at (select) {S};
}
\visible<5>{
\node[alsk/scheme/task,ultra thick] at (ch0) {CH};
\node[alsk/scheme/task,ultra thick] at (chn) {CH};
\node[alsk/scheme/task,ultra thick] at (ls0) {LS};
\node[alsk/scheme/task,ultra thick] at (lsn) {LS};
}
%}}}
%}}}
\end{tikzpicture}

133
src/fig/alsk/graspels.tex Normal file
View File

@ -0,0 +1,133 @@
\begin{tikzpicture}
\input{src/tikz/alsk}
\tikzset{split/.style={alsk/scheme/split,minimum width=8mm}}
\tikzset{task/.style={alsk/scheme/task,minimum width=6mm}}
\tikzset{join/.style={alsk/scheme/join,minimum width=8mm}}
\tikzset{loop/.style={alsk/scheme/loop,minimum width=6mm}}
\tikzset{frame/.style={alsk/scheme/frame=#1,inner sep=.5mm}}
% GRASP nodes
\matrix[row sep=2.5mm, column sep=-1mm] {
& \node[split,minimum width=8mm] (grasp split) {}; \\
\\
\node[task] (grasp ch0) {\scriptsize CH}; & \node[alsk/label] (grasp chi) {\scriptsize\dots}; &
\node[task] (grasp chn) {\scriptsize CH}; \\
\node[task] (grasp ls0) {}; & \node[alsk/label] (grasp lsi) {\scriptsize\dots}; &
\node[task] (grasp lsn) {}; \\
\\
& \node[join] (grasp merge) {}; \\
& \node[task] (grasp select) {\scriptsize Sel\textsubscript{1}}; \\
};
\node[above=3mm of grasp split] (grasp entry) {};
\node[below=3mm of grasp select] (grasp return) {};
% Frames
\node[frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(grasp ch0)(grasp ls0)] (grasp serial0) {};
\node[frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(grasp chn)(grasp lsn)] (grasp serialn) {};
\node[frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(grasp split)(grasp select)(grasp serial0)(grasp serialn)] {};
% GRASP Links
\begin{scope}[alsk/scheme/link]
\draw (grasp entry) -- (grasp split);
\draw (grasp split.210) -- (grasp serial0.north);
\draw (grasp split.330) -- (grasp serialn.north);
\draw (grasp serial0.north) -- (grasp ch0);
\draw (grasp serialn.north) -- (grasp chn);
\draw (grasp ch0) -- (grasp ls0);
\draw (grasp chn) -- (grasp lsn);
\draw (grasp ls0) -- (grasp serial0.south);
\draw (grasp lsn) -- (grasp serialn.south);
\draw (grasp serial0.south) -- (grasp merge.150);
\draw (grasp serialn.south) -- (grasp merge.30);
\draw (grasp merge) -- (grasp select);
\draw (grasp select) -- (grasp return);
\end{scope}
% ELS
\begin{scope}[common/overlay,spy using outlines={circle,magnification=.095,size=6.0mm}]
\begin{scope}[every node/.append style={transform shape,scale=.7}]
\matrix[row sep=1.5mm, column sep=-1mm] (els) at (5, 0) {
& \node[task] (els init ls) {\scriptsize iLS}; \\
& \node[loop] (els loopbegin) {}; \\
& \node[split] (els split) {}; \\
\\
\node[task] (els m0) {\scriptsize M}; & \node[alsk/label] (els mi) {\dots}; &
\node[task] (els mn) {\scriptsize M}; \\
\node[task] (els ls0) {\scriptsize LS}; & \node[alsk/label] (els lsi) {\dots}; &
\node[task] (els lsn) {\scriptsize LS}; \\
\\
& \node[join] (els merge) {}; \\
& \node[task] (els select2) {\scriptsize Sel\textsubscript{2}}; \\
& \node[task] (els select3) {\scriptsize Sel\textsubscript{3}}; \\
& \node[task] (els accept) {\scriptsize A}; \\
& \node[loop] (els loopend) {}; \\
};
\node[above=1.5mm of els init ls] (els entry) {};
\node[below=1.5mm of els loopend] (els return) {};
% Frames
\node[frame=colStruct,fit margins={top=2mm,bottom=2mm,left=1.2mm,right=1.2mm},
fit=(els m0)(els ls0)] (els serial0) {};
\node[frame=colStruct,fit margins={top=2mm,bottom=2mm,left=1.2mm,right=1.2mm},
fit=(els mn)(els lsn)] (els serialn) {};
\node[frame=colStruct,fit margins={top=4.4mm,bottom=4mm,left=2.8mm,right=2.8mm},
fit=(els split)(els select2)(els serial0)(els serialn)] {};
% Links
\begin{scope}[alsk/scheme/link]
\draw (els entry) -- (els init ls);
\draw (els init ls) -- (els loopbegin);
\draw (els loopbegin) -- (els split);
\draw (els split.210) -- (els serial0.north);
\draw (els split.330) -- (els serialn.north);
\draw (els serial0.north) -- (els m0);
\draw (els serialn.north) -- (els mn);
\draw (els m0) -- (els ls0);
\draw (els mn) -- (els lsn);
\draw (els ls0) -- (els serial0.south);
\draw (els lsn) -- (els serialn.south);
\draw (els serial0.south) -- (els merge.150);
\draw (els serialn.south) -- (els merge.30);
\draw (els merge) -- (els select2);
\draw (els select2) -- (els select3);
\draw (els select3) -- (els accept);
\draw (els accept) -- (els loopend);
\end{scope}
\draw[alsk/scheme/link] (els loopend) -| +(-12mm, 0) |- ([xshift=-6mm]els loopbegin.west)
-- (els loopbegin);
\draw[alsk/scheme/link] (els loopend) -- (els return);
\end{scope}
\spy[densely dotted,thick,colMuscle] on (els) in node at (grasp ls0);
\spy[densely dotted,thick,colMuscle,connect spies] on (els) in node at (grasp lsn);
\end{scope}
% Bounding box adjustments
\node[rectangle,fit=(els)(els entry)(els return),fit margins={right=3mm}]{};
\end{tikzpicture}

12
src/fig/alsk/seq.tex Normal file
View File

@ -0,0 +1,12 @@
\begin{tikzpicture}
\input{src/tikz/parallel}
\begin{scope}[node distance=8mm]
\begin{scope}[start chain=going below,every node/.style={on chain,join},parallel/arrow]
\node[parallel/block] (input) {};
\node[parallel/task] (main) {T\textsubscript{0}};
\node[parallel/task] (main) {T\textsubscript{1}};
\node[parallel/block] (output) {};
\end{scope}
\end{scope}
\end{tikzpicture}

View File

@ -0,0 +1,6 @@
\begin{tikzpicture}
\input{src/tikz/alsk}
\begin{scope}[alsk/treestyle]
\Tree[.FarmSel [.Serial CH LS ] S ]
\end{scope}
\end{tikzpicture}

133
src/fig/app/graspels.tex Normal file
View File

@ -0,0 +1,133 @@
\begin{tikzpicture}
\input{src/tikz/alsk}
\tikzset{split/.style={alsk/scheme/split,minimum width=8mm}}
\tikzset{task/.style={alsk/scheme/task,minimum width=6mm}}
\tikzset{join/.style={alsk/scheme/join,minimum width=8mm}}
\tikzset{loop/.style={alsk/scheme/loop,minimum width=6mm}}
\tikzset{frame/.style={alsk/scheme/frame=#1,inner sep=.5mm}}
% GRASP nodes
\matrix[row sep=2.5mm, column sep=-1mm] {
& \node[split,minimum width=8mm] (grasp split) {}; \\
\\
\node[task] (grasp ch0) {\scriptsize CH}; & \node[alsk/label] (grasp chi) {\scriptsize\dots}; &
\node[task] (grasp chn) {\scriptsize CH}; \\
\node[task] (grasp ls0) {}; & \node[alsk/label] (grasp lsi) {\scriptsize\dots}; &
\node[task] (grasp lsn) {}; \\
\\
& \node[join] (grasp merge) {}; \\
& \node[task] (grasp select) {\scriptsize Sel\textsubscript{1}}; \\
};
\node[above=3mm of grasp split] (grasp entry) {};
\node[below=3mm of grasp select] (grasp return) {};
% Frames
\node[frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(grasp ch0)(grasp ls0)] (grasp serial0) {};
\node[frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(grasp chn)(grasp lsn)] (grasp serialn) {};
\node[frame=colStruct,fit margins={top=1.5mm,bottom=1.5mm},
fit=(grasp split)(grasp select)(grasp serial0)(grasp serialn)] {};
% GRASP Links
\begin{scope}[alsk/scheme/link]
\draw (grasp entry) -- (grasp split);
\draw (grasp split.210) -- (grasp serial0.north);
\draw (grasp split.330) -- (grasp serialn.north);
\draw (grasp serial0.north) -- (grasp ch0);
\draw (grasp serialn.north) -- (grasp chn);
\draw (grasp ch0) -- (grasp ls0);
\draw (grasp chn) -- (grasp lsn);
\draw (grasp ls0) -- (grasp serial0.south);
\draw (grasp lsn) -- (grasp serialn.south);
\draw (grasp serial0.south) -- (grasp merge.150);
\draw (grasp serialn.south) -- (grasp merge.30);
\draw (grasp merge) -- (grasp select);
\draw (grasp select) -- (grasp return);
\end{scope}
% ELS
\begin{scope}[common/overlay,spy using outlines={circle,magnification=.095,size=6.0mm}]
\begin{scope}[every node/.append style={transform shape,scale=.7}]
\matrix[row sep=1.5mm, column sep=-1mm] (els) at (5, 0) {
& \node[task] (els init ls) {\scriptsize iLS}; \\
& \node[loop] (els loopbegin) {}; \\
& \node[split] (els split) {}; \\
\\
\node[task] (els m0) {\scriptsize M}; & \node[alsk/label] (els mi) {\dots}; &
\node[task] (els mn) {\scriptsize M}; \\
\node[task] (els ls0) {\scriptsize LS}; & \node[alsk/label] (els lsi) {\dots}; &
\node[task] (els lsn) {\scriptsize LS}; \\
\\
& \node[join] (els merge) {}; \\
& \node[task] (els select2) {\scriptsize Sel\textsubscript{2}}; \\
& \node[task] (els select3) {\scriptsize Sel\textsubscript{3}}; \\
& \node[task] (els accept) {\scriptsize A}; \\
& \node[loop] (els loopend) {}; \\
};
\node[above=1.5mm of els init ls] (els entry) {};
\node[below=1.5mm of els loopend] (els return) {};
% Frames
\node[frame=colStruct,fit margins={top=2mm,bottom=2mm,left=1.2mm,right=1.2mm},
fit=(els m0)(els ls0)] (els serial0) {};
\node[frame=colStruct,fit margins={top=2mm,bottom=2mm,left=1.2mm,right=1.2mm},
fit=(els mn)(els lsn)] (els serialn) {};
\node[frame=colStruct,fit margins={top=4.4mm,bottom=4mm,left=2.8mm,right=2.8mm},
fit=(els split)(els select2)(els serial0)(els serialn)] {};
% Links
\begin{scope}[alsk/scheme/link]
\draw (els entry) -- (els init ls);
\draw (els init ls) -- (els loopbegin);
\draw (els loopbegin) -- (els split);
\draw (els split.210) -- (els serial0.north);
\draw (els split.330) -- (els serialn.north);
\draw (els serial0.north) -- (els m0);
\draw (els serialn.north) -- (els mn);
\draw (els m0) -- (els ls0);
\draw (els mn) -- (els lsn);
\draw (els ls0) -- (els serial0.south);
\draw (els lsn) -- (els serialn.south);
\draw (els serial0.south) -- (els merge.150);
\draw (els serialn.south) -- (els merge.30);
\draw (els merge) -- (els select2);
\draw (els select2) -- (els select3);
\draw (els select3) -- (els accept);
\draw (els accept) -- (els loopend);
\end{scope}
\draw[alsk/scheme/link] (els loopend) -| +(-12mm, 0) |- ([xshift=-6mm]els loopbegin.west)
-- (els loopbegin);
\draw[alsk/scheme/link] (els loopend) -- (els return);
\end{scope}
\spy[densely dotted,thick,colMuscle] on (els) in node at (grasp ls0);
\spy[densely dotted,thick,colMuscle,connect spies] on (els) in node at (grasp lsn);
\end{scope}
% Bounding box adjustments
\node[rectangle,fit=(els)(els entry)(els return),fit margins={right=3mm}]{};
\end{tikzpicture}

104
src/fig/app/tspels.tex Normal file
View File

@ -0,0 +1,104 @@
\begin{tikzpicture}
\input{src/tikz/tsp}
\tspnodes
\def\bhstep{2.6}
\def\shstep{.75}
\def\vstep{-1.5}
\def\ratioodd{.666}
\def\ratioeven{.85}
%{{{ first line "
\def\cl{1}
\begin{scope}[visible on=<3->,every path/.append style={visible on=<3->}]
\foreach \i in {0,...,\last} {
\coordinate (p-\cl-\i) at ($(p\i)!\ratioodd!(0,0)+(0,\vstep*\cl)$);
\node[tsp/node,minimum size=2pt] at (p-\cl-\i) {};
}
%{{{ boxes "
\begin{scope}[on background layer]
\node[fit=(p-\cl-0)(p-\cl-1)(p-\cl-2)(p-\cl-3)(p-\cl-4)(p-\cl-5)(p-\cl-6)(p-\cl-7)(p-\cl-8)(p-\cl-9),
rectangle,rounded corners] (sol-\cl) {};
\end{scope}
%}}}
\foreach [count=\i from 0] \o in {2,1,0,9,8,7,4,3,5,6} { \coordinate (s-\cl-\i) at (p-\cl-\o); }
\begin{scope}[on background layer]
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1)}] (s-\cl-0) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
\end{scope}
%}}}
%{{{ second line "
\def\cl{2}
\begin{scope}[visible on=<4->,every path/.append style={visible on=<4->}]
\foreach \l in {0,...,2} {
\foreach \i in {0,...,\last} {
\coordinate (p-\cl-\i-\l) at ($(p\i)!\ratioeven!(0,0)+(\shstep*\l-.47,\vstep*\cl+.5)$);
\node[tsp/node,minimum size=1pt] at (p-\cl-\i-\l) {};
}
% box
\begin{scope}[on background layer]
\ifthenelse{\l=2}
{\tikzset{local/.style={only on=<5>{tsp/best,thin}}}}
{\tikzset{local/.style={}}}
\node[fit=(p-\cl-0-\l)(p-\cl-1-\l)(p-\cl-2-\l)(p-\cl-3-\l)(p-\cl-4-\l)(p-\cl-5-\l)(p-\cl-6-\l)(p-\cl-7-\l)(p-\cl-8-\l)(p-\cl-9-\l),
local,rectangle,rounded corners,inner sep=1pt] (sol-\cl-\l) {};
\end{scope}
}
%{{{ third column "
\foreach [count=\i from 0] \o in {2,1,0,4,8,7,9,3,5,6} { \coordinate (s-\cl-\i-0) at (p-\cl-\o-0); }
\foreach [count=\i from 0] \o in {2,3,0,9,8,7,4,1,5,6} { \coordinate (s-\cl-\i-1) at (p-\cl-\o-1); }
\foreach [count=\i from 0] \o in {2,1,0,9,8,7,4,6,5,3} { \coordinate (s-\cl-\i-2) at (p-\cl-\o-2); }
\begin{scope}[on background layer]
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-0)}] (s-\cl-0-0) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-1)}] (s-\cl-0-1) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-2)}] (s-\cl-0-2) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
%}}}
\end{scope}
%}}}
%{{{ third line "
\def\cl{3}
\begin{scope}[visible on=<6->,every path/.append style={visible on=<6->}]
\foreach \i in {0,...,\last} {
\coordinate (p-\cl-\i) at ($(p\i)!\ratioodd!(0,0)+(0,\vstep*\cl+.5)$);
\node[tsp/node,minimum size=2pt] at (p-\cl-\i) {};
}
\foreach [count=\i from 0] \o in {2,1,0,9,8,7,4,6,5,3} { \coordinate (s-\cl-\i) at (p-\cl-\o); }
\foreach \i in {0,...,\last} {
\node[tsp/node,minimum size=2pt] at (p-\cl-\i) {};
}
%{{{ boxes "
\begin{scope}[on background layer]
\node[fit=(p-\cl-0)(p-\cl-1)(p-\cl-2)(p-\cl-3)(p-\cl-4)(p-\cl-5)(p-\cl-6)(p-\cl-7)(p-\cl-8)(p-\cl-9),
rectangle,rounded corners] (sol-\cl) {};
\end{scope}
%}}}
\begin{scope}[on background layer]
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1)}] (s-\cl-0) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
\end{scope}
%}}}
%{{{ links "
\foreach \l in {0,...,2} {
\draw[<-,>=stealth,visible on=<4->] (sol-2-\l) -- (sol-1);
}
\foreach \l in {0,...,2} {
\draw[->,>=stealth,visible on=<6->] (sol-2-\l) -- (sol-3);
}
%}}}
%{{{ loop "
\draw[->,>=stealth,semithick,rounded corners,visible on=<7>] (sol-3.south) -- ++(0,-3mm) -| ([xshift=-5mm]sol-1.west) -- (sol-1);
%}}}
\end{tikzpicture}

330
src/fig/app/tspgraspels.tex Normal file
View File

@ -0,0 +1,330 @@
\begin{tikzpicture}
\input{src/tikz/tsp}
\tspnodes
\def\bhstep{2.6}
\def\shstep{.75}
\def\vstep{-1.5}
\def\ratioodd{.666}
\def\ratioeven{.85}
%{{{ first line "
\def\cl{1}
\begin{scope}[visible on=<1->,every path/.append style={visible on=<1->}]
\foreach \i in {0,...,\last} {
\foreach \j in {0,...,3} {
\coordinate (p-\cl-\i-\j) at ($(p\i)!\ratioodd!(0,0)+(\bhstep*\j,\vstep*\cl)$);
\node[tsp/node,minimum size=2pt] at (p-\cl-\i-\j) {};
}
}
%{{{ boxes "
\begin{scope}[on background layer]
\def\cc{0}
\node[fit=(p-\cl-0-\cc)(p-\cl-1-\cc)(p-\cl-2-\cc)(p-\cl-3-\cc)(p-\cl-4-\cc)(p-\cl-5-\cc)(p-\cl-6-\cc)(p-\cl-7-\cc)(p-\cl-8-\cc)(p-\cl-9-\cc),
rectangle,rounded corners] (sol-\cl-\cc) {};
\end{scope}
\begin{scope}[on background layer]
\def\cc{1}
\node[fit=(p-\cl-0-\cc)(p-\cl-1-\cc)(p-\cl-2-\cc)(p-\cl-3-\cc)(p-\cl-4-\cc)(p-\cl-5-\cc)(p-\cl-6-\cc)(p-\cl-7-\cc)(p-\cl-8-\cc)(p-\cl-9-\cc),
rectangle,rounded corners] (sol-\cl-\cc) {};
\end{scope}
\begin{scope}[on background layer]
\def\cc{2}
\node[fit=(p-\cl-0-\cc)(p-\cl-1-\cc)(p-\cl-2-\cc)(p-\cl-3-\cc)(p-\cl-4-\cc)(p-\cl-5-\cc)(p-\cl-6-\cc)(p-\cl-7-\cc)(p-\cl-8-\cc)(p-\cl-9-\cc),
rectangle,rounded corners] (sol-\cl-\cc) {};
\end{scope}
\begin{scope}[on background layer]
\def\cc{3}
\node[fit=(p-\cl-0-\cc)(p-\cl-1-\cc)(p-\cl-2-\cc)(p-\cl-3-\cc)(p-\cl-4-\cc)(p-\cl-5-\cc)(p-\cl-6-\cc)(p-\cl-7-\cc)(p-\cl-8-\cc)(p-\cl-9-\cc),
rectangle,rounded corners] (sol-\cl-\cc) {};
\end{scope}
%}}}
\foreach [count=\i from 0] \o in {0,9,1,8,7,6,4,2,3,5} { \coordinate (s-\cl-\i-0) at (p-\cl-\o-0); }
\foreach [count=\i from 0] \o in {4,5,3,6,8,7,1,2,0,9} { \coordinate (s-\cl-\i-1) at (p-\cl-\o-1); }
\foreach [count=\i from 0] \o in {2,1,0,9,8,7,4,3,5,6} { \coordinate (s-\cl-\i-2) at (p-\cl-\o-2); }
\foreach [count=\i from 0] \o in {8,7,6,4,5,1,9,0,2,3} { \coordinate (s-\cl-\i-3) at (p-\cl-\o-3); }
\begin{scope}[on background layer]
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1-0)}] (s-\cl-0-0) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1-1)}] (s-\cl-0-1) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1-2)}] (s-\cl-0-2) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1-3)}] (s-\cl-0-3) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
\end{scope}
%}}}
%{{{ second line "
\def\cl{2}
\begin{scope}[visible on=<2->,every path/.append style={visible on=<2->}]
\foreach \j in {0,...,3} {
\foreach \l in {0,...,2} {
\foreach \i in {0,...,\last} {
\coordinate (p-\cl-\i-\j-\l) at ($(p\i)!\ratioeven!(0,0)+(\bhstep*\j+\shstep*\l-.47,\vstep*\cl+.5)$);
\node[tsp/node,minimum size=1pt] at (p-\cl-\i-\j-\l) {};
}
% box
\begin{scope}[on background layer]
\ifthenelse{\(\j=0 \AND \l=1\) \OR \(\j=1 \AND \l=0\) \OR \(\j=2 \AND \l=2\) \OR \(\j=3 \AND \l=2\)}
{\tikzset{local/.style={only on=<3>{tsp/best,thin}}}}
{\tikzset{local/.style={}}}
\node[fit=(p-\cl-0-\j-\l)(p-\cl-1-\j-\l)(p-\cl-2-\j-\l)(p-\cl-3-\j-\l)(p-\cl-4-\j-\l)(p-\cl-5-\j-\l)(p-\cl-6-\j-\l)(p-\cl-7-\j-\l)(p-\cl-8-\j-\l)(p-\cl-9-\j-\l),
local,rectangle,rounded corners,inner sep=1pt] (sol-\cl-\j-\l) {};
\end{scope}
}
}
%{{{ first column "
\foreach [count=\i from 0] \o in {0,9,8,1,7,6,4,2,3,5} { \coordinate (s-\cl-\i-0-0) at (p-\cl-\o-0-0); }
\foreach [count=\i from 0] \o in {0,9,1,8,7,6,4,5,3,2} { \coordinate (s-\cl-\i-0-1) at (p-\cl-\o-0-1); }
\foreach [count=\i from 0] \o in {0,2,1,8,7,6,4,9,3,5} { \coordinate (s-\cl-\i-0-2) at (p-\cl-\o-0-2); }
\begin{scope}[on background layer]
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-0-0)}] (s-\cl-0-0-0) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-0-1)}] (s-\cl-0-0-1) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-0-2)}] (s-\cl-0-0-2) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
%}}}
%{{{ second column "
\foreach [count=\i from 0] \o in {4,5,3,6,8,7,1,9,0,2} { \coordinate (s-\cl-\i-1-0) at (p-\cl-\o-1-0); }
\foreach [count=\i from 0] \o in {4,3,5,6,8,7,1,2,0,9} { \coordinate (s-\cl-\i-1-1) at (p-\cl-\o-1-1); }
\foreach [count=\i from 0] \o in {4,5,3,2,8,7,1,6,0,9} { \coordinate (s-\cl-\i-1-2) at (p-\cl-\o-1-2); }
\begin{scope}[on background layer]
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-1-0)}] (s-\cl-0-1-0) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-1-1)}] (s-\cl-0-1-1) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-1-2)}] (s-\cl-0-1-2) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
%}}}
%{{{ third column "
\foreach [count=\i from 0] \o in {2,1,0,4,8,7,9,3,5,6} { \coordinate (s-\cl-\i-2-0) at (p-\cl-\o-2-0); }
\foreach [count=\i from 0] \o in {2,3,0,9,8,7,4,1,5,6} { \coordinate (s-\cl-\i-2-1) at (p-\cl-\o-2-1); }
\foreach [count=\i from 0] \o in {2,1,0,9,8,7,4,6,5,3} { \coordinate (s-\cl-\i-2-2) at (p-\cl-\o-2-2); }
\begin{scope}[on background layer]
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-2-0)}] (s-\cl-0-2-0) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-2-1)}] (s-\cl-0-2-1) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-2-2)}] (s-\cl-0-2-2) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
%}}}
%{{{ fourth column "
\foreach [count=\i from 0] \o in {8,1,6,4,5,7,9,0,2,3} { \coordinate (s-\cl-\i-3-0) at (p-\cl-\o-3-0); }
\foreach [count=\i from 0] \o in {8,4,6,7,5,1,9,0,2,3} { \coordinate (s-\cl-\i-3-1) at (p-\cl-\o-3-1); }
\foreach [count=\i from 0] \o in {5,7,6,4,8,1,9,0,2,3} { \coordinate (s-\cl-\i-3-2) at (p-\cl-\o-3-2); }
\begin{scope}[on background layer]
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-3-0)}] (s-\cl-0-3-0) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-3-1)}] (s-\cl-0-3-1) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-3-2)}] (s-\cl-0-3-2) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
%}}}
\end{scope}
%}}}
%{{{ third line "
\def\cl{3}
\begin{scope}[visible on=<4->,every path/.append style={visible on=<4->}]
\foreach \i in {0,...,\last} {
\foreach \j in {0,...,3} {
\coordinate (p-\cl-\i-\j) at ($(p\i)!\ratioodd!(0,0)+(\bhstep*\j,\vstep*\cl+.5)$);
\node[tsp/node,minimum size=2pt] at (p-\cl-\i-\j) {};
}
}
\foreach [count=\i from 0] \o in {0,9,1,8,7,6,4,5,3,2} { \coordinate (s-\cl-\i-0) at (p-\cl-\o-0); }
\foreach [count=\i from 0] \o in {4,5,3,6,8,7,1,9,0,2} { \coordinate (s-\cl-\i-1) at (p-\cl-\o-1); }
\foreach [count=\i from 0] \o in {2,1,0,9,8,7,4,6,5,3} { \coordinate (s-\cl-\i-2) at (p-\cl-\o-2); }
\foreach [count=\i from 0] \o in {5,7,6,4,8,1,9,0,2,3} { \coordinate (s-\cl-\i-3) at (p-\cl-\o-3); }
\foreach \j in {0,...,3} {
\foreach \i in {0,...,\last} {
\node[tsp/node,minimum size=2pt] at (p-\cl-\i-\j) {};
}
}
%{{{ boxes "
\begin{scope}[on background layer]
\def\cc{0}% best
\node[fit=(p-\cl-0-\cc)(p-\cl-1-\cc)(p-\cl-2-\cc)(p-\cl-3-\cc)(p-\cl-4-\cc)(p-\cl-5-\cc)(p-\cl-6-\cc)(p-\cl-7-\cc)(p-\cl-8-\cc)(p-\cl-9-\cc),
only on=<4-7>{tsp/best},only on=<8>{tsp/localbest},rectangle,rounded corners] (sol-\cl-\cc) {};
\end{scope}
\begin{scope}[on background layer]
\def\cc{1}% best
\node[fit=(p-\cl-0-\cc)(p-\cl-1-\cc)(p-\cl-2-\cc)(p-\cl-3-\cc)(p-\cl-4-\cc)(p-\cl-5-\cc)(p-\cl-6-\cc)(p-\cl-7-\cc)(p-\cl-8-\cc)(p-\cl-9-\cc),
only on=<4-7>{tsp/best},only on=<8>{tsp/localbest},rectangle,rounded corners] (sol-\cl-\cc) {};
\end{scope}
\begin{scope}[on background layer]
\def\cc{2}
\node[fit=(p-\cl-0-\cc)(p-\cl-1-\cc)(p-\cl-2-\cc)(p-\cl-3-\cc)(p-\cl-4-\cc)(p-\cl-5-\cc)(p-\cl-6-\cc)(p-\cl-7-\cc)(p-\cl-8-\cc)(p-\cl-9-\cc),
only on=<4-6>{tsp/best},rectangle,rounded corners] (sol-\cl-\cc) {};
\end{scope}
\begin{scope}[on background layer]
\def\cc{3}
\node[fit=(p-\cl-0-\cc)(p-\cl-1-\cc)(p-\cl-2-\cc)(p-\cl-3-\cc)(p-\cl-4-\cc)(p-\cl-5-\cc)(p-\cl-6-\cc)(p-\cl-7-\cc)(p-\cl-8-\cc)(p-\cl-9-\cc),
only on=<4-6>{tsp/best},rectangle,rounded corners] (sol-\cl-\cc) {};
\end{scope}
%}}}
\begin{scope}[on background layer]
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1-0)}] (s-\cl-0-0) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1-1)}] (s-\cl-0-1) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1-2)}] (s-\cl-0-2) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1-3)}] (s-\cl-0-3) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
\end{scope}
%}}}
%{{{ fourth line "
\def\cl{4}
\begin{scope}[visible on=<5->,every path/.append style={visible on=<5->}]
\foreach \j in {0,...,3} {
\foreach \l in {0,...,2} {
\foreach \i in {0,...,\last} {
\coordinate (p-\cl-\i-\j-\l) at ($(p\i)!\ratioeven!(0,0)+(\bhstep*\j+\shstep*\l-.47,\vstep*\cl+1)$);
\node[tsp/node,minimum size=1pt] at (p-\cl-\i-\j-\l) {};
}
% box
\begin{scope}[on background layer]
\ifthenelse{\(\j=0 \AND \l=2\) \OR \(\j=1 \AND \l=0\) \OR \(\j=2 \AND \l=1\) \OR \(\j=3 \AND \l=0\)}
{\tikzset{local/.style={only on=<6>{tsp/best,thin}}}}
{\tikzset{local/.style={}}}
\node[fit=(p-\cl-0-\j-\l)(p-\cl-1-\j-\l)(p-\cl-2-\j-\l)(p-\cl-3-\j-\l)(p-\cl-4-\j-\l)(p-\cl-5-\j-\l)(p-\cl-6-\j-\l)(p-\cl-7-\j-\l)(p-\cl-8-\j-\l)(p-\cl-9-\j-\l),
local,rectangle,rounded corners,inner sep=1pt] (sol-\cl-\j-\l) {};
\end{scope}
}
}
%{{{ first column "
\foreach [count=\i from 0] \o in {0,1,9,8,7,6,4,5,3,2} { \coordinate (s-\cl-\i-0-0) at (p-\cl-\o-0-0); }
\foreach [count=\i from 0] \o in {0,9,3,8,7,6,4,5,1,2} { \coordinate (s-\cl-\i-0-1) at (p-\cl-\o-0-1); }
\foreach [count=\i from 0] \o in {0,9,1,8,7,6,5,4,3,2} { \coordinate (s-\cl-\i-0-2) at (p-\cl-\o-0-2); }
\begin{scope}[on background layer]
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-0-0)}] (s-\cl-0-0-0) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-0-1)}] (s-\cl-0-0-1) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-0-2)}] (s-\cl-0-0-2) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
%}}}
%{{{ second column "
\foreach [count=\i from 0] \o in {5,4,3,6,8,7,1,9,0,2} { \coordinate (s-\cl-\i-1-0) at (p-\cl-\o-1-0); }
\foreach [count=\i from 0] \o in {8,5,3,6,4,7,1,9,0,2} { \coordinate (s-\cl-\i-1-1) at (p-\cl-\o-1-1); }
\foreach [count=\i from 0] \o in {7,5,3,6,8,4,1,9,0,2} { \coordinate (s-\cl-\i-1-2) at (p-\cl-\o-1-2); }
\begin{scope}[on background layer]
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-1-0)}] (s-\cl-0-1-0) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-1-1)}] (s-\cl-0-1-1) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-1-2)}] (s-\cl-0-1-2) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
%}}}
%{{{ third column "
\foreach [count=\i from 0] \o in {2,8,0,9,1,7,4,6,5,3} { \coordinate (s-\cl-\i-2-0) at (p-\cl-\o-2-0); }
\foreach [count=\i from 0] \o in {2,1,0,9,8,7,6,4,5,3} { \coordinate (s-\cl-\i-2-1) at (p-\cl-\o-2-1); }
\foreach [count=\i from 0] \o in {2,1,0,5,8,7,4,6,9,3} { \coordinate (s-\cl-\i-2-2) at (p-\cl-\o-2-2); }
\begin{scope}[on background layer]
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-2-0)}] (s-\cl-0-2-0) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-2-1)}] (s-\cl-0-2-1) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-2-2)}] (s-\cl-0-2-2) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
%}}}
%{{{ fourth column "
\foreach [count=\i from 0] \o in {5,6,7,4,8,1,9,0,2,3} { \coordinate (s-\cl-\i-3-0) at (p-\cl-\o-3-0); }
\foreach [count=\i from 0] \o in {5,7,6,4,8,1,3,0,2,9} { \coordinate (s-\cl-\i-3-1) at (p-\cl-\o-3-1); }
\foreach [count=\i from 0] \o in {5,7,6,4,2,1,9,0,8,3} { \coordinate (s-\cl-\i-3-2) at (p-\cl-\o-3-2); }
\begin{scope}[on background layer]
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-3-0)}] (s-\cl-0-3-0) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-3-1)}] (s-\cl-0-3-1) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,very thin,foreach/.style={insert path=--(s-\cl-#1-3-2)}] (s-\cl-0-3-2) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
%}}}
\end{scope}
%}}}
%{{{ fifth line "
\def\cl{5}
\begin{scope}[visible on=<7->,every path/.append style={visible on=<7->}]
\foreach \i in {0,...,\last} {
\foreach \j in {0,...,3} {
\coordinate (p-\cl-\i-\j) at ($(p\i)!\ratioodd!(0,0)+(\bhstep*\j,\vstep*\cl+1)$);
\node[tsp/node,minimum size=2pt] at (p-\cl-\i-\j) {};
}
}
\foreach [count=\i from 0] \o in {0,9,1,8,7,6,5,4,3,2} { \coordinate (s-\cl-\i-0) at (p-\cl-\o-0); }
\foreach [count=\i from 0] \o in {5,4,3,6,8,7,1,9,0,2} { \coordinate (s-\cl-\i-1) at (p-\cl-\o-1); }
\foreach [count=\i from 0] \o in {2,1,0,9,8,7,6,4,5,3} { \coordinate (s-\cl-\i-2) at (p-\cl-\o-2); }
\foreach [count=\i from 0] \o in {5,6,7,4,8,1,9,0,2,3} { \coordinate (s-\cl-\i-3) at (p-\cl-\o-3); }
\foreach \j in {0,...,3} {
\foreach \i in {0,...,\last} {
\node[tsp/node,minimum size=2pt] at (p-\cl-\i-\j) {};
}
}
%{{{ boxes "
\begin{scope}[on background layer]
\def\cc{0}
\node[fit=(p-\cl-0-\cc)(p-\cl-1-\cc)(p-\cl-2-\cc)(p-\cl-3-\cc)(p-\cl-4-\cc)(p-\cl-5-\cc)(p-\cl-6-\cc)(p-\cl-7-\cc)(p-\cl-8-\cc)(p-\cl-9-\cc),
rectangle,rounded corners] (sol-\cl-\cc) {};
\end{scope}
\begin{scope}[on background layer]
\def\cc{1}
\node[fit=(p-\cl-0-\cc)(p-\cl-1-\cc)(p-\cl-2-\cc)(p-\cl-3-\cc)(p-\cl-4-\cc)(p-\cl-5-\cc)(p-\cl-6-\cc)(p-\cl-7-\cc)(p-\cl-8-\cc)(p-\cl-9-\cc),
rectangle,rounded corners] (sol-\cl-\cc) {};
\end{scope}
\begin{scope}[on background layer]
\def\cc{2}% best all
\node[fit=(p-\cl-0-\cc)(p-\cl-1-\cc)(p-\cl-2-\cc)(p-\cl-3-\cc)(p-\cl-4-\cc)(p-\cl-5-\cc)(p-\cl-6-\cc)(p-\cl-7-\cc)(p-\cl-8-\cc)(p-\cl-9-\cc),
only on=<7-8>{tsp/best},rectangle,rounded corners] (sol-\cl-\cc) {};
\end{scope}
\begin{scope}[on background layer]
\def\cc{3}% best
\node[fit=(p-\cl-0-\cc)(p-\cl-1-\cc)(p-\cl-2-\cc)(p-\cl-3-\cc)(p-\cl-4-\cc)(p-\cl-5-\cc)(p-\cl-6-\cc)(p-\cl-7-\cc)(p-\cl-8-\cc)(p-\cl-9-\cc),
only on=<7>{tsp/best},only on=<8>{tsp/localbest},rectangle,rounded corners] (sol-\cl-\cc) {};
\end{scope}
%}}}
\begin{scope}[on background layer]
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1-0)}] (s-\cl-0-0) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1-1)}] (s-\cl-0-1) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1-2)}] (s-\cl-0-2) [foreach/.list={1,...,\last}] -- cycle;
\draw[tsp/edge,semithick,foreach/.style={insert path=--(s-\cl-#1-3)}] (s-\cl-0-3) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
\end{scope}
%}}}
%{{{ links "
\foreach \cl/\nl/\vi in {1/2/2,3/4/5} {
\foreach \j in {0,...,3} {
\foreach \l in {0,...,2} {
\draw[<-,>=stealth,visible on=<\vi->] (sol-\nl-\j-\l) -- (sol-\cl-\j);
}
}
}
\foreach \cl/\nl/\vi in {2/3/4,4/5/7} {
\foreach \j in {0,...,3} {
\foreach \l in {0,...,2} {
\draw[->,>=stealth,visible on=<\vi->] (sol-\cl-\j-\l) -- (sol-\nl-\j);
}
}
}
%}}}
%{{{
\begin{scope}[on background layer]
\foreach \i in {0,...,3} {
\node[fit=(sol-1-\i)(sol-2-\i-0)(sol-2-\i-1)(sol-2-\i-2)(sol-5-\i),
draw,rectangle,rounded corners,dashed,thin,inner sep=2pt,visible on=<9->] (els-\i) {};
\node[node distance=.5pt,above=of els-\i,visible on=<9->] (els-\i-label) {\scriptsize ELS};
}
\node[fit=(els-0-label)(els-1-label)(els-2-label)(els-3-label),fill=green!70!black,rectangle,rounded
corners,opacity=.1,fit margins={top=.25pt,bottom=.25pt,left=11pt,right=11pt},visible on=<9->] {};
\foreach \i in {0,...,3} {
\foreach \cl in {2,4} {
\node[fit=(sol-\cl-\i-0)(sol-\cl-\i-1)(sol-\cl-\i-2),fill=green!70!black,rectangle,rounded
corners,opacity=.1,inner sep=2pt,visible on=<9->] {};
}
}
\end{scope}
%}}}
\only<10>{
}
\end{tikzpicture}

View File

@ -0,0 +1,35 @@
\begin{tikzpicture}
\input{src/tikz/tsp}
\tspnodes
% \def\tspstart{0}
\coordinate (E) at (p\tspstart);
\ifthenelse{\tspstart=0}{\def\tspsolution{0,9,1,8,7,6,4,2,3,5}}{}
\ifthenelse{\tspstart=1}{\def\tspsolution{1,8,7,9,0,2,4,5,6,3}}{}
\ifthenelse{\tspstart=2}{\def\tspsolution{2,1,0,9,8,7,4,3,5,6}}{}
\ifthenelse{\tspstart=3}{\def\tspsolution{3,4,5,6,8,7,1,2,0,9}}{}
\ifthenelse{\tspstart=4}{\def\tspsolution{4,5,3,6,8,7,1,2,0,9}}{}
\ifthenelse{\tspstart=5}{\def\tspsolution{5,4,3,6,8,7,1,2,0,9}}{}
\ifthenelse{\tspstart=6}{\def\tspsolution{6,4,5,3,8,7,1,2,0,9}}{}
\ifthenelse{\tspstart=7}{\def\tspsolution{7,8,6,4,5,1,9,0,2,3}}{}
\ifthenelse{\tspstart=8}{\def\tspsolution{8,7,6,4,5,1,9,0,2,3}}{}
\ifthenelse{\tspstart=9}{\def\tspsolution{9,0,1,8,7,6,4,5,3,2}}{}
\foreach [count=\i from 0] \o in \tspsolution {
\coordinate (s\i) at (p\o);
}
\foreach \i in {0,...,\last} {
\node[tsp/node] at (p\i) {};
}
\node[tsp/node,common/drawfillf={black}{20}] at (E) {};
\ifthenelse{\istep=0}{}{
\begin{scope}[on background layer]
\draw[tsp/edge,foreach/.style={insert path=--(s#1)}] (E) [foreach/.list={1,...,\istep}] -- cycle;
\end{scope}
}
\end{tikzpicture}

View File

@ -0,0 +1,18 @@
\begin{tikzpicture}
\input{src/tikz/tsp}
\tspnodes
\foreach \i in {0,...,\last} {
\node[tsp/node] at (p\i) {};
}
\begin{scope}[on background layer]
\foreach \i in {0,...,\penult} {
\pgfmathtruncatemacro{\b}{\i+1}
\foreach \j in {\b,...,\last} {
\draw[black!40] (p\i) -- (p\j);
}
}
\end{scope}
\end{tikzpicture}

18
src/fig/app/tspopti.tex Normal file
View File

@ -0,0 +1,18 @@
\begin{tikzpicture}[thick]
\input{src/tikz/tsp}
\tspnodes
\coordinate (s0) at (p0);
\foreach [count=\i] \o in {1,2,3,5,4,6,7,8,9} {
\coordinate (s\i) at (p\o);
}
\foreach \i in {0,...,\last} {
\node[tsp/node] at (p\i) {};
}
\begin{scope}[on background layer]
\draw[tsp/edge,foreach/.style={insert path=--(s#1)}] (p0) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
\end{tikzpicture}

9
src/fig/app/tsprp.tex Normal file
View File

@ -0,0 +1,9 @@
\begin{tikzpicture}[remember picture]
\input{src/tikz/tsp}
\tspnodes
\foreach \i in {0,...,\last} {
\node[tsp/node,draw=none,fill=none] (tsp node \i) at (p\i) {};
}
\end{tikzpicture}

View File

@ -0,0 +1,18 @@
\begin{tikzpicture}[thick]
\input{src/tikz/tsp}
\tspnodes
\coordinate (s0) at (p0);
\foreach [count=\i] \o in {2,3,1,4,5,8,6,7,9} {
\coordinate (s\i) at (p\o);
}
\foreach \i in {0,...,\last} {
\node[tsp/node] at (p\i) {};
}
\begin{scope}[on background layer]
\draw[tsp/edge,foreach/.style={insert path=--(s#1)}] (p0) [foreach/.list={1,...,\last}] -- cycle;
\end{scope}
\end{tikzpicture}

View File

@ -0,0 +1,26 @@
\begin{tikzpicture}
\input{src/tikz/parallel}
\begin{scope}[node distance=6mm]
\begin{scope}[start chain=going below,every node/.style={on chain,join},parallel/arrow]
\node[parallel/block] (input) {};
\node[parallel/point] (fork) {};
\node[parallel/task] (main) {\dots};
\node[parallel/point] (join) {};
\node[parallel/task] (select) {T\textsubscript{S}};
\node[parallel/block] (output) {};
\end{scope}
\node[parallel/task,left=of main] (thread 0) {T\textsubscript{0}};
\node[parallel/task,right=of main] (thread n) {T\textsubscript{n-1}};
\end{scope}
\begin{scope}[on background layer]
\node[parallel/region=(thread 0)(main)(thread n)] {};
\end{scope}
\begin{scope}[parallel/arrow]
\draw (fork) -| (thread 0) |- (join);
\draw (fork) -| (thread n) |- (join);
\end{scope}
\end{tikzpicture}

31
src/fig/context/par.tex Normal file
View File

@ -0,0 +1,31 @@
\begin{tikzpicture}
\input{src/tikz/orchestration}
\begin{scope}[overlay]
\node(origin){};
\node at (origin) (t-1) {};
\end{scope}
\begin{scope}[node distance=4mm and 12mm]
\node[orch/task=black,right=of t-1] (t0) {m\textsubscript{0}};
\node[orch/task=black,right=of t0] (t1) {m\textsubscript{1}};
\node[orch/task=white,draw=none,fill=none,node distance=6mm,right=of t1] (t2) {\dots};
\node[orch/task=black,node distance=6mm,right=of t2] (t3) {m\textsubscript{N-2}};
\node[orch/task=black,right=of t3] (t4) {m\textsubscript{N-1}};
\foreach \i/\t in {0/0,1/1,3/N-2,4/N-1} {
\node[above=of t\i] (label\i) {\en{thread}~\t};
\node[below=of t\i] (endthread\i) {};
}
\end{scope}
\foreach \i in {0,1,3,4} {
\draw[-] (label\i) -- (t\i);
\draw[-] (t\i) -- (endthread\i);
}
\begin{scope}[on background layer]
\node[common/drawfill=green!40!black,dashed,rectangle,rounded corners,fit=(t0)(t4)](par){};
\end{scope}
\end{tikzpicture}

31
src/fig/context/seq.tex Normal file
View File

@ -0,0 +1,31 @@
\begin{tikzpicture}
\input{src/tikz/orchestration}
\begin{scope}[overlay]
\node(origin){};
\node at (origin) (t-1) {};
\end{scope}
\begin{scope}[node distance=4mm and 4mm]
\node[orch/task=black,below=of t-1] (t0) {m\textsubscript{0}};
\node[orch/task=white,draw=none,fill=none,below=of t0] (t1) {};
\node[orch/task=black,below=of t1] (t2) {m\textsubscript{N-1}};
\node[above=of t0] (label0) {\en{thread}~0};
\node[below=of t2] (endthread0) {};
\end{scope}
\draw[-] (label0) -- (t0);
\draw[-] (t0) -- (t1);
\draw[dashed] (t1.north) -- (t1.south);
\draw[-] (t1) -- (t2);
\draw[-] (t2) -- (endthread0);
\begin{scope}[common/overlay]
\draw[decorate,decoration={brace, amplitude=4pt, raise=9mm, mirror}]
(t0.north) -- (t2.south) node[left,midway,xshift=-11mm] {$N$ tâches};
\end{scope}
\end{tikzpicture}

View File

@ -0,0 +1,51 @@
\begin{tikzpicture}
\input{src/tikz/exec}
% pool
\begin{scope}[start chain=circle placed {at=(\tikzchaincount*72+18:.8)}]
\foreach \i in {0,...,4} {
\node[on chain,exec/thread=black] (t\i) {t\textsubscript{\i}};
}
\end{scope}
\path (t0) |- node[pos=.2,exec/thread=black]{t\textsubscript{k}} ($(t2)!.5!(t3)$);
\begin{scope}[on background layer]
\node[exec/pool=(t0)(t1)(t2)(t3)(t4)](pool){};
\end{scope}
\path (pool.north west) -- node[above]{\en{pool}} (pool.north east);
\draw[decorate,decoration={brace,amplitude=4pt,raise=3pt,mirror}]
(pool.north west) -- node[left=5pt]{$k+1$ \en{threads}} (pool.south west);
% fifo
\node[exec/fifonode,draw=none,fill=none,above=of t0](fifo3) {\dots};
\begin{scope}[node distance=-.1mm,start chain=fifo]
\foreach \i/\p/\n in {2/3/n-2,1/2/n-1,0/1/n} { \node[exec/fifonode,left=of fifo\p] (fifo\i) {$m_{\n}$}; }
\foreach \i/\p/\n in {4/3/2,5/4/1,6/5/0} { \node[exec/fifonode,right=of fifo\p] (fifo\i) {$m_{\n}$}; }
\end{scope}
\draw[-,densely dotted] ([yshift=-.05mm]fifo3.north west) -- ([yshift=-.05mm]fifo3.north east);
\draw[-,densely dotted] ([yshift=+.05mm]fifo3.south west) -- ([yshift=+.05mm]fifo3.south east);
\node[exec/fit=(fifo0)(fifo6),fit margins={left=2.25mm},dash phase=2](mutex) {};
\path (mutex.north west)
-- node[above](lblmutex){accès en section critique (\en{mutex}) à la file de tâches} (mutex.north east);
% arrows
\draw[-] ([xshift=-8mm]fifo0.west) -- (fifo0.west);
\draw[->,rounded corners] (fifo6.east) -- ++(4mm,0) |- (pool.east);
\coordinate (mutexeast) at ([xshift=3mm]mutex.east);
\node[exec/fit=(lblmutex)(mutex)(pool)(mutexeast),densely dashed](threadpool) {};
\path (threadpool.north west) -- node[above]{\en{thread pool}} (threadpool.north east);
% background
\begin{scope}[on background layer]
\node[fit=(threadpool),inner sep=3ex,rectangle,rounded corners,fill=white,opacity=.95]{};
\end{scope}
% fix thread pool border
\begin{scope}[on background layer]
\node[exec/pool=(t0)(t1)(t2)(t3)(t4)]{};
\end{scope}
\end{tikzpicture}

View File

@ -0,0 +1,70 @@
\begin{tikzpicture}
\input{src/tikz/orchestration}
% \def\N{12}
% \def\T{4}
\pgfmathtruncatemacro{\nlasttask}{\N-1}
\pgfmathtruncatemacro{\nlastthread}{\T-1}
\pgfmathtruncatemacro{\R}{mod(\N, \T)}
\begin{scope}[overlay]
\node(origin){};
\node at (origin) (t-\T) {};
\end{scope}
\begin{scope}[node distance=4mm and 4mm]
\foreach \task in {0,...,\nlasttask} {
\pgfmathtruncatemacro{\r}{mod(\task, \T)}
\ifthenelse{\r = 0}{
\pgfmathtruncatemacro{\uppertask}{\T*(\task/\T-1)}
\def\reltype{below}
\def\relnode{t\uppertask}
}{
\pgfmathtruncatemacro{\prevtask}{\task-1}
\def\reltype{right}
\def\relnode{t\prevtask}
}
\node[orch/task=black,\reltype=of \relnode] (t\task) {m\textsubscript{\task}};
}
\ifthenelse{\R = 0}{}{
\pgfmathtruncatemacro{\ntaskfill}{mod(\T-\R, \T)-1}
\foreach \taskfill in {0,...,\ntaskfill} {
\pgfmathtruncatemacro{\task}{\nlasttask+\taskfill+1}
\pgfmathtruncatemacro{\prevtask}{\task-1}
\node[orch/task=white,draw=none,fill=none,right=of t\prevtask] (t\task) {};
\draw[-] (t\task.north) -- (t\task.south);
}
}
\foreach \thread in {0,...,\nlastthread} {
\node[above=of t\thread] (label\thread) {\en{thread}~\thread};
\draw[-] (label\thread) -- (t\thread);
\pgfmathtruncatemacro{\n}{floor((\N-1)/\T)-1}
\ifthenelse{\n = -1}{}{% only if N>T
\foreach \task in {0,...,\n} {
\pgfmathtruncatemacro{\curtask}{\thread+\task*\T}
\pgfmathtruncatemacro{\nexttask}{\curtask+\T}
\draw[-] (t\curtask) -- (t\nexttask);
}
}
\pgfmathtruncatemacro{\lasttask}{\thread+(\n+1)*\T}
\node[below=of t\lasttask] (endthread\thread) {};
\draw[-] (t\lasttask) -- (endthread\thread);
}
\end{scope}
\begin{scope}[common/overlay]
\draw[decorate,decoration={brace, amplitude=4pt, raise=9mm, mirror}]
(t0.north) -- (t0.south) node[left,midway,xshift=-11mm] {$T$};
\pgfmathtruncatemacro{\n}{ceil(\N/\T)}
\pgfmathtruncatemacro{\nr}{(\N-1)/\T}
\pgfmathtruncatemacro{\ftlt}{\nr*\T}
\draw[decorate,decoration={brace, amplitude=4pt, raise=18mm, mirror}]
(t0.north) -- (t\ftlt.south) node[left,midway,xshift=-20mm] {$\n\,T$};
\end{scope}
\end{tikzpicture}

View File

@ -0,0 +1,76 @@
\begin{tikzpicture}
\input{src/tikz/orchestration}
% \def\N{15}
% \def\T{6}
\pgfmathtruncatemacro{\nlasttask}{\N-1}
\pgfmathtruncatemacro{\nlastthread}{\T-1}
\pgfmathtruncatemacro{\R}{mod(\N, \T)}
\begin{scope}[overlay]
\node(origin){};
\node at (origin) (t-\T) {};
\end{scope}
\begin{scope}[node distance=4mm and 4mm]
\foreach \task in {0,...,\nlasttask} {
\pgfmathtruncatemacro{\r}{mod(\task, \T)}
\ifthenelse{\r = 0}{
\pgfmathtruncatemacro{\uppertask}{\T*(\task/\T-1)}
\def\reltype{below}
\def\relnode{t\uppertask}
}{
\pgfmathtruncatemacro{\prevtask}{\task-1}
\def\reltype{right}
\def\relnode{t\prevtask}
}
\node[orch/task=black,\reltype=of \relnode] (t\task) {};
\draw[-] (t\task.north)
-- node[pos=.3,orch/subtask=black] {}
node[pos=.7,orch/subtask=black] {}
(t\task.south);
}
\ifthenelse{\R = 0}{}{
\pgfmathtruncatemacro{\ntaskfill}{mod(\T-\R, \T)-1}
\foreach \taskfill in {0,...,\ntaskfill} {
\pgfmathtruncatemacro{\task}{\nlasttask+\taskfill+1}
\pgfmathtruncatemacro{\prevtask}{\task-1}
\node[orch/task=white,draw=none,fill=none,right=of t\prevtask] (t\task) {};
\draw[-] (t\task.north) -- (t\task.south);
}
}
\foreach \thread in {0,...,\nlastthread} {
\node[above=of t\thread] (label\thread) {\en{thread}~\thread};
\draw[-] (label\thread) -- (t\thread);
\pgfmathtruncatemacro{\n}{floor((\N-1)/\T)-1}
\ifthenelse{\n = -1}{}{% only if N>T
\foreach \task in {0,...,\n} {
\pgfmathtruncatemacro{\curtask}{\thread+\task*\T}
\pgfmathtruncatemacro{\nexttask}{\curtask+\T}
\draw[-] (t\curtask) -- (t\nexttask);
}
}
\pgfmathtruncatemacro{\lasttask}{\thread+(\n+1)*\T}
\node[below=of t\lasttask] (endthread\thread) {};
\draw[-] (t\lasttask) -- (endthread\thread);
}
\end{scope}
\begin{scope}[common/overlay]
\pgfmathtruncatemacro{\n}{2*ceil(\N/\T)}
\pgfmathtruncatemacro{\nr}{(\N-1)/\T}
\pgfmathtruncatemacro{\ftlt}{\nr*\T}
\draw[decorate,decoration={brace, amplitude=4pt, raise=9mm, mirror}]
(t0.north) -- (t0.south) node[left,midway,xshift=-11mm] {$2\,T$};
\draw[decorate,decoration={brace, amplitude=4pt, raise=18mm, mirror}]
(t0.north) -- (t\ftlt.south) node[left,midway,xshift=-20mm] {$\n\,T$};
\end{scope}
\end{tikzpicture}

View File

@ -0,0 +1,85 @@
\begin{tikzpicture}
\input{src/tikz/orchestration}
% \def\N{15}
% \def\T{6}
\pgfmathtruncatemacro{\nlasttask}{\N-1}
\pgfmathtruncatemacro{\nlastthread}{\T-1}
\pgfmathtruncatemacro{\R}{mod(\N, \T)}
\begin{scope}[overlay]
\node(origin){};
\node at (origin) (t-\T) {};
\end{scope}
\begin{scope}[node distance=4mm and 4mm]
\pgfmathtruncatemacro{\nlasttaskA}{\nlasttask-\R}
\foreach \task in {0,...,\nlasttaskA} {
\pgfmathtruncatemacro{\r}{mod(\task, \T)}
\ifthenelse{\r = 0}{
\pgfmathtruncatemacro{\uppertask}{\T*(\task/\T-1)}
\def\reltype{below}
\def\relnode{t\uppertask}
}{
\pgfmathtruncatemacro{\prevtask}{\task-1}
\def\reltype{right}
\def\relnode{t\prevtask}
}
\node[orch/task=black,\reltype=of \relnode] (t\task) {};
\draw[-] (t\task.north)
-- node[pos=.3,orch/subtask=black] {}
node[pos=.7,orch/subtask=black] {}
(t\task.south);
}
\foreach \taskfill in {1,...,\R} {
\pgfmathtruncatemacro{\task}{\taskfill-1}
\pgfmathtruncatemacro{\prevtaskl}{\nlasttaskA+\task-\T+\taskfill)}
\pgfmathtruncatemacro{\prevtaskr}{\prevtaskl+1}
\path (t\prevtaskl.south) -- coordinate[midway](prevtask\taskfill) (t\prevtaskr.south);
\node[orch/taskspan=black,below=of prevtask\taskfill] (ts\task) {};
\pgfmathtruncatemacro{\taska}{\nlasttaskA+\task*2+1}
\pgfmathtruncatemacro{\taskb}{\nlasttaskA+\task*2+2}
\path (t\prevtaskl.south) |- node[orch/subtask=black] (t\taska) {} (ts\task.west);
\path (t\prevtaskr.south) |- node[orch/subtask=black] (t\taskb) {} (ts\task.west);
}
\foreach \thread in {0,...,\nlastthread} {
\node[above=of t\thread] (label\thread) {\en{thread}~\thread};
\draw[-] (label\thread) -- (t\thread);
\pgfmathtruncatemacro{\n}{floor((\N-1)/\T)-1}
\ifthenelse{\n = -1}{}{% only if N>T
\foreach \task in {0,...,\n} {
\pgfmathtruncatemacro{\curtask}{\thread+\task*\T}
\pgfmathtruncatemacro{\nexttask}{\curtask+\T}
\draw[-] (t\curtask) -- (t\nexttask);
}
}
\pgfmathtruncatemacro{\lasttask}{\thread+(\n+1)*\T}
\draw[-] (t\lasttask) -- (\curcoord |- ts0.south) -- +(0,-4mm);
}
\end{scope}
\begin{scope}[common/overlay]
\pgfmathtruncatemacro{\n}{ceil((2*\N-1)/\T)}
\pgfmathtruncatemacro{\nr}{(\N-1)/\T}
\pgfmathtruncatemacro{\ftlt}{\nr*\T}
\node[orch/task=black,draw=none,fill=none](lt) at (t\ftlt) {};
\draw[decorate,decoration={brace, amplitude=4pt, raise=9mm, mirror}]
(t0.north) -- (t0.south) node[left,midway,xshift=-11mm] {$2\,T$};
\draw[decorate,decoration={brace, amplitude=4pt, raise=9mm, mirror}]
(lt.north) -- (lt.south) node[left,midway,xshift=-11mm] {$T$};
\draw[decorate,decoration={brace, amplitude=4pt, raise=18mm, mirror}]
(t0.north) -- (lt.south) node[left,midway,xshift=-20mm] {$\n{}\,T$};
\end{scope}
\end{tikzpicture}

View File

@ -0,0 +1,50 @@
\begin{tikzpicture}
\input{src/tikz/exec}
% pool
\begin{scope}[start chain=circle placed {at=(\tikzchaincount*72+18:.8)}]
\foreach \i in {0,...,4} {
\node[on chain,exec/thread=black] (t\i) {t\textsubscript{\i}};
}
\end{scope}
\path (t0) |- node[pos=.2,exec/thread=black]{t\textsubscript{k}} ($(t2)!.5!(t3)$);
\begin{scope}[on background layer]
\node[exec/pool=(t0)(t1)(t2)(t3)(t4)](pool){};
\end{scope}
\path (pool.north west) -- node[above]{\en{pool}} (pool.north east);
\draw[decorate,decoration={brace,amplitude=4pt,raise=3pt,mirror}]
(pool.north west) -- node[left=5pt]{$k+1$ \en{threads}} (pool.south west);
% fifo
\node[exec/fifonode,draw=none,fill=none,above=of t0](fifo3) {};
\begin{scope}[node distance=-.1mm,start chain=fifo]
\foreach \i/\p/\n in {2/3/n-2,1/2/n-1,0/1/n} { \node[exec/fifonode,left=of fifo\p] (fifo\i) {$m_{\n}$}; }
\foreach \i/\p/\n in {4/3/2,5/4/1,6/5/0} { \node[exec/fifonode,right=of fifo\p] (fifo\i) {$m_{\n}$}; }
\end{scope}
\draw[-,densely dotted] ([yshift=-.05mm]fifo3.north west) -- ([yshift=-.05mm]fifo3.north east);
\draw[-,densely dotted] ([yshift=+.05mm]fifo3.south west) -- ([yshift=+.05mm]fifo3.south east);
\node[exec/fit=(fifo0)(fifo6),fit margins={left=2.25mm},dash phase=2](mutex) {};
\path (mutex.north west)
-- node[above](lblmutex){accès en section critique (\en{mutex}) à la file de tâches} (mutex.north east);
% arrows
\draw[-] ([xshift=-8mm]fifo0.west) -- (fifo0.west);
\draw[->,rounded corners] (fifo6.east) -- ++(4mm,0) |- (pool.east);
\coordinate (mutexeast) at ([xshift=3mm]mutex.east);
\node[exec/fit=(lblmutex)(mutex)(pool)(mutexeast),densely dashed](threadpool) {};
% background
\begin{scope}[on background layer]
\node[fit=(threadpool),inner sep=3ex,rectangle,rounded corners,fill=white,opacity=.95]{};
\end{scope}
% fix thread pool border
\begin{scope}[on background layer]
\node[exec/pool=(t0)(t1)(t2)(t3)(t4)]{};
\end{scope}
\end{tikzpicture}

7
src/fig/mp/et_basic.tex Normal file
View File

@ -0,0 +1,7 @@
\begin{tikzpicture}
\input{src/tikz/et}
\begin{scope}[et/treestyle]
\Tree[.\texttt{+} \texttt{a} [.\texttt{*} \texttt{b} \texttt{c} ] ]
\end{scope}
\end{tikzpicture}

14
src/fig/mp/et_linexpr.tex Normal file
View File

@ -0,0 +1,14 @@
\begin{tikzpicture}
\input{src/tikz/et}
\begin{scope}[et/treestyle,level distance=12mm]
\Tree
[.\texttt{-}
[.\texttt{*}
\texttt{5}
[.\texttt{+} [.\texttt{*} \texttt{2} \texttt{x} ] \texttt{1} ]
]
[.\texttt{+} \texttt{x} \texttt{3} ]
]
\end{scope}
\end{tikzpicture}

View File

@ -0,0 +1,11 @@
\begin{tikzpicture}
\input{src/tikz/et}
\begin{scope}[et/treestyle,level distance=12mm]
\Tree
[.\texttt{-}
[.\texttt{+} [.\texttt{*} \texttt{10} \texttt{x} ] \texttt{5} ]
[.\texttt{+} \texttt{x} \texttt{3} ]
]
\end{scope}
\end{tikzpicture}

View File

@ -0,0 +1,7 @@
\begin{tikzpicture}
\input{src/tikz/et}
\begin{scope}[et/treestyle,level distance=12mm]
\Tree[.\texttt{+} [.\texttt{*} \texttt{9} \texttt{x} ] \texttt{2} ]
\end{scope}
\end{tikzpicture}

View File

@ -0,0 +1,17 @@
\begin{tikzpicture}
\input{src/tikz/mp}
\pic[local bounding box=cpptmp] at (0,0) {program};
\pic[local bounding box=cpp] at (4,0) {program};
\pic[local bounding box=bin] at (8,0) {binary};
\path (cpptmp.north west) -- node[above,align=center]{C++ avec\\templates} (cpptmp.north east);
\path (cpp.north west) -- node[above]{C++} (cpp.north east);
\path (bin.north west) -- node[above]{binaire} (bin.north east);
\begin{scope}[->,>=stealth]
\draw[double distance=2pt] ($(cpptmp.east)!.5!(cpp.west)$) -- ++(0,-1.3) -- ++(-3,0) |- (cpptmp.west);
\draw[double distance=2pt] (cpptmp) -- node[above]{\footnotesize compilation} (cpp);
\draw[double distance=2pt] (cpp) -- node[above]{\footnotesize compilation} (bin);
\end{scope}
\end{tikzpicture}

6
src/fig/pagemask.tex Normal file
View File

@ -0,0 +1,6 @@
\begin{tikzpicture}[remember picture,overlay]
\coordinate (north west) at ([yshift=-16.1mm]current page.north west);
\coordinate (south east) at (current page.south east);
\fill[opacity=.7,black] (north west) rectangle (south east);
\end{tikzpicture}%

16
src/fig/pfor/indices.tex Normal file
View File

@ -0,0 +1,16 @@
\begin{tikzpicture}
\input{src/tikz/et}
\begin{scope}[et/treestyle]
\Tree[.,
[.=
[.\texttt{[]} a i ]
[.\texttt{*} [.\texttt{[]} a i ] [.\texttt{[]} b i ] ]
]
[.=
[.\texttt{[]} c i ]
[.\texttt{[]} c [.\texttt{+} i 1 ] ]
]
];
\end{scope}
\end{tikzpicture}

View File

@ -0,0 +1,10 @@
\begin{tikzpicture}
\input{src/tikz/et}
\begin{scope}[et/treestyle]
\Tree[.=
[.\texttt{[]} c i ]
[.\texttt{[]} c [.\texttt{+} i 1 ] ]
];
\end{scope}
\end{tikzpicture}

View File

@ -0,0 +1,92 @@
\begin{tikzpicture}
\input{src/tikz/alsk}
\begin{scope}[alsk/treestyle,
alsk/tree/muscle/.append style={font=\footnotesize,minimum width=8mm,minimum height=3mm},
alsk/tree/struct/.append style={font=\footnotesize,minimum width=12mm,minimum height=3mm},
level distance=11mm, sibling distance=16mm,
every node/.style=leaf,
]
\node[branch](farmsel1){farmsel\textsubscript{1}}
child{ node[branch](serial1){serial\textsubscript{1}}
child{ node(ch){HC} }
child{ node[branch](serial2){serial\textsubscript{2}}
child{ node(init ls){RLI} }
child{ node[branch](itersel){itersel}
child{ node[branch](farmsel2){farmsel\textsubscript{2}}
child{ node[branch](serial3){serial\textsubscript{3}}
child{ node(m){M} }
child{ node(ls){RL} }
}
child{ node(sel3){Sel\textsubscript{3}} }
}
child{ node(sel2){Sel\textsubscript{2}} }
}
}
}
child{ node(sel1){Sel\textsubscript{1}} };
\end{scope}
% task count
\path (farmsel1) -- node[left=2mm]{\only<4->{\footnotesize$a \times$}} (serial1);
\path (farmsel2) -- node[left=2mm]{\only<6->{\footnotesize$b \times$}} (serial3);
% identifiers
\begin{scope}[
->,dashed,rounded corners=1mm,
frame/.style={draw,rectangle,rounded corners=1mm,dashed,fit=#1}
]
\coordinate (yline) at ($(farmsel1)+(30mm,0)$);
\path[only on=<2->{draw}] (farmsel1) -- (farmsel1 -| yline) node(n9t){};
\path[only on=<3->{draw}] (sel1) -- (sel1 -| yline) node(n9b){};
\path[only on=<{4-7,10-}>{draw}] (serial1) |- ++(0,-5mm) -- (\curcoord -| yline) node(nat){};
\visible<5-7,10->{
\node[frame=(ch)(itersel)(farmsel2)(sel2)] (fserial1) {};
}
\path[only on=<{5-7,10-}>{draw}] (fserial1) -- (fserial1 -| yline) node(nfs1){};
\path[only on=<{5-7,10-}>{draw}] (sel3) -- (sel3 -| yline) node(nab){};
\path[only on=<{6-7,9-}>{draw}] (serial3) |- ++(0,-5mm) -- (\curcoord -| yline) node(nbt){};
\visible<7,9->{
\node[frame=(m)(ls)] (fserial3) {};
}
\path[only on=<{7,9-}>{draw}] (fserial3) -- (fserial3 -| yline) node(nbb){};
\end{scope}
\begin{scope}
\only<2>{\node[right] at (n9t) {\num{1} exécution};}
\only<4>{\node[right] at (nat) {$a$ exécutions parallèles};}
\only<6>{\node[right] at (nbt) {$a \times b$ exécutions parallèles};}
\end{scope}
\begin{scope}[decoration={brace,amplitude=4pt,raise=4pt}]
\visible<3-7,8->{
\draw[decorate] (n9t.north) -- (n9b.south) node[midway,right=10pt]
{\alt<3-7>{\num{1} exécution}{$\text{id} = 0$}};
}
\visible<5-7,10->{
\draw[decorate] (nat.north) -- (nab.south) node[midway,right=10pt,only on=<10->{text justified}]
{\alt<5-7>{$a$ exécutions parallèles}{$
\begin{aligned}
&\text{id} \in \{0, b, 2\,b, \dots, (a-1)\,b\}\\
&\iff \text{id} \in b\,\llbracket 0, a \llbracket
\end{aligned}
$}};
}
\visible<7>{
\draw[decorate] (nbt.north) -- (nbb.south) node[midway,right=10pt]
{$a \times b$ exécutions parallèles};
}
\visible<9>{
\draw[decorate] (nbt.north) -- (nbb.south) node[midway,right=10pt]
{$\text{id} \in \llbracket 0, a\,b \llbracket$};
}
\visible<10->{
\draw[decorate] (nbt.north) -- (nbb.south) node[midway,right=10pt]
{$\text{id} \in \llbracket 0, a\,b \llbracket (= \displaystyle\bigcup^{a-1}_{k=0} \llbracket k\,b, (k+1)\,b-1 \rrbracket)$};
}
\end{scope}
\end{tikzpicture}

63
src/fig/repeat/par.tex Normal file
View File

@ -0,0 +1,63 @@
\begin{tikzpicture}
\input{src/tikz/orchestration}
\tikzset{orch/task/.append style={minimum width=10mm}}
\pgfmathtruncatemacro{\nlasttask}{\N-1}
\pgfmathtruncatemacro{\nlastthread}{\T-1}
\pgfmathtruncatemacro{\R}{mod(\N, \T)}
\begin{scope}[overlay]
\node(origin){};
\node at (origin) (t-\T) {};
\end{scope}
\begin{scope}[node distance=3mm and 3mm]
\pgfmathtruncatemacro{\multiplier}{\N/\T}
\pgfmathtruncatemacro{\offset}{mod(\N, \T)}
\foreach \task in {0,...,\nlasttask} {
\pgfmathtruncatemacro{\r}{mod(\task, \T)}
\ifthenelse{\r = 0}{
\pgfmathtruncatemacro{\uppertask}{\T*(\task/\T-1)}
\def\reltype{below}
\def\relnode{t\uppertask}
}{
\pgfmathtruncatemacro{\prevtask}{\task-1}
\def\reltype{right}
\def\relnode{t\prevtask}
}
\pgfmathtruncatemacro{\id}{(\task/\T)+\r*\multiplier+min(\r, \offset)}
\node[orch/task=black,\reltype=of \relnode] (t\task) {$m_\id$};
}
\ifthenelse{\R = 0}{}{
\pgfmathtruncatemacro{\ntaskfill}{mod(\T-\R, \T)-1}
\foreach \taskfill in {0,...,\ntaskfill} {
\pgfmathtruncatemacro{\task}{\nlasttask+\taskfill+1}
\pgfmathtruncatemacro{\prevtask}{\task-1}
\node[orch/task=white,draw=none,fill=none,right=of t\prevtask] (t\task) {};
\draw[-] (t\task.north) -- (t\task.south);
}
}
\foreach \thread in {0,...,\nlastthread} {
\node[above=of t\thread] (label\thread) {\footnotesize\en{thread}~\thread};
\draw[-] (label\thread) -- (t\thread);
\pgfmathtruncatemacro{\n}{floor((\N-1)/\T)-1}
\ifthenelse{\n = -1}{}{% only if N>T
\foreach \task in {0,...,\n} {
\pgfmathtruncatemacro{\curtask}{\thread+\task*\T}
\pgfmathtruncatemacro{\nexttask}{\curtask+\T}
\draw[-] (t\curtask) -- (t\nexttask);
}
}
\pgfmathtruncatemacro{\lasttask}{\thread+(\n+1)*\T}
\node[below=of t\lasttask] (endthread\thread) {};
\draw[-] (t\lasttask) -- (endthread\thread);
}
\end{scope}
\end{tikzpicture}

View File

@ -0,0 +1,28 @@
\begin{tikzpicture}
\input{src/tikz/repeat}
\visible<1->{
\begin{scope}[start chain,node distance=0pt,every node/.style={on chain,prng/element}]
\node[only on=<2-12>{opacity=.8},only on=<2->{prng/drawfill=a}](a0) {12};
\foreach[count=\i from 3] \v/\col in {2/b,34/a,85/b,4/a,91/b,29/a,85/b,98/a,3/b,35/b,65/a} {
\node[only on=<\i-12>{opacity=.8},only on=<\i->{prng/drawfill=\col}] {\v};
}
\end{scope}
}
\visible<14->{
\begin{scope}[start chain,node distance=0pt,every node/.style={on chain,prng/element}]
\node[prng/drawfill=b,prng/below=a0](b0) {12};
\foreach[count=\i from 3] \v/\col in {2/b,34/a,85/a,4/b,91/a,29/a,85/b,98/a,3/b,35/a,65/b} {
\node[prng/drawfill=\col] {\v};
}
\end{scope}
}
\visible<15->{
\begin{scope}[start chain,node distance=0pt,every node/.style={on chain,prng/element}]
\node[prng/drawfill=b,prng/below=b0](c0) {12};
\foreach[count=\i from 3] \v/\col in {2/a,34/a,85/a,4/b,91/a,29/b,85/b,98/b,3/b,35/a,65/a} {
\node[prng/drawfill=\col] {\v};
}
\end{scope}
}
\end{tikzpicture}

View File

@ -0,0 +1,23 @@
\begin{tikzpicture}
\input{src/tikz/repeat}
\begin{scope}[start chain,node distance=0pt,every node/.style={on chain,prng/element}]
\node[prng/drawfill=a](a0) {12};
\foreach[count=\i from 1] \v/\col in {2/a,34/a,85/a,4/a,91/a,29/c,85/c,98/c,3/c,35/c,65/c} {
\node[prng/drawfill=\col] (a\i) {\v};
}
\end{scope}
\visible<-1>{
\begin{scope}[start chain,node distance=0pt,every node/.style={on chain,prng/element}]
\node[prng/drawfill=b,node distance=5mm,below=of a0](b0) {42};
\foreach[count=\i from 1] \v/\col in {8/b,9/b,54/b,95/b,80/b,48/c,7/c,10/c,58/c,18/c,44/c} {
\node[prng/drawfill=\col] (b\i) {\v};
}
\end{scope}
\node[fit=(a0)(b0)(a11)(b11),fit margins={right=2mm},draw,rectangle,dashed,rounded corners]{};
}
\visible<2->{
\node[fit=(a0)(a11),fit margins={right=2mm},draw,rectangle,dashed,rounded corners]{};
}
\end{tikzpicture}

View File

@ -0,0 +1,18 @@
\begin{tikzpicture}
\input{src/tikz/repeat}
\begin{scope}[start chain,node distance=0pt,every node/.style={on chain,prng/element}]
\node[only on=<2-13>{opacity=.8},only on=<2->{prng/drawfill=a}](a0) {12};
\foreach[count=\i from 3] \v/\col in {2/a,34/a,85/a,4/a,91/a,29/b,85/b,98/b,3/b,35/b,65/b} {
\node[only on=<\i-13>{opacity=.8},only on=<\i->{prng/drawfill=\col}] {\v};
}
\end{scope}
\begin{scope}[start chain,node distance=0pt,every node/.style={on chain,prng/element,opacity=0}]
\node[prng/below=a0](b0) {12};
\foreach \v in {2,34,85,4,91,29,85,98,3,35,65} { \node{\v}; }
\end{scope}
\begin{scope}[start chain,node distance=0pt,every node/.style={on chain,prng/element,opacity=0}]
\node[prng/below=b0](c0) {12};
\foreach \v in {2,34,85,4,91,29,85,98,3,35,65} { \node {\v}; }
\end{scope}
\end{tikzpicture}

28
src/fig/repeat/seq.tex Normal file
View File

@ -0,0 +1,28 @@
\begin{tikzpicture}
\input{src/tikz/orchestration}
\tikzset{orch/task/.append style={minimum width=10mm}}
\begin{scope}[overlay]
\node(origin){};
\node at (origin) (t-1) {};
\end{scope}
\begin{scope}[node distance=3mm and 3mm]
\node[orch/task=black,below=of t-1] (t0) {$m_0$};
\node[orch/task=white,draw=none,fill=none,below=of t0] (t1) {};
\node[orch/task=black,below=of t1] (t2) {$m_8$};
\node[above=of t0] (label0) {\footnotesize\en{thread}~0};
\node[below=of t2] (endthread0) {};
\end{scope}
\draw[-] (label0) -- (t0);
\draw[-] (t0) -- (t1);
\draw[dashed] (t1.north) -- (t1.south);
\draw[-] (t1) -- (t2);
\draw[-] (t2) -- (endthread0);
\end{tikzpicture}

6
src/lst/alsk/elsbody.tex Normal file
View File

@ -0,0 +1,6 @@
\begin{cppcode}
using Els = SkelEls<
tsp::Problem, tsp::Solution,
iLS, M, LS, sel2, sel3, A
>;
\end{cppcode}

13
src/lst/alsk/grasp.tex Normal file
View File

@ -0,0 +1,13 @@
\begin{cppcode}
template<
typename Problem, typename Solution,
typename CH, typename LS, typename Sel
>
using SkelGrasp = BuildSkeleton<
SkelGraspStructure,
SkelGraspLinks
>::template skeleton<
Pack<CH, LS, Sel>,
Pack<Problem, Solution>
>;
\end{cppcode}

View File

@ -0,0 +1,13 @@
\begin{cppcode}
template<
typename Problem, typename Solution
>
using SkelGraspLinks =
L<FarmSel, |\textcolor{colFSr}{Solution}|(|\textcolor{colFSp0}{Problem}|),
L<Serial, |\textcolor{colSr}{R<1>}|(|\textcolor{colSp0}{P<0>}|),
|\textcolor{colCHr}{Solution}|(|\textcolor{colCHp0}{P<0>}|, |\textcolor{colCHp1}{RNG}|),
|\textcolor{colLSr}{Solution}|(|\textcolor{colLSp0}{R<0>}|, |\textcolor{colLSp1}{RNG}|)
>,
|\textcolor{colSelr}{Solution}|(|\textcolor{colSelp}{Solution}|, |\textcolor{colSelp}{Solution}|)
>;
\end{cppcode}

View File

@ -0,0 +1,12 @@
\begin{cppcode}
template<
typename |\textcolor{colMuscle}{CH}|, typename |\textcolor{colMuscle}{LS}|, typename |\textcolor{colMuscle}{S}|
>
using SkelGraspStructure =
S<|\textcolor{colStruct}{FarmSel}|,
S<|\textcolor{colStruct}{Serial}|,
|\textcolor{colMuscle}{CH}|, |\textcolor{colMuscle}{LS}|
>,
|\textcolor{colMuscle}{S}|
>;
\end{cppcode}

View File

@ -0,0 +1,6 @@
\begin{cppcode}
using GraspEls = SkelGrasp<
tsp::Problem, tsp::Solution,
Greedy, Els, sel1
>;
\end{cppcode}

View File

@ -0,0 +1,11 @@
\begin{cppcode}
auto graspEls = implement<DynamicPool, GraspEls>();
graspEls.skeleton.n = 10;
graspEls.skeleton.task.task<1>().task<1>().n = 15;
graspEls.skeleton.task.task<1>().task<1>().task.n = 20;
graspEls.executor.cores = 16;
tsp::Solution solution = graspEls(problem);
\end{cppcode}

View File

@ -0,0 +1,4 @@
\begin{cppcode}
for(int i = 0; i < N; ++i)
a[i] = a[i] + 1;
\end{cppcode}

View File

@ -0,0 +1,4 @@
\begin{cppcode}
for(int i = 1; i < N; i += 2)
a[i] = a[i-1];
\end{cppcode}

View File

@ -0,0 +1,4 @@
\begin{cppcode}
for(int i = 1; i < N; ++i)
a[i] = a[i-1];
\end{cppcode}

22
src/lst/mp/cpplogo.tex Normal file
View File

@ -0,0 +1,22 @@
\begin{minicppcode}
static char *cpplogo_data =
"````````````````````````W/(Q@+<7@+<7W/(Q````````````````````````"
"````````````````[?\\WF\\8=::L3::L3::L3::L3F\\8=[?\\W````````````````"
"````````^PD]MM<E::L3::L3::L3::L3::L3::L3::L3::L3MM<E^PD]````````"
"_`T^S>@L=;$5::L3::L3::L3B+L9K=(BK-$BB+L9::L3::L3::L3=;$5S>@L_`T^"
"J,XA::L3::L3::L3B;L9X/8S````````````````X/4SB;L9::L3::L3::L3H<46"
"::L3::L3::L3B;L9]`<[````````````````````````]`<[B;L98:,,-GWL!&G="
"::L3::L3::L3X?8S````````[O`XOMTGOMTG[O`X````^P@ZF;<&!&G=!&G=!&G="
"::L3::L3B;L9````````[O`X=;$5::L3::L3=K(5OM482G[F!&G=!&G=!&G=!&G="
"::L3::L3KM,C````````O=PG::L3::L36YT&+'?G!&G=5(/HR=T<9H[MR=T<9H[M"
"::L3::L3K],C````````O-PG8:$)/GGB$5W,!&;9!&G=;I3PVNPFA*3YVNPFA*3Y"
"::L3::L3B;L9````````[?XT06O/!%3#!%3#/FG-N]$3/7?C!&G=!&G=!&G=!&G="
"::L3::L3::L3XO0N````````Z_HNKL$\"KL$\"Z_HN````^P@ZD:W\\!&G=!&G=!&G="
"::L379P$-F_798/:]@,U````````````````````````]@,U98/:&ES*!&77!&G="
"E[8$!%3#!%3#!%3#98/:X.\\F````````````````X.\\E98/:!%3#!%3#!%3#CJ?T"
"_`P]P=(//&?+!%3#!%3#!%3#98/:G[3ZG[3Z98/:!%3#!%3#!%3#/&?+P-(._`P]"
"````````]P0VI;C]!%3#!%3#!%3#!%3#!%3#!%3#!%3#!%3#I;C]]P0V````````"
"````````````````YO4J?)7E!%3#!%3#!%3#!%3#?)7EYO4J````````````````"
"````````````````````````TN(;4W;24W;2TN(;````````````````````````"
"";
\end{minicppcode}

View File

@ -0,0 +1,3 @@
\begin{cppcode}
auto e = a + b * c;
\end{cppcode}

Some files were not shown because too many files have changed in this diff Show More