git clone https://github.com/dknife/STRATA.git
cd STRATA
pip install numpy scipy networkx tqdm
pip install cupy-cuda12x
If CuPy cannot find CUDA, install the runtime packages:
pip install nvidia-cuda-runtime-cu12 nvidia-cuda-nvrtc-cu12 nvidia-cublas-cu12 nvidia-cusparse-cu12 nvidia-nvjitlink-cu12
The common/cuda_env.py module automatically detects CUDA_PATH from pip-installed nvidia packages.
pip install suitesparse-graphblas
cd 02_Implementations
python run_full_benchmark.py
This benchmarks 10 methods (BC1–BC5, TC1–TC2, BG1, TG1–TG2) across 6 graph topologies. Results are saved to full_benchmark_results.json.
TC3 must run in a separate process to avoid GrB_init conflict with BC5:
python run_tc3_standalone.py
Results are saved to tc3_benchmark_results.json.
| Graph | n | m | d | Source |
|---|---|---|---|---|
| 4,039 | 176,468 | 8 | 04_Datasets/real-world/ | |
| BA-2000 | 2,000 | 19,950 | 5 | Generated (seed=42) |
| WS-2000 | 2,000 | 12,000 | 8 | Generated (seed=42) |
| ER-2000 | 2,000 | 19,882 | 6 | Generated (seed=42) |
| Grid-45×45 | 2,025 | 7,920 | 88 | Generated |
| PLC-2000 | 2,000 | 19,926 | 5 | Generated (seed=42) |
Each method in 02_Implementations/<ID>/apsp.py exposes the same interface:
def run_apsp(A_csr, k=-1, verbose=True):
"""
Args:
A_csr: Adjacency matrix (scipy.sparse or numpy array)
k: Hop constraint (-1 for full APSP)
verbose: Show progress
Returns:
D: Distance matrix as numpy int32 array
"""
import sys
sys.path.insert(0, '02_Implementations')
import scipy.sparse as sp
from common.loader import load_graph, make_undirected
# Load graph
A, n, m = load_graph('04_Datasets/real-world/facebook_combined.txt',
fmt='edgelist', directed=True)
A = make_undirected(A)
# Run any method
from TC1_STRATA_SpMM_Cython.apsp import run_apsp
D = run_apsp(A, verbose=True)
print(f"Distance matrix: {D.shape}, max distance: {D.max()}")
# GPU method
from TG2_STRATA_CUDA.apsp import run_apsp as run_gpu
D_gpu = run_gpu(A, verbose=True)
| ID | Import | Platform |
|---|---|---|
| BC1 | BC1_NetworkX.apsp | CPU |
| BC2 | BC2_SciPy.apsp | CPU |
| BC3 | BC3_IAORM.apsp | CPU |
| BC4 | BC4_MAORM.apsp | CPU |
| BC5 | BC5_GB_bfs.apsp | CPU (GraphBLAS) |
| TC1 | TC1_STRATA_SpMM_Cython.apsp | CPU |
| TC2 | TC2_STRATA_NumpyBLAS.apsp | CPU |
| TC3 | TC3_STRATA_GraphBLAS.apsp | CPU (GraphBLAS) |
| BG1 | BG1_GPU_PerSrc_BFS.apsp | GPU (CUDA) |
| TG1 | TG1_STRATA_cuBLAS.apsp | GPU (cuBLAS) |
| TG2 | TG2_STRATA_CUDA.apsp | GPU (CUDA) |
| Format | Extension | Description |
|---|---|---|
| Edge list | .txt, .csv, .tsv, .edges | One edge per line: src dst |
| NetworkX pickle | .gpickle | Serialized NetworkX graph |
| SciPy sparse | .npz | Sparse matrix in NPZ format |
| Matrix Market | .mtx | Standard sparse matrix format |