-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.tex
283 lines (229 loc) · 8.08 KB
/
main.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
% !TeX program = xelatex
\documentclass[
aspectratio=169,
handout,
]{beamer}
\usepackage{minted}
\usepackage{xcolor}
\usepackage{tcolorbox}
\usepackage{graphicx}
\usepackage{fontspec}
\usepackage{tabularray}
% allow to look for themes in another folder
% https://tex.stackexchange.com/a/284157/301699
\makeatletter
\def\beamer@calltheme#1#2#3{%
\def\beamer@themelist{#2}
\@for\beamer@themename:=\beamer@themelist\do
{\usepackage[{#1}]{\beamer@themelocation/#3\beamer@themename}}}
\def\usefolder#1{
\def\beamer@themelocation{#1}
}
\def\beamer@themelocation{}
\makeatother
\usefolder{..}
\usetheme{cexa-kokkos}
\AtBeginSection{
\begin{frame}{Outline}
\tableofcontents[currentsection, hideothersubsections]
\end{frame}
}
\AtBeginSubsection{
\begin{frame}{Outline}
\tableofcontents[currentsection, currentsubsection]
\end{frame}
}
\setminted{
autogobble,
fontsize=\small,
bgcolor=lightgray,
xleftmargin=0.5em,
xrightmargin=0.5em,
breaklines,
}
\NewTblrTheme{kokkostable}{
\SetTblrInner{
width=\linewidth,
rowhead=1,
rows={ht=\baselineskip},
row{odd}={bg=lightgray},
row{1}={bg=lightmain},
}
}
\graphicspath{{../../images/}}
%Information to be included in the title page:
\title{Kokkos intermediate course}
\author{The CExA team}
\institute{CEA}
\date{\today}
\titlegraphic{%
\includegraphics[height=4em]{kokkos.png}%
\hspace{1em}%
\includegraphics[height=4em]{cexa_logo.png}
}
% _____________________________________________________________________________
\begin{document}
\begin{frame}[plain]
\titlepage
\end{frame}
% _____________________________________________________________________________
\begin{frame}{This course is open source}
\begin{center}
\githublink{\url{https://github.com/CExA-project/cexa-kokkos-tutorials}}
\end{center}
\end{frame}
% _____________________________________________________________________________
\begin{frame}{Prerequisites}
This course is intended for developers who have have followed the basic course of the tutorials
\vspace{1em}
\begin{block}{What you still need}
\begin{itemize}
\item Basic knowledge of C/C++
\item Basic knowledge of parallel programming
\item Basic knowledge of CMake
\item Basic knowledge of a Linux environment
\item Basic knowledge of Kokkos
\end{itemize}
\end{block}
\end{frame}
% _____________________________________________________________________________
\begin{frame}{Duration of the course}
\begin{itemize}
\item Course + practical work: full day
\item Course + corrected exercise: half day
\item Short version: 3 hours
\end{itemize}
\end{frame}
\begin{frame}{Outline}
\tableofcontents[hidesubsections]
\end{frame}
% _____________________________________________________________________________
\section{Profiling and debugging}
% _____________________________________________________________________________
\begin{frame}{Profiling and debugging tools at hand}
\begin{columns}[T]
\begin{column}{0.33\linewidth}
Kokkos
\begin{itemize}
\item KokkosP interface
\item Regions
\end{itemize}
\end{column}
\begin{column}{0.33\linewidth}
Kokkos tools
\begin{itemize}
\item Kernel timer
\item Kernel logger
\item Memory usage
\item Memory events
\item Space time stack
\end{itemize}
\end{column}
\begin{column}{0.33\linewidth}
Third-party tools
\begin{itemize}
\item VTune
\item Nsight Systems
\item Tau
\item Timemory
\item Caliper
\item HPCToolkit
\end{itemize}
\end{column}
\end{columns}
\end{frame}
% _____________________________________________________________________________
\begin{frame}{KokkosP interface}
\begin{itemize}
\item Provided by Kokkos
\item Hooks for tools
\item Always available
\item No overhead if no tools are used
\end{itemize}
\end{frame}
% _____________________________________________________________________________
\begin{frame}[fragile]{Regions}
\begin{columns}
\begin{column}{0.6\linewidth}
\begin{minted}{C++}
Kokkos::Profiling::pushRegion("init");
Kokkos::parallel_for(
"initialize A",
N,
KOKKOS_LAMBDA(int i) {
view_a(i) = i;
}
);
// other initialization kernels
Kokkos::Profiling::popRegion();
\end{minted}
\end{column}
\begin{column}{0.4\linewidth}
\begin{itemize}
\item Provided by Kokkos
\item Set regions of interest in your code
\item No header needed
\item Namespace \texttt{Kokkos::Profiling}
\item \texttt{pushRegion} and \texttt{popRegion} to create a region
\end{itemize}
\end{column}
\end{columns}
\end{frame}
% _____________________________________________________________________________
\begin{frame}{Kokkos tools}
\begin{itemize}
\item \githublink{\url{https://github.com/kokkos/kokkos-tools}}
\item Has a different version number than Kokkos
\item Should be built and installed somewhere
\item Use one tool at a time with the environment variable \texttt{KOKKOS\_TOOLS\_LIB}
\end{itemize}
\end{frame}
% _____________________________________________________________________________
\begin{frame}[fragile]{Kernel timer to do a basic profiling}
\begin{columns}
\begin{column}{0.6\linewidth}
\begin{minted}[breakafter=/]{sh}
export KOKKOS_TOOLS_LIB=path/to/lib/libkp_kernel_timer.so
./my_program
kp_reader ./name_of_report.dat
\end{minted}
\end{column}
\begin{column}{0.4\linewidth}
\begin{itemize}
\item Simple tool producing some timing analysis
\item Export environment variable to use the tool
\item Run the program as usual
\item Analyze the generated data with the provided \texttt{kp\_reader} program
\end{itemize}
\end{column}
\end{columns}
\end{frame}
% _____________________________________________________________________________
\begin{frame}[fragile]{Kernel timer output}
\begin{minted}[fontsize=\scriptsize]{text}
(Type) Total Time, Call Count, Avg. Time per Call, %Total Time in Kernels, %Total Program Time
-------------------------------------------------------------------------
Regions:
...
-------------------------------------------------------------------------
Kernels:
...
-------------------------------------------------------------------------
Summary:
Total Execution Time (incl. Kokkos + non-Kokkos): 0.00205 seconds
Total Time in Kokkos kernels: 0.00115 seconds
-> Time outside Kokkos kernels: 0.00090 seconds
-> Percentage in Kokkos kernels: 55.98 %
Total Calls to Kokkos Kernels: 3
-------------------------------------------------------------------------
\end{minted}
\end{frame}
% _____________________________________________________________________________
\section{Subviews}
% _____________________________________________________________________________
\section{Atomics}
% _____________________________________________________________________________
\section{Layouts}
% _____________________________________________________________________________
\section{Subviews}
\end{document}