<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://robert-fritsch.de/feed.xml" rel="self" type="application/atom+xml" /><link href="https://robert-fritsch.de/" rel="alternate" type="text/html" /><updated>2026-10-08T11:43:02+00:00</updated><id>https://robert-fritsch.de/feed.xml</id><title type="html">Robert Andreas Fritsch</title><subtitle>C++ engineer focused on performance: algorithm engineering, parallel and distributed computing, and GPU programming.</subtitle><author><name>Robert Andreas Fritsch</name></author><entry><title type="html">[draft] KaSpan: strongly connected components on a supercomputer</title><link href="https://robert-fritsch.de/posts/kaspan/" rel="alternate" type="text/html" title="[draft] KaSpan: strongly connected components on a supercomputer" /><published>2026-10-05T00:00:00+00:00</published><updated>2026-10-05T00:00:00+00:00</updated><id>https://robert-fritsch.de/posts/kaspan</id><content type="html" xml:base="https://robert-fritsch.de/posts/kaspan/"><![CDATA[<p><em>Draft: more implementation details will follow.</em></p>

<p>For my master’s thesis in Prof. Peter Sanders’ Algorithm Engineering group at KIT (advisors Tim
Niklas Uhl and Matthias Schimek) I built <a href="https://github.com/rawbby/KaSpan">KaSpan</a>, a fully
distributed algorithm that finds the strongly connected components of graphs too large for a
single machine.</p>

<h2 id="the-problem">The problem</h2>

<p>A strongly connected component (SCC) is a maximal set of vertices in which every vertex can reach
every other one. SCCs are used to analyze web and social graphs, to verify state spaces and to
break cyclic dependencies in simulations. Tarjan’s classical algorithm runs in linear time, but it
is built on depth-first search and therefore inherently sequential. Real-world graphs make
parallel algorithms hard as well: they typically consist of one giant SCC and a huge number of tiny
ones. With billions of edges, the graph no longer fits into one machine, so the algorithm has to
run on a distributed-memory cluster and communicate over the network.</p>

<h2 id="what-kaspan-does-differently">What KaSpan does differently</h2>

<p>KaSpan is based on the strategies of iSpan and borrows design principles from HPC-Graph, two
existing distributed SCC algorithms:</p>

<ul>
  <li><strong>Local-first searches.</strong> iSpan and HPC-Graph explore the graph with relaxed, level-synchronous
breadth-first searches. KaSpan lets every process first explore as far as it can locally and
only then synchronises, so intermediate label updates are never sent and the message volume
drops.</li>
  <li><strong>Memory that scales.</strong> KaSpan needs only O(n<sub>local</sub> + m<sub>local</sub>) extra memory
per process. It keeps no ghost cells and never replicates the whole graph (iSpan replicates the
graph on every process). It has the lowest memory footprint of the three algorithms.</li>
  <li><strong>No replication at the end.</strong> A key question of the thesis was whether the final “residual”
step is worth it: it copies the graph that is still unsolved to every process and finishes it
there with Tarjan’s algorithm. KaSpan performs about as well when it skips that step and relies
on color propagation alone, which removes the memory risk of replicating vertices.</li>
  <li><strong>An asynchronous variant</strong> with message buffering and hierarchical communication, which overlaps
communication with computation.</li>
</ul>

<p>KaSpan is written in C++ with MPI, using <a href="https://github.com/kamping-site/kamping">KaMPIng</a> for
the MPI bindings and BriefKAsten for the buffered asynchronous messages.</p>

<h2 id="how-i-evaluated-it">How I evaluated it</h2>

<p>All experiments ran on the HoreKa supercomputer at KIT (Intel Xeon Platinum 8368, 76 cores and
256 GiB per node, InfiniBand HDR), with strong scaling on up to 8,208 cores. The inputs were real
social, web and citation graphs from SNAP, KONECT and the WebGraph collection, the largest with
3.73 billion edges, plus synthetic graphs (Erdős–Rényi and R-MAT) from KaGen for weak scaling.
KaSpan was compared with iSpan and HPC-Graph (MPI-only and threaded).</p>

<figure>
  <img src="/assets/kaspan/strong_scaling_grid.svg" alt="Strong scaling of HPC-Graph, iSpan and KaSpan on eight real-world graphs, time over CPU cores" />
  <figcaption>Strong scaling on the eight real-world graphs: execution time over CPU cores (both
  axes logarithmic). Missing points are runs that did not finish because they ran out of memory
  or exceeded the time limit.</figcaption>
</figure>

<h2 id="results">Results</h2>

<ul>
  <li><strong>Twitter-2010</strong> (41 million vertices, 1.46 billion edges): KaSpan was faster than HPC-Graph;
iSpan ran out of memory.</li>
  <li><strong>Friendster</strong> (68 million vertices, 2.58 billion edges): KaSpan was about 4.7× faster than
HPC-Graph on 1,064 cores; iSpan ran out of memory at every core count. Across the large social
graphs, KaSpan’s execution times were up to 13.7× lower than HPC-Graph’s.</li>
  <li><strong>UK-2007-05</strong> (105 million vertices, 3.73 billion edges): here the threaded HPC-Graph was
faster. Its pull-based color propagation suits this web graph better.</li>
  <li><strong>Smaller real-world graphs</strong>: up to 105× lower execution times than iSpan and up to 108× lower
than HPC-Graph.</li>
  <li><strong>Synthetic graphs</strong> (weak scaling): on Erdős–Rényi graphs, KaSpan variants were faster than both
competitors, often by orders of magnitude; on R-MAT graphs, KaSpan was faster as well.</li>
</ul>

<figure>
  <img src="/assets/kaspan/weak_scaling_grid.svg" alt="Weak scaling on synthetic GNM and R-MAT graphs, time over CPU cores" />
  <figcaption>Weak scaling on synthetic graphs (GNM and R-MAT, n vertices per core, average degree
  d): the work per core stays constant while the core count grows.</figcaption>
</figure>

<figure>
  <img src="/assets/kaspan/strong_friendster_duration.svg" alt="Strong scaling on Friendster for all KaSpan variants and HPC-Graph" />
  <figcaption>Friendster, all variants: the synchronous KaSpan variants keep getting faster up to
  about 1,064 cores, while the asynchronous variant gets slower beyond 152 cores.</figcaption>
</figure>

<p>Each configuration ran once because of the compute budget, and reading the graphs from disk was
not part of the measurement.</p>

<h2 id="what-i-took-away">What I took away</h2>

<ul>
  <li><strong>Structure matters more than simple metrics.</strong> Twitter-2010 and UK-2007-05 have almost the same
average degree (about 35) but behave very differently, because their diameters and the way the
search frontier evolves differ.</li>
  <li><strong>No strategy wins everywhere.</strong> Techniques that help on one graph do nothing or cost time on
another, so a future implementation should switch strategies adaptively, based on runtime
measurements such as the frontier size.</li>
  <li><strong>Asynchrony is not free.</strong> The asynchronous variant was the fastest on small instances but
became unstable at high core counts.</li>
</ul>

<h2 id="code">Code</h2>

<p>The code, including the benchmark setup for HoreKa, is on GitHub:
<a href="https://github.com/rawbby/KaSpan">github.com/rawbby/KaSpan</a>.</p>]]></content><author><name>Robert Andreas Fritsch</name></author><summary type="html"><![CDATA[Draft: more implementation details will follow.]]></summary></entry></feed>