Skip to content

Commit a75921b

Browse files
committed
feat: Make cpu_math parallelization configurable
1 parent 1f39c2c commit a75921b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/cpu_math.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,27 @@ use crate::{
1414
pub struct CpuMath<F: CpuLogpFunc> {
1515
logp_func: F,
1616
arch: pulp::Arch,
17+
parallel: faer::Parallelism<'static>,
1718
}
1819

1920
impl<F: CpuLogpFunc> CpuMath<F> {
2021
pub fn new(logp_func: F) -> Self {
2122
let arch = pulp::Arch::new();
22-
Self { logp_func, arch }
23+
let parallel = faer::Parallelism::None;
24+
Self {
25+
logp_func,
26+
arch,
27+
parallel,
28+
}
29+
}
30+
31+
pub fn with_parallel(logp_func: F, parallel: faer::Parallelism<'static>) -> Self {
32+
let arch = pulp::Arch::new();
33+
Self {
34+
logp_func,
35+
arch,
36+
parallel,
37+
}
2338
}
2439
}
2540

0 commit comments

Comments
 (0)