You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This script updates paths to make ALP's compiler wrapper and libraries available.
42
42
43
43
\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:
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).
48
48
49
49
\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:
(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}
58
58
59
59
\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:
Copy file name to clipboardExpand all lines: ALP_Tutorial.tex
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -107,7 +107,7 @@ \subsubsection{Exercise: Allocating Vectors and Matrices in ALP}
107
107
108
108
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:
@@ -138,7 +138,7 @@ \subsection{Semirings and Algebraic Operations}
138
138
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.
139
139
140
140
In code, ALP provides templates to construct these. For example, one can define:
Below is the code for this example, with commentary:
206
206
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]
208
208
209
209
/*
210
210
* example.cpp - Corrected minimal ALP (GraphBLAS) example.
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
// Step 4: Computing z = x ⊙ x (element‐wise multiply).
425
425
x = [ 1, 2, 3 ]
426
426
y = A·x = [ 7, 18, 17 ]
@@ -466,7 +466,7 @@ \subsection*{Using a custom build (Make/CMake)}
466
466
467
467
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}:
468
468
469
-
\begin{lstlisting}
469
+
\begin{lstlisting}[caption={Example CMakeLists.txt for an ALP project}]
470
470
cmake_minimum_required(VERSION 3.13)
471
471
project(ALPExample CXX)
472
472
find_package(OpenMP REQUIRED) # find OpenMP for -fopenmp
0 commit comments