P9 (WIP): compiled kernels (rust/simurg-core, PyO3) with bit-identical pure-Python fallback
Rust ports of the hot paths found by profiling: fused per-locus GenCall calling and scoring, BAF/LRR, libm maps with CPython math semantics, both nearest-neighbour searches of the normalization fit, and the BPM LocusEntry parser. Address coverage is memoised per IDAT layout. SIMURG_PURE_PYTHON=1 forces the pure paths. On the Pi: genotype_sample 3.4 s -> 1.1 s, 36-sample GSA run 131 s -> 46 s, BPM read 4x faster; 36 GSA + 6 Omni2.5 GTCs and QC tables byte-identical to the pure path; tests/unit/test_core_kernels.py checks every kernel on edge cases. bench/profile_genotype.py, bench/scaling.py, cloud task p9 (thread scaling).
This commit is contained in:
1 parent
f11b39b5a3
commit
6524a6d1b0
19 files changed
+1755
-6
No files matched your search
@@ -0,0 +1,24 @@
|
||||
"""Optional compiled kernels (``rust/simurg-core``, plan §18 P9).
|
||||
|
||||
``core`` is the ``simurg_core`` extension module when it is installed, else ``None``; every caller keeps a pure
|
||||
Python/NumPy path with bit-identical results. ``SIMURG_PURE_PYTHON=1`` forces the pure paths (tests, debugging).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from types import ModuleType
|
||||
|
||||
core: ModuleType | None
|
||||
if os.environ.get("SIMURG_PURE_PYTHON", "") not in ("", "0"):
|
||||
core = None
|
||||
else:
|
||||
try:
|
||||
import simurg_core as core # type: ignore[no-redef]
|
||||
except ImportError: # pragma: no cover - depends on the installation
|
||||
core = None
|
||||
|
||||
|
||||
def backend() -> str:
|
||||
"""``"rust <version>"`` or ``"python"`` (recorded in run manifests)."""
|
||||
return f"rust {core.__version__}" if core is not None else "python"
|
||||
Reference in new issue
Block a user