Skip to content

Commit edbf574

Browse files
author
Denis Jelovina
committed
Comment blocks
1 parent 99b55df commit edbf574

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

ALP_Transition_Path_Tutorial.tex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ \subsection{Installation on Linux}
2424
Then enter the repository directory.
2525

2626
\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]
27+
\begin{lstlisting}[language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
2828
$ cd ALP && mkdir build && cd build
2929
$ ../bootstrap.sh --prefix=../install # configure the build
3030
$ make -j # compile the ALP library
@@ -35,19 +35,19 @@ \subsection{Installation on Linux}
3535
(You can choose a different installation prefix as needed.)
3636

3737
\item Set up environment: After installation, activate the ALP environment by sourcing the script setenv in the install directory:
38-
\begin{lstlisting}[language=bash]
38+
\begin{lstlisting}[language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
3939
$ source ../install/bin/setenv
4040
\end{lstlisting}
4141
This script updates paths to make ALP's compiler wrapper and libraries available.
4242

4343
\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:
44-
\begin{lstlisting}[language=bash]
44+
\begin{lstlisting}[language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
4545
$ grbcxx ../examples/sp.cpp -o sp_example
4646
\end{lstlisting}
4747
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).
4848

4949
\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:
50-
\begin{lstlisting}[language=bash]
50+
\begin{lstlisting}[language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
5151
$ grbrun ./sp_example
5252
\end{lstlisting}
5353
(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.)
@@ -58,7 +58,7 @@ \subsection{Installation on Linux}
5858

5959
\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:
6060

61-
\begin{lstlisting}[language=bash]
61+
\begin{lstlisting}[language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
6262
gcc -I/opt/alp/include -L/opt/alp/lib \
6363
-lspsolver_shmem_parallel -lalp_cspblas_shmem_parallel \
6464
my_program.c -o my_program
@@ -106,7 +106,7 @@ \section{Example: Solving a Linear System with ALP’s CG Solver}
106106
Below is a complete program using ALP’s CG solver to solve for $x$. We include the necessary ALP header
107107
for the solver API, set up the matrix and vectors, call the API functions in order, and then print the result.
108108

109-
\begin{lstlisting}[ label=lst:example, showstringspaces=false]
109+
\begin{lstlisting}[language=C++, label=lst:example, showstringspaces=false, basicstyle=\ttfamily\small, caption={Example program using ALP's CG solver API}]s
110110

111111
#include <stdio.h>
112112
#include <stdlib.h>
@@ -193,7 +193,7 @@ \section{Example: Solving a Linear System with ALP’s CG Solver}
193193

194194
\section*{Building and Running the Example}
195195
To compile the above code with ALP, we will use the direct linking option as discussed.
196-
\begin{lstlisting}[language=bash]
196+
\begin{lstlisting}[language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
197197
g++ example.cpp -o cg_demo \
198198
-I install/include \
199199
-L install/lib \

ALP_Tutorial.tex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ \subsubsection{Exercise: Allocating Vectors and Matrices in ALP}
107107

108108
When you run this program, ALP will print informational messages about initialization and finalization, and you will see lines reporting each container’s capacity. In particular, you should observe output similar to:
109109

110-
\begin{lstlisting}
110+
\begin{lstlisting} [language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
111111
Info: grb::init (reference) called.
112112
Capacity of x: 100
113113
Capacity of y: 1000
@@ -138,7 +138,7 @@ \subsection{Semirings and Algebraic Operations}
138138
A semiring is a combination of a multiplicative operator and an additive monoid. Many common semirings are provided or can be constructed. For instance, the plus-times semiring uses standard addition as the accumulation (monoid) and multiplication as the combination operator – this yields ordinary linear algebra over real numbers. One can also define a \texttt{min-plus} semiring (useful for shortest path algorithms, where "addition" is min and "multiplication" is numeric addition). ALP’s design allows an “almost unlimited variety of operators and types” in semirings.
139139

140140
In code, ALP provides templates to construct these. For example, one can define:
141-
\begin{lstlisting}
141+
\begin{lstlisting} [language=C++, basicstyle=\ttfamily\small, showstringspaces=false ]
142142
using Add = grb::operators::add<double>;
143143
using AddMonoid = grb::Monoid<Add, grb::identities::zero>;
144144
using Mul = grb::operators::mul<double>;
@@ -204,7 +204,7 @@ \section{Simple Example}\label{sec:simple_example}
204204

205205
Below is the code for this example, with commentary:
206206

207-
\begin{lstlisting}[caption={Example program using ALP/GraphBLAS primitives in C++}, label=lst:example, showstringspaces=false]
207+
\begin{lstlisting}[ language=C++, basicstyle=\ttfamily\small, caption={Example program using ALP/GraphBLAS primitives in C++}, label=lst:example, showstringspaces=false]
208208

209209
/*
210210
* example.cpp - Corrected minimal ALP (GraphBLAS) example.
@@ -391,7 +391,7 @@ \section{Simple Example}\label{sec:simple_example}
391391

392392
When you run the example, the program first prints each step of the computation (building the matrix, creating the vector, etc.). In particular, you will see lines like
393393

394-
\begin{lstlisting}
394+
\begin{lstlisting} [language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
395395
Step 1: Constructing a 3x3 sparse matrix A.
396396
Step 2: Creating vector x = [1, 2, 3]^T.
397397
Step 3: Computing y = A·x under plus‐times semiring.
@@ -420,7 +420,7 @@ \section{Simple Example}\label{sec:simple_example}
420420
\mathrm{dot}(\mathbf{x},\mathbf{x}) \;=\; 14.
421421
\]
422422
Hence, immediately after the step‐headings, the console will display something like:
423-
\begin{lstlisting}
423+
\begin{lstlisting} [language=bash, basicstyle=\ttfamily\small, showstringspaces=false]
424424
// Step 4: Computing z = x ⊙ x (element‐wise multiply).
425425
x = [ 1, 2, 3 ]
426426
y = A·x = [ 7, 18, 17 ]
@@ -466,7 +466,7 @@ \subsection*{Using a custom build (Make/CMake)}
466466

467467
If you are using CMake for your own project, you can integrate ALP as follows. There may not be an official CMake package for ALP, but you can use \texttt{find\_library} or hard-code the path. For instance, in your \texttt{CMakeLists.txt}:
468468

469-
\begin{lstlisting}
469+
\begin{lstlisting}[caption={Example CMakeLists.txt for an ALP project}]
470470
cmake_minimum_required(VERSION 3.13)
471471
project(ALPExample CXX)
472472
find_package(OpenMP REQUIRED) # find OpenMP for -fopenmp

0 commit comments

Comments
 (0)