Skip to content

[test]: Marker-based suites + ctest + ccc-gpu-bench CLI (restructure-tests + extract-benchmarks) - #36

Merged
haoyu-zc merged 3 commits into
refacotring-07-16-2026from
pr-d-tests-benchmarks
Jul 17, 2026
Merged

[test]: Marker-based suites + ctest + ccc-gpu-bench CLI (restructure-tests + extract-benchmarks)#36
haoyu-zc merged 3 commits into
refacotring-07-16-2026from
pr-d-tests-benchmarks

Conversation

@haoyu-zc

@haoyu-zc haoyu-zc commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Implements restructure-tests (proposal 4) + extract-benchmarks (proposal 5). Two commits.

restructure-tests

  • Markers gpu/slow/network + --strict-markers; tests/gpu/conftest.py auto-marks the GPU dir and skips cleanly when cupy/ext are missing; research-module tests (test_giant/methods/plots/corr) now guard with pytest.importorskip("ccc.<mod>") so bare pytest tests/ is green on a CPU-only box (no --ignore needed).
  • De-benchmarked the parity tests (removed the duplicated timing/logging/log-file machinery; kept assert_frame_equal at 1e-6); n_jobs tests became determinism checks; deleted pure-timing benchmark tests (intent → ccc-gpu-bench).
  • CUDA gtests wired into ctest behind option(CCC_BUILD_TESTS OFF); googletest FetchContent gated inside it so default/wheel builds fetch only spdlog. ctest → 8 passed, 2 skipped (oversized reference cases).
  • Closed GPU coverage gaps (all pass after the correctness PR): categorical return_parts, constant-feature matrix, too-few-objects error parity, mixed-type DataFrame.

extract-benchmarks

  • New ccc-gpu-bench / python -m ccc.bench: modes coef/ari/scaling, JSONL/CSV incremental output with full env metadata + seed + warmup-excluded timings, presets smoke/paper, --profile (CPU cProfile categories + nsys hint). Stdlib-only; graceful without a GPU.

Testing (ccc-gpu-dev, RTX 4090)

  • CPU subset -m "not gpu and not slow and not network"139 passed, 4 skipped. GPU -m gpu79 passed. Full suite 224 passed (216 − 3 removed benchmark tests + 11 new).
  • ctest -DCCC_BUILD_TESTS=ON → 8 passed, 2 skipped; default configure fetches only spdlog.
  • ccc-gpu-bench coef --preset smoke writes valid JSONL (10–39× speedups). ruff + clang-format clean.
  • CI GitHub Actions not executed locally (correct-by-construction).

Haoyu Zhang and others added 3 commits July 16, 2026 18:36
…ture-tests)

OpenSpec change: restructure-tests.

- Markers gpu/slow/network registered with --strict-markers; tests/gpu/conftest.py
  auto-marks the GPU dir and skips cleanly when cupy/ccc_cuda_ext are absent, so
  `pytest tests/ -m "not gpu"` passes on a CPU-only box. tests/conftest.py holds
  shared fixtures; clean_gpu_memory is now an autouse fixture.
- De-benchmarked the parity tests: removed the duplicated timing/logging/log-file
  machinery from test_ccc_gpu.py and test_ccc_gpu_return_parts.py (kept the
  assert_frame_equal parity at 1e-6), removed wall-clock speedup assertions from
  the n_jobs tests (now determinism checks), deleted the pure-timing benchmark
  tests (their intent moves to ccc-gpu-bench).
- CUDA gtests wired into ctest behind option(CCC_BUILD_TESTS OFF); googletest
  FetchContent gated inside the option so default/wheel builds do not fetch it;
  registered via gtest_discover_tests. Two oversized reference cases GTEST_SKIP.
- Closed GPU coverage gaps (all pass after the fix-cuda-correctness fixes):
  categorical return_parts parity, constant-feature matrix, too-few-objects error
  parity, mixed numerical+categorical DataFrame (tests/gpu/test_coverage_gaps.py).
- Updated scripts/run_tests.sh, tests/README.md, and ci.yml to the marker-based
  commands. (pyproject.toml also carries the bench console-script for the
  companion extract-benchmarks commit.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
OpenSpec change: extract-benchmarks. Decouples performance measurement from the
test suite into a standalone CLI (`ccc-gpu-bench` / `python -m ccc.bench`).

- Modes: coef (GPU-vs-CPU end-to-end, --pvalue-n-perms/--return-parts/
  --gpu-only/--cpu-only + grids), ari (kernel-level), scaling (CPU n_jobs).
- Structured output: JSONL (default) or CSV, incremental writes, one record per
  case with full config, seed, env metadata (GPU/driver/CUDA/CPU/pkg version),
  and warmup-excluded repeated timings + speedup.
- Presets smoke (seconds) and paper (poster/README grid). --profile gives a CPU
  cProfile category breakdown and prints an nsys suggestion for GPU runs.
- Stdlib-only (argparse); graceful degradation without a GPU. CPU-only smoke test
  for the CLI plumbing (tests/test_bench_cli.py).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- All human-readable status/progress/nsys-suggestion output now goes to stderr
  (cli.py, runners.py), so the default JSONL/CSV written to stdout stays
  machine-parseable when --output is omitted or '-'.
- gpu_available() now probes cupy for an accessible CUDA device count instead of
  only checking that cupy/ccc_cuda_ext are importable, so a device-less host
  (CUDA env on a CPU runner) fails fast with a clear message.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@haoyu-zc

Copy link
Copy Markdown
Collaborator Author

Codex review returned two findings, both fixed in the latest commit:

  • [P1] bench structured stdout was polluted by status/progress prints → all diagnostics now go to stderr; verified ccc-gpu-bench coef --preset smoke writes only valid JSONL to stdout.
  • [P2] gpu_available() only checked module importability → now probes cupy for an accessible device count, so a device-less CUDA env fails fast.
    Re-verified: bench CLI test 5 passed, ruff/format clean, stdout is pure parseable JSONL.

@haoyu-zc
haoyu-zc merged commit 351bf5b into refacotring-07-16-2026 Jul 17, 2026
3 checks passed
@haoyu-zc
haoyu-zc deleted the pr-d-tests-benchmarks branch July 17, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant