Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/nornir

crates/graphblas-sys/README.md

graphblas-sys

Raw FFI bindings to SuiteSparse:GraphBLAS, our own bindgen output, linked dynamically to the system libgraphblas. The safe layer is nornir-mimir-graph (mimir_graph).

Why our own: the published wrappers (graphblas_sparse_linear_algebra, suitesparse_graphblas_sys) are CC-BY-NC-4.0. SuiteSparse:GraphBLAS itself is Apache-2.0 (see NOTICE).

Install the library

sudo apt-get install -y libgraphblas-dev      # Ubuntu: GraphBLAS 7.4.0

Found via GRAPHBLAS_INCLUDE_DIR / GRAPHBLAS_LIB_DIR, then pkg-config GraphBLAS (upstream ships a .pc since 8.x; Ubuntu's 7.4 does not), then /usr/include, /usr/local/include, …/suitesparse.

Pregenerated bindings (default) vs regenerate

src/bindings_7_4.rs is checked in, generated from Ubuntu's GraphBLAS.h 7.4.0. A normal build needs no libclang: build machines and the test boxes often lack it, and bindgen (+ clang-sys) costs ~4 min of build on a busy 12-core box. build.rs only links -lgraphblas and reads GxB_IMPLEMENTATION_MAJOR from the header (plain text) — a header of a different major version fails the build with a pointer to regenerate. The safe layer also checks the linked library's version at GrB_init.

--features regenerate runs bindgen at build time (needs libclang-dev). To refresh the checked-in file after a library upgrade:

cargo build -p graphblas-sys --features regenerate
cp target/debug/build/graphblas-sys-*/out/bindings.rs crates/graphblas-sys/src/bindings_7_4.rs

Allowlist: functions, vars and types matching G[rx]B_.*; GB_*_opaque object structs (library-private) and libc FILE are emitted opaque.

7.4 (system) vs vendored 10.x — later decision

Nothing the lenses need today is missing in 7.4: CSR pack (zero-copy ownership hand-over), iso builds (GxB_Matrix_build_Scalar), GrB_Matrix_diag, ANY_PAIR / LOR_LAND / MIN_PLUS / MAX_SECOND / MIN_SECOND / PLUS_PAIR semirings, complemented structural masks. So no vendored build now.

What a vendored upstream 10.x (cmake) would buy, and cost:

Revisit when 10⁸+ edges make the 64-bit CSR memory matter, or when an op needs something 7.4 lacks.