Skip to content

About

A benchmark suite of sparse array programming applications

Resources

Contributing

Stars

7 stars

Watchers

0 watching

Forks

Latest commit

 

History

668 Commits

Folders and files

Repository files navigation

SparseApplicationBenchmark

Sparse array programming frameworks, such as SciPy or pydata/sparse, are getting more advanced. Because sparse performance depends heavily on input sparsity patterns and full application structure, we need realistic applications to make informed design decisions. This benchmark suite consists of applications written with collective operations, such as +, *, sum, and reduce, over sparse arrays.

The programs are adapted from real-world applications using a straightforward translation to an array-programming style. The standard benchmark function is plain Python using Array API functions, minimal control flow, and no framework-specific shortcuts.

We take inspiration from benchmark suites in the database community, such as pandasbench, Join Order Benchmark, and TPC-H.

Installation

SparseApplicationBenchmark uses pixi for its environments. To install the project with its data generation and test/development dependencies:

pixi install

pixi.toml defines the environments:

  • default: the generate and test features. generate pins every package, including indirect dependencies, to an exact version. Dataset freshness hashes include installed dependency versions, so bin/generate_metadata.py, bin/run_benchmark.py --cache-datasets, and --trace-statistics refuse to run unless the installed versions match these pins. test adds test and lint tools.
  • cupy, finch, galley, pytorch: one framework each, for the frameworks the default environment doesn't install (see CONTRIBUTING.md).

The package's own dependencies in pyproject.toml keep compatible version ranges, for installing saps elsewhere (each competition environment does). pixi run installs or updates an environment before running a command, so packages that drifted from pixi.toml are put back.

Most commands below assume they are run from the repository root.

Running Benchmarks

The main entry point is bin/run_benchmark.py. By default it builds an ASV benchmark matrix using the built-in framework wrappers in frameworks/:

pixi run ./bin/run_benchmark.py

Useful runner options:

  • --tag suite-test: run datasets tagged for CI-sized correctness/performance checks.
  • --tag suite-standard: run canonical suite datasets.
  • --re REGEX: include benchmark, generator, or dataset names matching a regex.
  • --no-re REGEX: exclude matching benchmark, generator, or dataset names.
  • --metrics time peakmem: collect one or both metrics.
  • --quick: run each selected benchmark once.
  • --rounds 1: use one timing round, retaining repeated measurements within it.
  • --measurement-timeout 60: allow 60 seconds total for warmup and measurements, excluding setup and correctness checks.
  • --process-timeout 180: give the ASV worker 180 seconds for setup, warmup, measurements, and teardown/checks.
  • --chunk-count N --chunk-index I: split the selected parameter cases across multiple processes and isolate transient output under chunk-I directories.

For example:

pixi run ./bin/run_benchmark.py --tag suite-test --quick --process-timeout 30
pixi run ./bin/run_benchmark.py --tag suite-standard --metrics time peakmem
pixi run ./bin/run_benchmark.py --re bfs --no-re toy

Runner outputs are written under .saps/outputs/, including ASV result files and cached datasets.

Measuring Structural Fill-In

Bound how many Boolean squarings each prepared GAP and SNAP matrix can take before it reaches 1% density:

pixi run python scripts/measure_fill_in.py --output .saps/outputs/fill-in.json

The script bounds the fill-in of I OR (A != 0) under repeated squaring, preserving edge direction; after s squarings it covers paths of up to 2**s edges. It makes one streaming pass over each matrix to count every row's off-diagonal nonzeros, then derives the bounds from those degrees. It never forms a squared matrix or traverses the graph. With maximum degree d, at most 1 + d + ... + d**k vertices lie within k edges of any vertex. A row with k0 nonzeros therefore has at most 1 + k0 * (1 + d + ... + d**(h - 1)) nonzeros in the h-th power, capped at n. Summing these row bounds bounds the nonzero count, density, and growth factor relative to I OR (A != 0).

The JSON leads with steps, one entry per matrix. squarings is the fewest squarings whose density bound reaches --target-density (default 0.01), and every earlier squaring is guaranteed to stay below that density. These are worst-case bounds for the given degrees, so a matrix usually stays sparse longer than its step count. Power-law graphs give especially loose bounds, because a single high-degree row dominates d. When the bound stops growing below the target, squarings is null and stop_reason is never: the matrix provably never reaches that density. The same list is printed at the end of the run, followed by a dictionary mapping each measured matrix to its maximum off-diagonal degree.

--datasets takes matrix names such as GAP/GAP-road or whole SuiteSparse groups such as SNAP; the default is GAP SNAP, and --list-datasets prints the selection. Prepared inputs must be row-ordered COO Binsparse files whose columns are sorted within each row, in the shared cache. Use --cache-dir PATH and --manifest PATH to select another prepared cache. Missing datasets are reported without downloading them, and missing or invalid inputs give a nonzero exit code. Reported CSR storage bounds assume one-byte Boolean values and 64-bit indices and exclude temporary workspaces.

