pub fn root_batch_backend_for(
requested: ComputeBackend,
n: usize,
) -> ComputeBackendExpand description
The ComputeBackend the iterative solvers would actually use for n
problems if asked for requested — without running anything.
Applies exactly the same reduction the kernels do (feature availability, no
GPU kernel here, and the ROOT_BATCH_MIN_PROBLEMS size floor), so what it
reports is what would run. Useful for logging and for benchmark harnesses.
§Arguments
requested— the backend a caller would pass tosolve_bracketed_batchorsolve_newton_batch.n— the number of independent problems in the batch, dimensionless.
§Returns
Either ComputeBackend::Serial or ComputeBackend::CpuMulti; never
ComputeBackend::Gpu, because no GPU kernel exists here yet.
§Example
use outram_foam_basic_lib::compute::ComputeBackend;
use outram_foam_basic_lib::math::parallel::{root_batch_backend_for, ROOT_BATCH_MIN_PROBLEMS};
// Too small to thread, whatever was asked for.
assert_eq!(root_batch_backend_for(ComputeBackend::CpuMulti, 8), ComputeBackend::Serial);
// Big enough; the answer now depends only on whether `parallel` is compiled in.
let picked = root_batch_backend_for(ComputeBackend::CpuMulti, ROOT_BATCH_MIN_PROBLEMS);
assert!(picked.is_available());