Skip to content

Commit b984063

Browse files
djelovinaDenis Jelovinap-anastasGiovaGaanyzelman
authored
Beamer tutorial 2025 (#5)
* Add main and beamer LaTeX files for ALP tutorial and GraphBLAS presentation * Enhance Makefile and beamer tutorial with improved dependency management, additional helper targets, and updated installation instructions for ALP tutorial. * Refactor * Added gitignore for Latex compilation files * Added 2 (installation) slides * Added PDFs to .gitignore * Added HW section to slides * Added slides for 3.1 + minor fixes * Added slides for 3.2 + fixed errors * Add roadmap slides and detailed agenda for the tutorial * 3.2 Fixes + new dir for scripts (towards end-to-end standalone tutorial) * Add Exercise 8 starter code and Makefile for ALP tutorial * Intro to SPMD * Added 3.3 section + minor updates * Updated styles for terminal/cpp-rich code blocks (unified for everybody) * Fix typo * Reworked outline a little before delving into the core primitives intro * Added intro slides for HIPO modeling * Remove unnecessary comments and whitespace in beamer-tutorial.tex * Update tutorial slides with ALP algorithms overview and new solver details * Add Python mxv example with pyalp and detailed explanation * Simulated Annealing * Minor model updates * Simulated Annealing examples * Added more modeling slides * 10 and 11 ,Add transition path recap and Conjugate Gradient C++ interface examples to tutorial * Added more model details and image * Added Image folder and some basic image slides (need fixing) * Add details of two primitives in section 3.4. Rest will come over the weekend * Add Exercise 9 for Python Conjugate Gradient with starter code * Add starter and solution files for Exercise 9: Python Conjugate Gradient with ALP/GraphBLAS backends * Add run script for Exercise 9 to automate environment setup and execution * Quick fix snafu, apologies * Slides for tutorial section 3.4 done * Improved model slides + removed extras * Uniformise use of newlines in section 3.4 * Add solution slide for ex 8 * Remove "corrected", not sure what it means * Finish section on explicit SPMD control * Tutorial section references clean-up, split Tuesday in morning and afternoon * The removed note is how it was pre v0.1; it would be a regression of sorts to go back to that. Instead, a suggestion that is more compatible with modern ALP would be to have an NLA layer on top of ALP that automatically injects a plus-times semiring and passes it on to the core ALP implementation * Reworked section 3.5, including adding exercises * Unify sectioning for transition path of the tutorial * Remove trailing spaces and fix one typo * Sectioning in line with updated tutorial. Removed ABI -- from the slides ABI refers to the library interface (by which the .so or .a is called), but this is not what ABI means; the ABI instead is the convention by which this interfacing occurs; i.e., the definition of how arguments are put in the stack etc. * Added two more advanced topics to the tutorial * Remove HTML compilation job from static workflow and adjust deployment dependencies * Enhance PDF compilation workflow by adding Beamer tutorial compilation and updating artifact uploads * Updated exe3 layout * Add conditional deployment for protected default branch * Fixed link and layout errors * FIxed "" * Refine Exercise 8 and 9 instructions in Beamer tutorial for clarity and completeness * Enhance installation instructions and add run script for exercise 9 * Minor updates on models + presenation * Rename extra_packages to extra_system_packages * Simplify LaTeX compilation by removing packages Removed extra system packages from LaTeX compilation steps. * Fix tex bug Added installation prerequisites for Linux. --------- Co-authored-by: Denis Jelovina <[email protected]> Co-authored-by: Petros Anastasiadis <[email protected]> Co-authored-by: Giovanni Gaio <[email protected]> Co-authored-by: Albert-Jan N. Yzelman <[email protected]>
1 parent 5f862e8 commit b984063

29 files changed

+3416
-138
lines changed

.github/workflows/static.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Deploy static content to Pages
44
on:
55
# Runs on pushes targeting the default branch
66
push:
7-
branches: ["master"]
7+
branches: ["master", "beamer-tutorial-2025"]
88

99
# Allows you to run this workflow manually from the Actions tab
1010
workflow_dispatch:
@@ -22,26 +22,38 @@ concurrency:
2222
cancel-in-progress: false
2323

2424
jobs:
25-
build_pdf: # New job for PDF compilation
25+
build_pdf: # Job for LaTeX and Beamer PDF compilation
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Checkout repository
2929
uses: actions/checkout@v4
3030

31-
- name: Compile LaTeX to PDF
31+
- name: Compile LaTeX (main.tex)
3232
uses: xu-cheng/latex-action@v3
3333
with:
3434
root_file: main.tex
3535

36-
- name: Upload PDF artifact
36+
- name: Compile Beamer tutorial (beamer-tutorial.tex)
37+
uses: xu-cheng/latex-action@v3
38+
with:
39+
root_file: beamer-tutorial.tex
40+
41+
- name: Upload main PDF artifact
3742
uses: actions/upload-artifact@v4
3843
with:
3944
name: latex-pdf-output
40-
path: main.pdf # Assuming main.pdf is in the root after compilation
45+
path: main.pdf
4146

47+
- name: Upload beamer PDF artifact
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: beamer-pdf-output
51+
path: beamer-tutorial.pdf
4252

4353
# Single deploy job since we're just deploying
4454
deploy:
55+
# Only deploy from the protected default branch
56+
if: github.ref == 'refs/heads/master'
4557
needs: [build_pdf]
4658
environment:
4759
name: github-pages
@@ -55,13 +67,15 @@ jobs:
5567
- name: Download all artifacts
5668
uses: actions/download-artifact@v4
5769
with:
58-
path: artifacts
70+
path: artifacts/ # Downloads both latex-pdf-output and beamer-pdf-output
5971

6072
- name: Prepare public directory for Pages
6173
run: |
6274
mkdir public
63-
# Move PDF to public/
75+
# Move PDFs to public/
6476
mv artifacts/latex-pdf-output/main.pdf public/
77+
mv artifacts/beamer-pdf-output/beamer-tutorial.pdf public/
78+
ls -l public
6579
6680
- name: Setup Pages
6781
uses: actions/configure-pages@v5
@@ -73,4 +87,4 @@ jobs:
7387

7488
- name: Deploy to GitHub Pages
7589
id: deployment
76-
uses: actions/deploy-pages@v4
90+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# LaTeX intermediate files
2+
*.aux
3+
*.fdb_latexmk
4+
*.fls
5+
*.log
6+
*.nav
7+
*.out
8+
*.snm
9+
*.synctex.gz
10+
*.toc
11+
*.vrb
12+
13+
# LaTeX build files
14+
*.bbl
15+
*.blg
16+
*.idx
17+
*.ilg
18+
*.ind
19+
*.lof
20+
*.lot
21+
*.glo
22+
*.gls
23+
*.glg
24+
*.acn
25+
*.acr
26+
*.alg
27+
*.bcf
28+
*.run.xml
29+
*.figlist
30+
*.makefile
31+
*.fls
32+
*.fdb_latexmk
33+
34+
# LaTeX backup files
35+
*.bak
36+
*~
37+
38+
# LaTeX editor files
39+
*.swp
40+
*.swo
41+
*~
42+
43+
# PDF files (uncomment if you don't want to track compiled PDFs)
44+
*.pdf
45+

AALP.tex

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
\section{Advanced ALP}
3+
4+
This Section treats some more advanced ALP topics by which programmers can exercise tighter control over performance or semantics.
5+
6+
\subsection{Performance Optimisation through Descriptors}
7+
8+
We have previously seen that the semantics of primitives may be subtly changed by the use of descriptors: e.g., adding \texttt{grb::descriptors::transpose\_matrix} to \texttt{grb::mxv} has the primitive interpret the given matrix $A$ as its transpose ($A^T$) instead. Other descriptors, however, may also modify the performance semantics of a primitive. One example is the \texttt{grb::descriptors::dense} descriptor, which has two main effects when supplied to a primitive:
9+
\begin{enumerate}
10+
\item all vector arguments to the primitive must be dense on primitive entry; and
11+
\item any code paths that check sparsity or deal with sparsity are disabled.
12+
\end{enumerate}
13+
The latter effect directly affects performance, which is particularly evident for the \texttt{grb::nonblocking} backend. Another type of performance effect also caused by the latter is that produced binary code is smaller in size as well.\vspace{.5\baselineskip}
14+
15+
\noindent \textbf{Exercise 12}: inspect the implementation of the PCG method in ALP. Run experiments using the \texttt{nonblocking} backend, comparing the performance of repeated linear solves with and without the dense descriptor. Also inspect the size of the binary. \textbf{Hint}: try \verb|make -j\$(nprocs) build_tests_category_performance| and see if an executable is produced in \texttt{tests/performance} that helps you complete this exercise faster.
16+
17+
\subsection{Explicit SPMD}
18+
19+
When compiling any ALP program with a distributed-memory backend such as \texttt{bsp1d} or \texttt{hybrid}, ALP automatically parallelises across multiple user processes. Most of the time this suffices, however, in some rare cases, the ALP programmer requires exercising explicit control over distributed-memory parallelism. Facilities for these exist across three components, in order of increasing control: \texttt{grb::spmd}, \texttt{grb::collectives}, %\texttt{grb::rdma},
20+
and \emph{explicit backend dispatching}.
21+
22+
\subsubsection*{Basic SPMD}
23+
24+
When selecting a distributed-memory backend, ALP automatically generates SPMD code without the user having to intervene. The \texttt{grb::spmd} class exposes these normally-hidden SPMD constructs to the programmer: 1) \texttt{grb::spmd<>::nprocs()} returns the number of user processes in the current ALP program, while 2) \texttt{grb::spmd<>::pid()} returns the unique ID of the current user process.
25+
26+
\noindent \textbf{Exercise 13}: try to compile and run the earlier hello-world example using the \texttt{bsp1d} backend. How many hello world messages are printed? \textbf{Hint}: use \texttt{-np 2} to \texttt{grbrun} to spawn two user processes when executing the program. Now modify the program so that no matter how many user processes are spawned, only one message is printed to the screen (\texttt{stdout}).
27+
28+
\subsubsection*{Collectives}
29+
30+
The most common way to orchestrate data movement between user processes are the so-called \emph{collective communications}. Examples include:
31+
\begin{enumerate}
32+
\item \emph{broadcast}, a communication pattern where one of the user processes is designated the \emph{root} of the communication, and has one payload message that should materialise on all other user processes.
33+
\item \emph{allreduce}, a communication pattern where all user processes have a value that should be \emph{reduced} into a single aggregate value, which furthermore must be available at each user process.
34+
\end{enumerate}
35+
36+
ALP also exposes collectives, and in the case of (all)reduce does so in an algebraic manner-- that is, the signature of an allreduce expects an explicit monoid that indicates how aggregation is supposed to occur:
37+
38+
\begin{lstlisting} [language=C++, basicstyle=\ttfamily\small, showstringspaces=false, morekeywords=constexpr, morekeywords=size_t ]
39+
size_t to_be_reduced = grb::spmd<>::pid();;
40+
grb::monoid::max< int > max;
41+
grb::RC rc = grb::collectives<>::allreduce( to_be_reduced, max );
42+
if( rc == grb::SUCCESS ) { assert( to_be_reduced + 1 == grb::spmd<>::nprocs ); }
43+
if( grb::spmd<>::pid() == 0 ) { std::cout << "There are " << to_be_reduced << " processes\n"; }
44+
\end{lstlisting}
45+
46+
\noindent \textbf{Exercise 14}: change the initial assignment of \texttt{to\_be\_reduced} to $1$ (at each process). Modify the above example to still compute the number of processes via an allreduce collective. \textbf{Hint}: if aggregation by the max-monoid is not suitable after changing the initialised value, which aggregator would be?
47+
48+
\subsubsection*{Explicit dispatching}
49+
50+
ALP containers are templated in the backend they are compiled for-- this is specified as the second template argument, which is default-initialised to the backend given to the \texttt{grbcxx} wrapper. This means the backend is part of the type of ALP containers, which, in turn, enables the compiler to generate, for each ALP primitive, the code that corresponds to the requested backend. It is, however, possible to manually override this backend template argument, which is useful in conjunction with SPMD in that the combination allows the programmer to define operations that should execute within a user process only, as opposed to defining operations that should be performed \emph{across} user processes.
51+
52+
For example, within a program compiled with the \texttt{bsp1d} or \texttt{hybrid} backends, a user may define a process-local vector as follows: \texttt{grb::Vector< double, grb::nonblocking > local\_x( local\_n )}, where \texttt{local\_n} is some local size indicator that normally is proportional to $n/P$, with $n$ a global size and $P$ the total number of user processes. Using \texttt{grb::spmd}, the programmer may specify that each user process performs different computations on their local vectors. This results in process-local computations that are totally independent of other processes, which later on may be aggregated into some meaningful global state through, for example, collectives.\vspace{.5\baselineskip}
53+
54+
\noindent\textbf{Exercise 15}: use the mechanism here described to write a program that, when executed using $P$ processes, solves $P$ different linear systems $Ax=b_k$ where $A$ is the same at every process while the $b_k$, $0\leq k<P$ are initialised to $(k, k, \ldots, k)^T$ each. Make it so that the program returns the maximum residual (squared 2-norm of $b-Ax$) across the $P$ processes. \textbf{Hint}: reuse one of the pre-implemented linear solvers, such as CG.
55+

0 commit comments

Comments
 (0)