|
| 1 | +# SLICOT Benchmarks |
| 2 | + |
| 3 | +Two benchmark suites: **Python wrapper benchmarks** (pytest-benchmark) and **C vs Fortran benchmarks** (native). |
| 4 | + |
| 5 | +## Python Wrapper Benchmarks |
| 6 | + |
| 7 | +pytest-benchmark tests for the Python API. |
| 8 | + |
| 9 | +```bash |
| 10 | +# Install pytest-benchmark |
| 11 | +pip install pytest-benchmark |
| 12 | + |
| 13 | +# Run benchmarks |
| 14 | +pytest benchmarks/ --benchmark-only |
| 15 | +``` |
| 16 | + |
| 17 | +## C11 vs Fortran77 Benchmarks |
| 18 | + |
| 19 | +Compares native C11 implementation against original Fortran77. |
| 20 | + |
| 21 | +### Prerequisites |
| 22 | + |
| 23 | +1. **Build C library with benchmarks** |
| 24 | + ```bash |
| 25 | + meson setup build && meson compile -C build |
| 26 | + ``` |
| 27 | + |
| 28 | +2. **Build Fortran reference library** |
| 29 | + ```bash |
| 30 | + cd SLICOT-Reference |
| 31 | + cmake -B build_bench |
| 32 | + cmake --build build_bench |
| 33 | + cd .. |
| 34 | + ``` |
| 35 | + |
| 36 | +### Running |
| 37 | + |
| 38 | +```bash |
| 39 | +# Full comparison (generates markdown report) |
| 40 | +python scripts/benchmark_c_vs_fortran.py --output benchmark_report.md |
| 41 | + |
| 42 | +# Custom build directory |
| 43 | +python scripts/benchmark_c_vs_fortran.py --c-build-dir build --output report.md |
| 44 | + |
| 45 | +# Specific routines only |
| 46 | +python scripts/benchmark_c_vs_fortran.py -r bb01ad sb02md |
| 47 | + |
| 48 | +# Run native C benchmarks via meson |
| 49 | +meson benchmark -C build |
| 50 | +``` |
| 51 | + |
| 52 | +### Output |
| 53 | + |
| 54 | +Generates `benchmark_report.md` with: |
| 55 | +- Executive summary (speedup statistics) |
| 56 | +- System configuration |
| 57 | +- Per-routine comparison tables |
| 58 | +- Raw benchmark data (CSV) |
| 59 | + |
| 60 | +### Routines Benchmarked |
| 61 | + |
| 62 | +| Routine | Description | |
| 63 | +|---------|-------------| |
| 64 | +| BB01AD | CAREX - Continuous-time Riccati examples | |
| 65 | +| BB02AD | DAREX - Discrete-time Riccati examples | |
| 66 | +| BB03AD | CTLEX - Continuous-time Lyapunov examples | |
| 67 | +| BB04AD | DTLEX - Discrete-time Lyapunov examples | |
| 68 | +| BD01AD | CTDSX - Continuous-time descriptor examples | |
| 69 | +| BD02AD | DTDSX - Discrete-time descriptor examples | |
| 70 | +| SB03MD | Continuous-time Lyapunov solver | |
| 71 | +| SB03OD | Discrete-time Lyapunov solver (Cholesky) | |
| 72 | + |
| 73 | +### Requirements |
| 74 | + |
| 75 | +- Python 3.8+ |
| 76 | +- gfortran (for Fortran benchmarks) |
| 77 | +- meson, ninja (for C build) |
| 78 | +- BLAS/LAPACK (Accelerate on macOS, OpenBLAS on Linux) |
0 commit comments