Run the measurement on Slurm with one array task per GAP and SNAP matrix:

sbatch scripts/measure-fill-in.slurm

Each task requests one CPU, 16 GB of memory, and a one-hour wall time. The job uses the existing pixi environment and prepared shared cache; SAPS_CACHE_DIR and SAPS_MANIFEST_PATH select alternate inputs. Task indices follow scripts/measure_fill_in.py --list-datasets; the array covers the 73 GAP and SNAP manifest entries, so update --array if that count changes. Results go to .saps/outputs/fill-in/run_<array-job-id>/<group>/<name>.json, and logs go to fill-in-<array-job-id>_<task-index>.log in the submission directory. Set SAPS_FILL_IN_OUTPUT_DIR to change the output directory. Options after the script name, such as --target-density 0.05, are passed to every task.

Combine the per-task results into one step list once the array finishes:

pixi run python scripts/measure_fill_in.py \
  --merge .saps/outputs/fill-in/run_<array-job-id>/*/*.json \
  --output .saps/outputs/fill-in/run_<array-job-id>.json

To extract the recorded step counts from a combined log instead:

python3 scripts/extract_fill_steps.py scripts/fill-log

This prints one tab-separated matrix and steps pair per line, sorted by matrix name. It defaults to scripts/fill-log, accepts multiple log paths, and removes duplicate results. Counts retain the density-bound meaning above; never means the bound stays below the target, and - marks missing or failed measurements.

Scraping Solver Matrices

scripts/scrape_matrices.py finds SuiteSparse matrices for the solver benchmarks (jacobi, cg, jacobi_cg, block_jacobi_cg, lsqr, gmres, and amg) by running each solver on them with the SciPy framework and recording whether it converges. Each output line is a JSON record for one matrix and right-hand side, with one result per solver: converged, did not converge, errored, or skipped because the solver does not accept the matrix. LSQR only takes least-squares problems, AMG only takes symmetric positive definite 2D/3D discretizations, and the other solvers take square matrices of most kinds. Convergence uses rel_tol=1e-6 and max_iter=100, or max_iter=1000 for Jacobi and LSQR.

Try a few matrices locally with --solver, --matrix group/name, --matrix-kind, or --max-nnz:

pixi run python scripts/scrape_matrices.py --solver amg --max-nnz 1000000 \
  --output amg.jsonl

Matrices and the ssgetpy index come from $SAPS_CACHE_DIR/suitesparse; pass --data-dir ~/.ssgetpy/MM to use matrices ssgetpy already downloaded. Set SAPS_FRAMEWORK to run the solvers on another framework. Records already in the output file are skipped unless --force is set.

Scrape the whole collection on Slurm, divided across the array tasks:

sbatch scripts/scrape-matrices.slurm --solver amg

Each task requests 16 CPUs, 128 GB of memory, and a 24-hour wall time. Options after the script name pass to every task. Results go to .saps/outputs/scrape-matrices/run_<array-job-id>/results-<task-index>.jsonl, and logs go to scrape-matrices-<array-job-id>_<task-index>.log in the submission directory. Set SAPS_SCRAPE_OUTPUT_DIR to change the output directory, and SAPS_SCRAPE_CHUNK_COUNT to keep the original chunking when rerunning part of an array.

Print dataset constructors for the matrices each solver converged on, to paste into the solver's SuiteSparse generator:

pixi run python scripts/jsonl_to_saps_datasets.py \
  .saps/outputs/scrape-matrices/run_<array-job-id>/*.jsonl

Competition Runs

Use competition.config.json to define the frameworks included in a competition run. It uses ASV-native include entries so every framework can pin a different set of dependencies:

pixi run ./bin/run_benchmark.py \
  --config competition.config.json \
  --metrics time peakmem

On Slurm, submit a competition with the launcher. It submits two arrays that share one run directory: scripts/competition-cpu.slurm runs the CPU frameworks on CPU nodes and scripts/competition-gpu.slurm runs the GPU frameworks on GPU nodes (a whole V100 node, --gres=gpu:V100:2 --exclusive). A final job combines both arrays' results. Both wrappers source the shared body in scripts/competition.sh, which first runs scripts/ensure-pixi-env.sh so each task's pixi environment matches pixi.toml, installing pixi itself into ~/.pixi/bin if needed (set SAPS_ENSURE_PIXI_ENV to a replacement script to skip it).

scripts/submit-competition.sh
# Training set, as smaller arrays:
SAPS_CHUNK_COUNT=8 SAPS_GPU_CHUNK_COUNT=4 scripts/submit-competition.sh --tag suite-train

Arguments other than --resume and --after go to bin/run_benchmark.py in both arrays, so --tag, --no-tag, --re, and --no-re override the config's dataset selection. SAPS_COMPETITION_ARGS="--metrics time peakmem" still adds runner arguments as well.

A framework needs a GPU when its include entry in competition.config.json sets "SAPS_DEVICE": "gpu" in env_nobuild; entries without it run on CPU. Every include entry must also set a unique SAPS_FRAMEWORK_NAME in env_nobuild, which names the framework in the combined results. The launcher refuses a config with a missing or duplicate name, and the combiner rejects result files without one. A framework can run on both devices by appearing twice, once with and once without SAPS_DEVICE, as PyTorch does with the names pytorch and pytorch-gpu. Each array passes --device cpu or --device gpu to the runner, which only builds the matching environments. The launcher skips the GPU array when no framework needs a GPU. The GPU array runs on V100s (gpu-v100 on PACE Phoenix), not A100s, where competition jobs die. V100s are compute capability 7.0, which CUDA 13 no longer targets, so GPU frameworks need CUDA 12 builds: the GPU wrapper sets PIP_EXTRA_INDEX_URL to PyTorch's cu126 index, whose torch==2.12.1+cu126 pip prefers over PyPI's CUDA 13 build.

Slurm stdout and stderr logs go to the directory where you submit the job: competition-cpu-%A_%a.log, competition-gpu-%A_%a.log, competition-combine-%j.log, upload-%A_%a.log, trace-%A_%a.log, or finalize-metadata-%j.log. The refresh launcher (scripts/submit-refresh-jobs.sh) also preserves the directory where you invoked it for all three (or four, with --with-competition) jobs' logs. You can submit the Slurm scripts from the repository root or any subdirectory.

The refresh launcher uploads datasets in one pass on the cpu-large partition, as an eight-task array with 24 CPUs and 720G per task for up to three days. Each dataset process is capped at 680G, so an oversized dataset fails with MemoryError instead of getting the task killed and skipping the rest of its chunk. Override the defaults with SAPS_UPLOAD_CHUNK_COUNT, SAPS_UPLOAD_CPUS, SAPS_UPLOAD_MEMORY, and SAPS_UPLOAD_MEMORY_LIMIT. Tracing waits for every upload task to succeed.

--cache-datasets skips the standard-long suite, whose datasets take hours each to prepare. Cache them by selecting the suite explicitly, with a longer --process-timeout:

pixi run ./bin/run_benchmark.py --cache-datasets --tag suite-standard-long --process-timeout 28800

Uploads use the dataset-upload AWS profile, which must hold long-lived access keys with write access to the bucket. Uploads run for days, longer than any SSO session lasts, so the launcher refuses an SSO profile and temporary keys with an aws_session_token, such as those copied from the AWS access portal. Create IAM user access keys (IDs starting with AKIA). It prompts for keys if the profile has none, and checks them before submitting. Keep the keys readable only by you:

aws configure --profile dataset-upload
chmod 700 ~/.aws
chmod 600 ~/.aws/credentials ~/.aws/config

Pass --with-competition to scripts/submit-refresh-jobs.sh to also submit a competition run once the upload/trace/merge chain finishes successfully (scripts/submit-competition.sh --after <merge job>), instead of submitting it separately:

scripts/submit-refresh-jobs.sh --with-competition

The competition scripts email ahrens@gatech.edu when the array finishes or fails. Notifications cover the whole array. Override the recipient at submission with sbatch --mail-user=you@example.com scripts/competition-cpu.slurm, or edit the #SBATCH --mail-user line in both wrappers.

Normal timing runs exit successfully after saving results even when individual benchmarks fail or time out; their failures remain in the saved diagnostics and the printed failure count. Harness errors such as environment installation or result-writing failures still produce a nonzero exit status. Correctness-check, dataset-caching, and tracing modes retain their stricter exit behavior.

The competition config selects the standard datasets and uses one timing round per benchmark, with ASV's normal repeated measurements. The launcher submits a 128-task CPU array and a 32-task GPU array, so it holds fewer GPU nodes, with a twelve-hour time limit per task (set SAPS_CHUNK_COUNT and SAPS_GPU_CHUNK_COUNT to change the sizes). Each task runs a deterministic set of the selected datasets. All competition outputs live in the run directory, named after the CPU array's job ID. GPU tasks write to task_gpu_<index>/:

competition/run_<cpu-array-job-id>/
  task_0/
    results/       # ASV measurements and saved diagnostics
    machine_files/
    outputs/       # task-specific reports
  task_1/
  ...
  task_gpu_0/
  ...
  results.json     # combined measurements from all tasks and frameworks
  machines.json   # machine descriptions, indexed by ID

Slurm benchmark environments and pip/virtualenv caches live under $TMPDIR/saps-competition-<job-id>-<task-index>/ on the assigned node. The wrapper requests 50 GB of local temporary disk per node with --tmp=50G. These files are removed by Slurm when the job ends and rebuilt when resuming; saved results stay in the run directory. This avoids filling the shared scratch file-count quota with separate Python installations for every task. The existing pixi environment is still used to launch the runner.

Older runs may still have task_*/env directories on shared storage. Delete those environment directories only after their jobs have stopped; retain the result directories for resume. Updating the wrapper affects newly submitted jobs.

Dataset inputs use the repository's shared .saps/outputs/cache, across runs, tasks, frameworks, uploads, and statistics tracing. Nodes using the same shared checkout reuse the same cache. Set SAPS_CACHE_DIR before launching the runner to use a different shared directory; it is independent of --saps-dir and chunk selection. Cache files are named by content hash, and downloads are verified before being published atomically. Concurrent requests for the same cache file wait on a file lock and reuse the first completed download; different datasets can download in parallel.

Benchmark runs use the manifest's recorded digest without comparing source paths or freshness hashes against the benchmark environment. Freshness is checked by the dataset refresh/upload workflow. Downloaded files still have their checksums verified before entering the shared cache. Missing manifest entries or unavailable prepared data fail setup with an instruction to run --cache-datasets; normal runs never regenerate cacheable inputs or write manifest metadata.

Prune unused manifest entries using metadata.json as the source of truth:

pixi run ./bin/prune_manifest.py --dry-run
pixi run ./bin/prune_manifest.py

The script removes entries absent from metadata or belonging only to generators with cacheable: false, preserving retained records regardless of freshness. Regenerate metadata first if benchmark definitions have changed. Use --metadata and --manifest for alternate files; the manifest also honors SAPS_MANIFEST_PATH. Pruning does not delete local cache files or remote objects.

When a source change leaves generated data unchanged, or a source can no longer be downloaded, mark the existing uploads as current instead of regenerating them. Select datasets with --tag, --no-tag, --re, and --no-re, as for run_benchmark.py:

pixi run ./bin/generate_metadata.py
pixi run ./bin/mark_fresh.py --re '^suitesparse_matrix$' --dry-run
pixi run ./bin/mark_fresh.py --re '^suitesparse_matrix$'

Only entries that already have an uploaded digest for the same source file are marked. Entries that were never cached are listed and left for --cache-datasets.

The same selection also restamps trace records in statistics.json (or --statistics), including those for uncached generators, so their statistics tags survive the source change. Fold them back into metadata afterwards:

pixi run ./bin/generate_metadata.py --statistics statistics.json

Generators marked cacheable = False still assemble benchmark inputs during setup from their shared source datasets. Those transformations must preserve sparsity and use prepared data. The G-CARE downloader reads graph matrices, queries, and ground-truth counts. The shell generator wraps its returned arrays and metadata in a DataInstance for the storage backend to cache. The regular subgraph generator assembles each query from that cached input without calling the downloader or reading source files. Older G-CARE caches need a one-time refresh from the repository root:

pixi run ./bin/run_benchmark.py --cache-datasets --re '^gcare_graph$'

Run this in the dataset-upload environment with its configured storage backend. The shell places G-CARE source files under the storage backend's cache directory in gcare/.

SuiteSparse source downloads used during cache preparation also share this cache, under suitesparse/<group>/<name>. A lock and atomic publication let workers reuse one completed source download across its RHS selections. The suitesparse_matrix_shell cache stores each matrix with all compatible RHS vectors once. Uncached solver generators select individual RHS columns after fetching that shared entry. Older caches that stored one entry per RHS need a one-time refresh in the dataset-upload environment:

pixi run ./bin/generate_metadata.py
pixi run ./bin/run_benchmark.py --cache-datasets --re '^suitesparse_matrix_shell$'

SNAP graphs are prepared by suitesparse_matrix_shell and stored once under suitesparse_matrix/SNAP/<name>/<digest>.bsp.h5. BFS, Bellman-Ford, centrality, connected components, FastSV, PageRank, transitive closure/reduction, triangle counting, and four-clique counting reuse those graphs. The uncached snap_graph generator reads these prepared SuiteSparse inputs and returns only the matrix, preserving its values and dimensions. Bellman-Ford derives its sparse distance representation during setup. Source archives share the suitesparse/SNAP/ cache.

The GAP and SNAP algorithm generators compute references during setup and store them in DataInstance.ref_outputs and ref_meta. Checks only compare those stored results; reference computation is outside the timed benchmark and the existing dataset serialization preserves it for future caching. Consumer generators remain uncached for now, so setup recomputes these references.

igraph supplies BFS/shortest-path distances, weak connected components (also used to check FastSV), betweenness centrality, and PageRank. The calls live in the generators. BC uses the same four sources per GAP/SNAP trial, including repeats, source dependencies, and maximum-score normalization. PageRank reverses the edges to match the benchmark's column-source convention; checks allow the L1 error bound from its stopping tolerance or finite iteration budget. FastSV inputs are symmetrized and stripped of self-loops to compute weak components. MCL and weighted two-hop transitive reduction retain their SciPy references; these computations do not have equivalent igraph routines. Unit-edge GAP/SNAP inputs use boolean storage wherever the kernel supports it, including BC, PageRank, and MCL; numeric work arrays are created as needed.

Bounded transitive closure and Floyd–Warshall references respect the generator's max_squarings hop limit and generate the complete result for every graph. Closure uses boolean sparse matrices; unit-weight shortest paths also use boolean frontiers, recording the first hop that reaches each pair. Weighted shortest paths retain numeric distances. Generation and checking preserve sparse storage and compare every entry. BFS checks hop-distance levels, which are deterministic even when different parent trees are valid. Single- and multi-source searches check all requested sources. Existing hand-checked fixtures, exact clique counts, and subgraph-matching ground truth remain in use.

Triangle and four-clique reference counts use simple undirected graphs: ignore edge weights and directions, merge duplicate edges, remove self-loops, and store only the strict upper triangle. Each clique is counted once. Prefer the published GraphMiner triangle table and clique table where the input graphs match:

SAPS dataset GraphMiner row Reference counts
soc-LiveJournal1 livej Triangles and four-cliques
com-Orkut com-Orkut Triangles and four-cliques
cit-Patents cit-Patents Triangles and four-cliques
com-Friendster friendster Triangles and four-cliques
twitter7 twitter40 Triangles and four-cliques
GAP-twitter twitter40 Triangles

SuiteSparse documents the equivalence of GAP-twitter and twitter7 after removing self-loops and weights and disregarding isolated vertices. GraphMiner's youtube, patent_citations, and uk2007 are different graphs from com-Youtube, cit-Patents, and GAP-web; their counts cannot be substituted. Likewise, livej matches soc-LiveJournal1, not com-LiveJournal. For the other datasets, triangle references come from the SNAP dataset pages, LAGraph's GAP counts, or local computation as marked in triangle_counting.py. The remaining four-clique references are locally computed with scripts/compute_graph_counts.py using the benchmark generators. They are not published GraphMiner totals.

Each dataset descriptor carries its integer expected count. Generators use int64 adjacency values and reference scalars; correctness checks require an integer scalar exactly equal to the reference, with no floating-point tolerance.

Regenerate metadata and prepare the SuiteSparse cache before running these consumers with the SuiteSparse sources:

pixi run ./bin/generate_metadata.py
pixi run ./bin/run_benchmark.py --cache-datasets --re '^suitesparse_matrix_shell$'

The 68 SuiteSparse SNAP sources are explicitly listed in src/saps/benchmarks/snap.py and the shared inventory in src/saps/benchmarks/suitesparse.py. Add new sources to both inventories, then regenerate metadata and prepare the SuiteSparse cache. Entries without SuiteSparse matrices remain commented out with their original metadata and are not exposed by SNAP generators.

The OpenML shell caches the feature matrix together with train/test row indices from a pinned task, repeat, fold, and sample. MNIST uses task 3573 and Fashion-MNIST uses task 146825, both at repeat 0, fold 0, sample 0. ANN generators consume these splits; clustering generators can still consume the complete feature matrix. Refresh old OpenML caches that contain only the feature matrix with:

pixi run ./bin/run_benchmark.py --cache-datasets --re '^openml_dataset$'

All source downloaders honor SAPS_CACHE_DIR (default .saps/outputs/cache) and lock the cache check, download, and extraction so concurrent jobs reuse completed files. Source subdirectories are suitesparse, frostt, gcare, nemo, ewap, slicot, mccomp, qasmbench, ogb, and kaggle; LTH model files use artifacts/lth. An explicit downloader data_dir takes precedence. These source caches persist independently of job-local environments and $TMPDIR. G-CARE records completed extraction so later loads reuse the extracted files. So do the Model Counting Competition 2020-2024 archives under mccomp/zenodo. --cache-datasets downloads the eight that the listed instances come from, about 2 GB, or 4 GB on disk once unpacked; scripts/scan_mccomp_pool.py, which lists the instances, reads all 20.

Each finishing task refreshes the combined files with the results saved so far. To rebuild the highest-numbered Slurm run, run from the repository root:

pixi run ./scripts/combine_competition_results.py

The script also works from scripts/ as pixi run ./combine_competition_results.py. To select an earlier run explicitly:

