Skip to content

Commit 7f83967

Browse files
authored
Merge branch 'master' into beamer-tutorial-2025
2 parents 2dcee8d + 5f862e8 commit 7f83967

File tree

1 file changed

+18
-55
lines changed

1 file changed

+18
-55
lines changed

ALP_Transition_Path_Tutorial.tex

Lines changed: 18 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ \section{ALP Transition Paths}\label{sec:intro}
66

77
\subsection{Setup: Installing ALP and Preparing to Use the Solver}\label{sec:setup}
88

9-
This section explains how to install ALP on a Linux system and compile a simple example. ALP (Algebraic Programming) provides a C++17 library implementing the GraphBLAS interface for linear-algebra-based computations.
9+
This section explains how to install ALP on a Linux system and compile a simple example.
10+
ALP (Algebraic Programming) provides a C++17 library implementing the GraphBLAS interface
11+
for linear-algebra-based computations.
1012

1113
\subsubsection*{Installation on Linux}
1214

@@ -17,45 +19,12 @@ \subsubsection*{Installation on Linux}
1719
sudo apt-get install build-essential libnuma-dev libpthread-stubs0-dev cmake
1820
\end{verbatim}
1921

20-
\item Obtain ALP: Download or clone the ALP repository (from the official GitHub). For instance:
21-
\begin{verbatim}
22-
git clone https://github.com/Algebraic-Programming/ALP.git
23-
\end{verbatim}
24-
Then enter the repository directory.
25-
26-
\item Build ALP: Create a build directory and invoke the provided bootstrap script to configure the project with CMake, then compile and install:
27-
\begin{lstlisting}[language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
28-
$ cd ALP && mkdir build && cd build
29-
$ export ALP_INSTALL_DIR=../install # Set ALP installation directory
30-
$ ../bootstrap.sh --prefix=$ALP_INSTALL_DIR # configure the build
31-
$ make -j # compile the ALP library
32-
$ make -j install # install to $ALP_INSTALL_DIR
33-
\end{lstlisting}
34-
(You can choose a different installation prefix as needed.)
35-
36-
\item Set up environment: After installation, activate the ALP environment by sourcing the script setenv in the install directory:
37-
\begin{lstlisting}[language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
38-
$ source $ALP_INSTALL_DIR/bin/setenv
39-
\end{lstlisting}
40-
This script updates paths to make ALP's compiler wrapper and libraries available.
41-
42-
\item Compile an example: ALP provides a compiler wrapper \texttt{grbcxx} to compile programs that use the ALP/GraphBLAS API. This wrapper automatically adds the correct include paths and links against the ALP library and its dependencies. For example, to compile the provided sp.cpp sample:
43-
\begin{lstlisting}[language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
44-
$ grbcxx ../examples/sp.cpp -o sp_example
45-
\end{lstlisting}
46-
By default this produces a sequential program; you can add the option \texttt{-b reference\_omp} to use the OpenMP parallel backend (shared-memory parallelism). The wrapper \texttt{grbcxx} accepts other backends as well (e.g.\ \texttt{-b hybrid} for distributed memory).
47-
48-
\item Run the program: Use the provided runner \texttt{grbrun} to execute the compiled binary. For a simple shared-memory program, running with \texttt{grbrun} is similar to using \texttt{./program} directly. For example:
49-
\begin{lstlisting}[language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
50-
$ grbrun ./sp_example
51-
\end{lstlisting}
52-
(The \texttt{grbrun} tool is more relevant when using distributed backends or controlling the execution environment; for basic usage, the program can also be run directly.)
53-
\end{enumerate}
54-
55-
You can also specify a backend with the -b flag. For instance, -b reference builds a sequential version, while -b reference\_omp enables ALP's shared-memory (OpenMP) parallel backend . If you built ALP with distributed-memory support, you might use -b hybrid or -b bsp1d for hybrid or MPI- nstyle backends. In those cases, you would run the program via grbrun (which handles launching multiple processes) – but for this tutorial, we will use a single-process, multi-threaded backend, so running the program normally is fine.
56-
\\
57-
58-
\textbf{Direct linking option}: If you prefer to compile with your usual compiler, you need to include ALP's headers and link against the ALP libraries manually. For the CG solver transition path, that typically means linking against the sparse solver library (e.g. libspsolver\_shmem\_parallel for the parallel version) and any core ALP libraries it depends on. For example, if ALP is installed in /opt/alp , you might compile with:
22+
\textbf{Direct linking option}: If you prefer to compile with your usual compiler,
23+
you need to include ALP's headers and link against the ALP libraries manually.
24+
For the CG solver transition path, that typically means linking against the
25+
sparse solver library (e.g. libspsolver\_shmem\_parallel for the parallel version)
26+
and any core ALP libraries it depends on. For example, if ALP is installed in /opt/alp,
27+
you might compile with:
5928

6029
\begin{lstlisting}[language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
6130
gcc -I/opt/alp/include -L/opt/alp/lib \
@@ -64,7 +33,9 @@ \subsubsection*{Installation on Linux}
6433
\end{lstlisting}
6534

6635

67-
(ALP's documentation provides details on which libraries to link for each backend [3].) Using grbcxx is recommended for simplicity, but it's good to know what happens under the hood. Now that our environment is set up, let's look at the CG solver API.
36+
(ALP's documentation provides details on which libraries to link for each backend [3].)
37+
Using grbcxx is recommended for simplicity, but it's good to know what happens under the hood.
38+
Now that our environment is set up, let's look at the CG solver API.
6839

6940

7041
\subsection{Overview of ALP's Non-Blocking Sparse CG API}\label{sec:api}
@@ -194,25 +165,17 @@ \section*{Building and Running the Example}
194165
To compile the above code with ALP, we will use the direct linking option as discussed.
195166
\begin{lstlisting}[language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
196167
g++ example.cpp -o cg_demo \
197-
-I $ALP_INSTALL_DIR/include \
198-
-L $ALP_INSTALL_DIR/lib \
199-
-L $ALP_INSTALL_DIR/lib/sequential \
200-
-Wl,-rpath,$ALP_INSTALL_DIR/lib/sequential \
201-
-lspsolver_shmem_parallel \
202-
-lalp_cspblas_shmem_parallel \
203-
-lgraphblas \
204-
-lalp_utils \
205-
-lksolver \
206-
-fopenmp \
207-
-lnuma \
208-
-no-pie
168+
-I$ALP_INSTALL_DIR/include \
169+
-L$ALP_INSTALL_DIR/lib/ -L$ALP_INSTALL_DIR/lib/sequential/ \
170+
-lspsolver_shmem_parallel -lgraphblas -fopenmp -lnuma
209171
\end{lstlisting}
210172
After a successful compile, you can run the program:
211-
\begin{lstlisting}[language=bash]
173+
\begin{lstlisting}[language=bash,basicstyle=\ttfamily\small, showstringspaces=false]
174+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ALP_INSTALL_DIR/lib:$ALP_INSTALL_DIR/lib/sequential/
212175
./cg_demo
213176
\end{lstlisting}
214177
It should output something like:
215-
\begin{lstlisting}[language=bash]
178+
\begin{lstlisting}[language=bash,basicstyle=\ttfamily\small, showstringspaces=false]
216179
Solution x = [1.00, 2.00, 3.00]
217180
\end{lstlisting}
218181

0 commit comments

Comments
 (0)