Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add intermediate course #23

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions courses/01_beginners/main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,29 @@
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{
Expand Down
1 change: 1 addition & 0 deletions courses/02_intermediate/.latexmkrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$xelatex = 'xelatex -shell-escape %O %S'
11 changes: 11 additions & 0 deletions courses/02_intermediate/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
all: main

%:
latexmk -pdfxe $<

clean:
latexmk -c

cleanall:
latexmk -C
rm -rf _minted-*
283 changes: 283 additions & 0 deletions courses/02_intermediate/main.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,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}
Loading