mod compute_backend¶
- module compute_backend¶
Batched marker evidence on CPU or CUDA.
Two kernels share one module and one retained context: the Yates chi-squared p-value used by
signif, and the Bayes factor with directional posterior used bytriage. Both consume the same per-marker presence counts, so a caller that already staged counts for one can evaluate the other without re-reading the marker table.Types
- type GramTotals¶
Upper-triangle Gram matrix, per-individual depth sums, and marker count.
Functions
- fn compute_bayes_evidence_batch(backend: PValueBackend, counts: &[AssociationCounts], total_group1: u32, total_group2: u32, model: &crate::stats::DirectionalModel) -> Result<(Vec<f64>, Vec<f64>), Box<dyn std::error::Error>>¶
Evaluate the Bayes factor and directional posterior for a batch of markers.
The model is validated once by the caller rather than per marker, matching the scalar hot path in
triage.
- fn compute_bayes_evidence_batch_with_metrics(backend: PValueBackend, counts: &[AssociationCounts], total_group1: u32, total_group2: u32, model: &crate::stats::DirectionalModel) -> Result<BayesEvidenceResult, Box<dyn std::error::Error>>¶
- fn compute_chi_squared_batch(backend: PValueBackend, counts: &[AssociationCounts], total_group1: u32, total_group2: u32) -> Result<Vec<f64>, Box<dyn std::error::Error>>¶
- fn compute_chi_squared_batch_with_metrics(backend: PValueBackend, counts: &[AssociationCounts], total_group1: u32, total_group2: u32) -> Result<BatchResult, Box<dyn std::error::Error>>¶
- fn compute_p_batch(backend: PValueBackend, test: crate::test_method::TestMethod, counts: &[AssociationCounts], total_group1: u32, total_group2: u32) -> Result<Vec<f64>, Box<dyn std::error::Error>>¶
Batched p-values for any supported association test.
- fn compute_p_batch_with_metrics(backend: PValueBackend, test: crate::test_method::TestMethod, counts: &[AssociationCounts], total_group1: u32, total_group2: u32) -> Result<BatchResult, Box<dyn std::error::Error>>¶
Enums
- enum PValueBackend¶
Execution backend for batched chi-square p-values.
- Cpu¶
- Cuda¶
Implementations
- impl PValueBackend¶
Functions
- fn name(self) -> &'static str¶
- fn parse_str(value: &str) -> Result<Self, String>¶
- enum PValueBuffer¶
Host storage for computed p-values.
- Owned(Vec<f64>)¶
- PageLocked(PooledPinnedResult)¶
Implementations
- impl PValueBuffer¶
Functions
- fn is_page_locked(&self) -> bool¶
- fn try_as_slice(&self) -> Result<&[f64], Box<dyn std::error::Error>>¶
Structs and Unions
- struct AssociationCounts¶
Marker-presence counts for the two groups under comparison.
- group1: u32¶
- group2: u32¶
Traits implemented
- unsafe impl cudarc::driver::DeviceRepr for AssociationCounts¶
- struct BatchMetrics¶
Timing and transfer accounting for one batch evaluation.
- backend: PValueBackend¶
- device: String¶
- markers: usize¶
- host_to_device_bytes: usize¶
- device_to_host_bytes: usize¶
- setup_seconds: f64¶
- host_to_device_seconds: f64¶
- kernel_seconds: f64¶
- device_to_host_seconds: f64¶
- total_seconds: f64¶
- output_buffer_reused: bool¶
- host_staging_bytes: usize¶
- struct BatchResult¶
P-values and backend measurements for one batch.
- p_values: PValueBuffer¶
- metrics: BatchMetrics¶
- struct BayesEvidenceResult¶
Per-marker Bayes factors and directional posteriors with backend timings.
- bayes_factors: Vec<f64>¶
- posteriors: Vec<f64>¶
- metrics: BatchMetrics¶
- struct DeviceBetaPrior¶
Beta shapes for one Bayes-factor hypothesis.
Traits implemented
- impl From<crate::stats::BetaPrior> for DeviceBetaPrior¶
- struct DeviceDirectionalModel¶
The directional model as the kernel consumes it.
The three logarithms are taken on the host from the same expressions the scalar path uses, so the device never recomputes a value that would drift from the CPU result.
Traits implemented
- impl From<&crate::stats::DirectionalModel> for DeviceDirectionalModel¶
- unsafe impl cudarc::driver::DeviceRepr for DeviceDirectionalModel¶
- struct DevicePrevalencePrior¶
One prevalence prior in the flat form the kernel reads.
kind0 carries a fixed probability infirst; kind 1 carries Beta shapes infirstandsecond.Traits implemented
- impl From<crate::stats::PrevalencePrior> for DevicePrevalencePrior¶
- struct GramAccumulator¶
Streaming accumulation of the marker-by-individual Gram matrix.
Markers arrive one at a time but the device wants many, so the host fills a tile and hands whole tiles over. The CPU variant applies the same rank-1 update directly, which keeps PCA on one code path.
Implementations
- impl GramAccumulator¶
Functions
- fn finish(mut self) -> Result<GramTotals, Box<dyn std::error::Error>>¶
Upper-triangle Gram, per-individual sums, and the marker count.
- fn new(backend: PValueBackend, individuals: usize) -> Result<Self, Box<dyn std::error::Error>>¶
- fn push(&mut self, depths: &[u16]) -> Result<(), Box<dyn std::error::Error>>¶
Fold one marker’s per-individual depths into the accumulation.
- struct PooledPinnedResult¶
Implementations
- impl PooledPinnedResult¶
Traits implemented
- impl Drop for PooledPinnedResult¶