Cleanup and refactoring

This commit is contained in:
Jack Yu 2021-04-18 15:29:09 -04:00
parent e23b39ee41
commit 24c3772926
2 changed files with 11 additions and 9 deletions

View File

@ -53,13 +53,15 @@ impl SystemObject {
// Possible interesting improvement would be building a cpu_bind_map using a syntax like // Possible interesting improvement would be building a cpu_bind_map using a syntax like
// OpenMP's OMP_PLACES. But that is outside of this project's scope due to difficulty of // OpenMP's OMP_PLACES. But that is outside of this project's scope due to difficulty of
// writing a parser. // writing a parser.
let cpu_bind_map= (0..available_hwthreads).map(|x| { let cpu_bind_map = (0..available_hwthreads)
.map(|x| {
let package_id = x / puppa; let package_id = x / puppa;
let package_offset = x % puppa; let package_offset = x % puppa;
let core_id = package_offset % coppa; let core_id = package_offset % coppa;
let core_offset = package_offset / coppa; let core_offset = package_offset / coppa;
return puppa * package_id + core_id * pupco + core_offset; return puppa * package_id + core_id * pupco + core_offset;
}).collect::<Vec<usize>>(); })
.collect::<Vec<usize>>();
let max_num_threads = max( let max_num_threads = max(
option_env!("RMP_NUM_THREADS") option_env!("RMP_NUM_THREADS")

View File

@ -119,7 +119,7 @@ impl ThreadPoolManager {
/// long as the default Rust for loop accepts it. /// long as the default Rust for loop accepts it.
pub fn split_iterators<T, S>(&self, iter: T, block_size: usize) -> Vec<Vec<S>> pub fn split_iterators<T, S>(&self, iter: T, block_size: usize) -> Vec<Vec<S>>
where where
T: Iterator<Item=S> T: Iterator<Item = S>,
{ {
let mut split = Vec::new(); let mut split = Vec::new();
split.reserve_exact(self.num_threads); split.reserve_exact(self.num_threads);