pixi run ./scripts/combine_competition_results.py \
  --run-directory competition/run_12345

The combined JSON follows metadata.json's benchmarks → generators → datasets → results hierarchy. Dataset names are matched using metadata's asv_ids and asv_param values, rather than parameter positions. Each result contains a metric, value, status, statistics, samples, and references to its framework, machine, source file, and diagnostics. Framework definitions, source information (including commit and environment), and diagnostics appear once in top-level tables. Machine references resolve through machines.json. Source file paths are relative to run_directory. Use --metadata PATH to combine against a different metadata file.

Diagnostics retain ASV's errcode, stderr, parameter names, start time, and duration. ASV reports these per benchmark invocation, potentially covering multiple datasets; those results share a diagnostic reference. Resume preserves the diagnostics and machine attribution for retained measurements. Older ASV files can still be combined, but their missing diagnostics cannot be recovered; the machine listing uses whatever machine identity those files recorded. Unselected parameters are omitted. Recorded skips have status: "skipped"; nonfinite results have status: "failed" with reason: "nonfinite". Non-finite values become JSON null rather than nonstandard NaN literals.

The runner saves each dataset's status in saps.runs[].parameter_statuses; the combined results expose the status and phase directly:

  • ok: a finite result with no reported failure.
  • skipped: the framework or benchmark skipped this dataset.
  • failed: an exception, failed correctness check, or nonfinite result.
  • measurement_timeout: warmup and measurements exceeded measurement_timeout, or the ASV process timed out during the measurement phase.
  • setup_timeout: the ASV process timed out before measurements started.
  • teardown_timeout: the ASV process timed out during checks, cleanup, or result finalization.

measurement_timeout covers warmup and measurements together, not each call. Timing starts at the end of setup and stops at the beginning of teardown. ASV can repeat setup/teardown between samples, so elapsed measurement time accumulates across those intervals within each worker. Setup and correctness checks do not count against it. There is no extra clock read or timeout wrapper around run. Normal ASV timing includes warmup and at least one subsequent measured call; --quick and peak-memory runs retain ASV's single-call behavior.

When teardown detects an overrun, it skips correctness checks, cleans up, and raises MeasurementTimeout, preserving the measurement_timeout result status. A call that never returns is stopped by ASV's process_timeout. Timeout records include timeout_source (measurement or process); measurement overruns also record elapsed_seconds and timeout_seconds.

Both limits can be set independently in the CLI or config. Defaults are 60 seconds for measurement and 180 seconds per worker (5000 for dataset caching); checks do not automatically double the process allowance. Measurement limits are disabled for caching and statistics tracing. To give setup or checks more time, increase --process-timeout while keeping --measurement-timeout unchanged.

Direct runs using competition.config.json write beneath competition/run_local/task_0/; combine those with --run-directory competition/run_local.

Competition runs filter out dataset/metric entries that already have saved results for each environment. To continue a Slurm run, submit the same array shape and configuration with its existing run directory:

SAPS_CHUNK_COUNT=128 SAPS_GPU_CHUNK_COUNT=32 scripts/submit-competition.sh --resume competition/run_12345
# Or rerun part of one array; SAPS_CHUNK_COUNT keeps the original chunking:
SAPS_CHUNK_COUNT=128 sbatch --array=19-23 scripts/competition-cpu.slurm \
  --resume competition/run_12345
# SAPS_GPU_CHUNK_COUNT does the same for the GPU array:
SAPS_GPU_CHUNK_COUNT=32 sbatch --array=3 scripts/competition-gpu.slurm \
  --resume competition/run_12345

Only missing or null results run again. Results are saved after each environment; work interrupted before it was saved runs again. New jobs use their own submission-directory logs while continuing results in the original run directory. For direct runner use, pass --resume with the same --results-dir and --machine. The competition config enables this automatically. Results from another commit, environment, or benchmark version are not reused.

Configuration

The runner auto-detects saps.conf.json in the current directory, or you can pass one explicitly:

pixi run ./bin/run_benchmark.py --config path/to/saps.conf.json

The config file can set runner options and supported ASV environment fields. A small config for running only one framework in the current environment looks like:

{
  "environment_type": "existing:same",
  "matrix": {
    "env_nobuild": {
      "SAPS_FRAMEWORK": ["frameworks/saps_numpy.py"],
      "SAPS_REPO_ROOT": ["."]
    }
  }
}

If no config is supplied, the runner uses a default matrix with the built-in NumPy, SciPy, and pydata/sparse wrappers.

SAPS Config Overview

saps.conf.json is not a complete ASV config file. It is a small SAPS runner config that is translated into an in-memory ASV config by bin/run_benchmark.py. SAPS fills in benchmark-suite details such as the project name, repository path, benchmark directory, HTML output directory, dataset cache, manifest path, and remote storage defaults.

