A program generator for the all-pairs shortest paths problem (APSP) based on the Floyd-Warshall algorithm. For a given problem size, the generator automatically generates and times programs with different degrees of blocking and loop unrolling to find the fasest for a givne platform. The generator can output standard scalar C code as well as SSE SIMD vector code. The design of the generator is in spirit similar to ATLAS.
The all-pairs shortest path problem (APSP) finds the length of the shortest path for all source-destination pairs in a (positively) weighted graph. It belongs to the most fundamental problems in graph theory. The problem occurs in many algorithms in communication, networking, and circuit design.
The APSP is solved by the well-known Floyd-Warshall (FW) algorithm, which computes the solution inplace from the weight matrix of the graph using a triple loop similar to MMM, but involving only additions and minimum operations, and with dependencies that restrict the ordering of the three loops (the k-loop has to be the outermost one). To optimize cache performance,  introduced a tiled version of the FW algorithm. Further improvements were made in , which showed that the tiling can be done recursively up to some chosen base case and combined with a ZMorton data layout to increase performance.
Our program generator  goes beyond the above approaches. First, it is a program generator, not a library. Further, we 1) consider different levels and degrees of blocking; 2) different degrees of unrolling; and 3) generate scalar as well as SIMD vector code for data type float and integer.
We are faster than other approaches and achieve considerable performance as shown below.
Benchmarks on a 3.6 GHz (model number 560), with 16 KB L1 cache, 1MB L2 cache, and 1 GB main memory. All algorithms (FWD, FWT, FWI) are variants of Floyd-Warshall. y-axis: performance, x-axis: base-2 log of problem size (number of nodes in graph). The best performance is achieved in both cases (left: float; right: short integer) with FWD and FWT. More details in .
Note: People have reported problems with compiling the generated code. We do not maintain this software anymore but if you can resolve the problem, we'd be happy to post an update with acknowledgment.
The program generator can be downloaded here. The archive also contains generated example code for APSP underlying the results in our paper.
Contact: Sungchul Han, sungchul_han (at) xxxsamsung.com (delete xxx)