add num_threads back in too

This commit is contained in:
rezural
2020-12-24 21:25:49 +11:00
parent 70d05cc63f
commit 975f0d149f

View File

@@ -16,12 +16,18 @@ pub struct RunState {
impl RunState { impl RunState {
pub fn new() -> Self { pub fn new() -> Self {
#[cfg(feature = "parallel")]
let num_threads = num_cpus::get_physical();
#[cfg(feature = "parallel")]
let thread_pool = rapier::rayon::ThreadPoolBuilder::new()
.num_threads(num_threads)
.build()
.unwrap();
Self { Self {
#[cfg(feature = "parallel")] #[cfg(feature = "parallel")]
thread_pool: rapier::rayon::ThreadPoolBuilder::new() thread_pool: thread_pool,
.num_threads(num_threads)
.build()
.unwrap(),
timestep_id: 0, timestep_id: 0,
time: 0.0, time: 0.0,
} }