Every bin/run_benchmark.py CLI option except --config can also be supplied in config by using its argparse destination name. In practice, replace hyphens with underscores: remote_storage_backend for --remote-storage-backend, cache_datasets for --cache-datasets, chunk_count for --chunk-count, and metrics for --metrics. CLI values always take precedence over config values.

The ASV fields SAPS supports directly are:

  • environment_type: ASV environment type for normal benchmark runs. The default is "virtualenv". Use "existing:same" to run in the current pixi environment, which is often easiest while developing a framework wrapper. Tracing and dataset caching always use the current environment; metadata generation runs directly in the environment used to invoke bin/generate_metadata.py.
  • install_command: ASV install command list. The default reinstalls the project into each ASV environment with python -mpip install {build_dir} --force-reinstall.
  • pythons: Python versions ASV should use when constructing environments.
  • saps_dir: Directory where SAPS writes runner-owned outputs such as machine files and HTML. The SAPS default is .saps; dataset inputs use a shared cache independently of this setting.
  • env_dir: Directory where ASV creates benchmark environments. The SAPS default is .saps/results.
  • results_dir: Directory where ASV writes benchmark results. The SAPS default is .saps/outputs/results.
  • matrix: ASV environment matrix. This is the main field most users customize.
  • include: ASV explicit environment list. Use this when each environment needs its own dependency set, such as competition runs.
  • exclude: ASV matrix exclusion rules.

The matrix field has two common sections:

  • req: Python package version requirements. ASV builds environments for the Cartesian product of these versions. For example, "numpy": ["2.3"] pins NumPy to that version in generated environments.
  • env_nobuild: Environment variables that do not require rebuilding the package. Values are lists because ASV treats them as matrix entries.

The include field is useful when matrix would create unwanted combinations. Each include entry describes one explicit environment. Unlike matrix, values inside include.req, include.env, and include.env_nobuild are scalars, not lists:

{
  "matrix": {},
  "exclude": [{"env_nobuild": {"SAPS_FRAMEWORK": null}}],
  "include": [
    {
      "python": "3.12",
      "req": {"numpy": "2.3", "scipy": "1.17.1"},
      "env_nobuild": {"SAPS_FRAMEWORK": "frameworks/saps_scipy.py"}
    }
  ]
}

The empty matrix plus exclude rule prevents ASV from also running its base environment. See the ASV config reference for the full upstream meaning of matrix, include, and exclude.

Important env_nobuild entries:

  • SAPS_FRAMEWORK: One or more framework wrapper files to benchmark. Relative paths are converted to absolute paths from the current working directory before child processes run.
  • SAPS_REPO_ROOT: Repository root used by freshness discovery in child processes. Use the repository root path, or "." when running from the repository root.

The runner owns these values and normally you should not set them in saps.conf.json:

  • REMOTE_STORAGE_BACKEND and REMOTE_STORAGE_BUCKET: set from remote_storage_backend / remote_storage_bucket, CLI flags, or built-in defaults.
  • SAPS_CACHE_DIR: uses the existing environment value, or defaults to .saps/outputs/cache under the repository root. Passed to workers as an absolute path shared across runs and tasks.
  • SAPS_MANIFEST_PATH: set to the repository manifest.json.
  • SAPS_TAGGER_STATS_DIR and SAPS_STATISTICS_PATH: set during --trace-statistics.
  • ASV project, repo, branches, benchmark_dir, and html_dir: derived from the repository and .saps/outputs.

Custom Frameworks

To benchmark your own sparse framework, create a Python file that defines an xp variable. xp must be an instance of a saps_framework.Framework subclass. The runner loads framework wrappers from the SAPS_FRAMEWORK entries in the ASV matrix, so custom frameworks should usually be supplied through saps.conf.json:

{
  "environment_type": "existing:same",
  "matrix": {
    "env_nobuild": {
      "SAPS_FRAMEWORK": ["/path/to/my_framework.py"],
      "SAPS_REPO_ROOT": ["."]
    }
  }
}

Then run:

pixi run ./bin/run_benchmark.py --config saps.conf.json --tag suite-test --quick

A framework wrapper is responsible for:

  • from_binsparse(array): convert SAPS BinsparseFormat inputs into framework arrays.
  • to_binsparse(array): convert framework outputs back into BinsparseFormat.
  • compute(array) and lazy(array): force or preserve evaluation as appropriate for the framework.
  • replace(arr, old, new): return an array with matching values replaced, including implicit sparse values; NaN matches NaN. Leave the input unchanged.
  • einsum(...) and Array API operations used by benchmarks.
  • __getattr__: commonly used to forward Array API calls to the wrapped module.

