How to Run STRATA

Installation and Benchmark Guide
← Back to Home

1. Installation

Clone the Repository

git clone https://github.com/dknife/STRATA.git
cd STRATA

Install Dependencies

pip install numpy scipy networkx tqdm

GPU Methods (optional)

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.

GraphBLAS Methods (optional)

pip install suitesparse-graphblas

2. Running Benchmarks

Full Benchmark (11 methods × 6 graphs)

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 (GraphBLAS) Standalone

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.

Benchmark Graphs

GraphnmdSource
Facebook4,039176,468804_Datasets/real-world/
BA-20002,00019,9505Generated (seed=42)
WS-20002,00012,0008Generated (seed=42)
ER-20002,00019,8826Generated (seed=42)
Grid-45×452,0257,92088Generated
PLC-20002,00019,9265Generated (seed=42)

Benchmark Protocol

3. Python API

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
    """

Example Usage

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)

Available Methods

IDImportPlatform
BC1BC1_NetworkX.apspCPU
BC2BC2_SciPy.apspCPU
BC3BC3_IAORM.apspCPU
BC4BC4_MAORM.apspCPU
BC5BC5_GB_bfs.apspCPU (GraphBLAS)
TC1TC1_STRATA_SpMM_Cython.apspCPU
TC2TC2_STRATA_NumpyBLAS.apspCPU
TC3TC3_STRATA_GraphBLAS.apspCPU (GraphBLAS)
BG1BG1_GPU_PerSrc_BFS.apspGPU (CUDA)
TG1TG1_STRATA_cuBLAS.apspGPU (cuBLAS)
TG2TG2_STRATA_CUDA.apspGPU (CUDA)

4. Supported Graph Formats

FormatExtensionDescription
Edge list.txt, .csv, .tsv, .edgesOne edge per line: src dst
NetworkX pickle.gpickleSerialized NetworkX graph
SciPy sparse.npzSparse matrix in NPZ format
Matrix Market.mtxStandard sparse matrix format