See frameworks/saps_numpy.py, frameworks/saps_scipy.py, and frameworks/saps_sparse.py for reference wrappers. Benchmark functions receive this wrapper as their first argument, conventionally named xp.

Testing

Run the full test suite with:

pixi run pytest

Every benchmark run checks its output for correctness in teardown, after each timing sample, unless the measurement budget was exceeded.

CP-ALS and HOSVD checks use exact, parallel Numba loops to compute ||X - Y||² = ||X||² + ||Y||² - 2<X,Y> without expanding the reconstructed tensor or unfolding the input. The sparse cross term streams stored entries once, evaluating CP components or nested Tucker scalar reductions at each coordinate. The arithmetic lives directly in compiled loops in the benchmark modules, with prange over stored entries. There is no batching, nnz-sized cross-term workspace, or per-worker core buffer. Small Gram/core loops account for the model's implicit-zero error. Kernels are cached after compilation; NUMBA_NUM_THREADS controls the worker count. FROSTT's input squared norm is computed once in the shared raw-data generator and cached for both benchmarks. Duplicate coordinates are coalesced for that norm; subsequent checks can stream the original coordinates without sorting.

Checks accumulate in float64 without fast-math or compensated summation, and use the shared Higham summation bounds to allow cancellation in nearly exact reconstructions. This roundoff allowance is bounded using Cauchy-Schwarz to avoid a second sparse cross-term contraction and is separate from approximation tolerance: synthetic CP cases retain a 0.1 relative residual limit and synthetic Tucker cases retain 1e-5. Real FROSTT cases require valid shapes, finite values, and a nonzero model with relative residual at most 1 (unless the input is zero). This is an approximation sanity check, not a proof of global optimality. Exact checks still require a pass over the nonzeros; sampling would change the guarantee to a probabilistic one.

For a quick runner smoke test over CI-sized datasets:

pixi run ./bin/run_benchmark.py \
  --tag suite-test \
  --metrics time \
  --quick \
  --process-timeout 30

Freshness tests check that generated artifacts still match the source code and metadata in the repository:

  • metadata.json matches benchmark, generator, and dataset metadata.
  • statistics.json contains current trace-derived tags for datasets selected by the suite-trace tag.
  • manifest.json records current dataset freshness.
  • Every concrete generator is reachable through a benchmark, including shell benchmarks for intentionally standalone generators.
  • Every manifest record points to a dataset object that exists in the configured remote storage backend.

Freshness tests are marked with freshness and are skipped by default. Run them with pixi run pytest -m freshness tests/test_freshness.py.

When freshness tests fail after a benchmark, generator, dependency, or storage change, regenerate the affected artifacts rather than editing hashes by hand.

Datasets And Storage

Datasets are generated by Generator classes and cached through the configured storage backend. The default remote backend is:

REMOTE_STORAGE_BACKEND=s3
REMOTE_STORAGE_BUCKET=sparse-array-programming-suite

Public reads should not require AWS credentials. Uploads to S3 do require credentials with write access:

AWS_ACCESS_KEY_ID=... \
AWS_SECRET_ACCESS_KEY=... \
AWS_DEFAULT_REGION=us-east-1 \
  pixi run ./bin/run_benchmark.py --cache-datasets

If you use temporary credentials, also set AWS_SESSION_TOKEN. If you use long-lived IAM keys, leave AWS_SESSION_TOKEN unset.

For local-only testing of dataset caching:

pixi run ./bin/run_benchmark.py \
  --cache-datasets \
  --remote-storage-backend local \
  --remote-storage-bucket /tmp/saps-remote-storage

Metadata And Tracing

Regenerate benchmark metadata after changing benchmark, generator, or dataset metadata:

pixi run ./bin/generate_metadata.py

Trace statistics are generated by running selected benchmarks with the tagger framework:

pixi run ./bin/run_benchmark.py \
  --trace-statistics \
  --tag suite-trace \
  --process-timeout 30 \
  --show-stderr

Datasets get traced when their generated metadata has the suite-trace tag. Tracing executes the benchmark with frameworks/saps_tagger.py, records which array operations and sparsity-relevant behaviors were observed, and writes those derived tags with a feature- prefix to statistics.json. Fold fresh trace-derived tags into metadata.json with:

pixi run ./bin/generate_metadata.py --statistics statistics.json

Dataset caching and statistics tracing append diagnostics to .saps/outputs/results/diagnostics.log.

Contributing Benchmarks

If you want to add a benchmark or generator, start with CONTRIBUTING.md. It describes how to claim a benchmark, what counts as a benchmark function, what metadata and correctness evidence are required, how freshness works, how to choose dataset tags, and how the generative AI disclosure policy applies.

About

A benchmark suite of sparse array programming applications

Resources

Contributing

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages