fixed format in "multithreading" and "lib"

This commit is contained in:
Felix Müller 2023-06-06 20:13:07 +02:00
parent d6bb8f38fa
commit aed49466ce
3 changed files with 2 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
/target /target
/Cargo.lock /Cargo.lock
.DS_Store .DS_Store
.idea
/.vscode /.vscode

View File

@ -37,7 +37,6 @@ fn dot(a: &[f64], b: &[f64]) -> f64 {
/// sized slices which then get passed ot their own thread to compute the partial dot product. After all threads have /// sized slices which then get passed ot their own thread to compute the partial dot product. After all threads have
/// finished the partial dot products will be summed to create the final result. /// finished the partial dot products will be summed to create the final result.
fn dot_parallel(a: Arc<Vec<f64>>, b: Arc<Vec<f64>>, threads: usize) { fn dot_parallel(a: Arc<Vec<f64>>, b: Arc<Vec<f64>>, threads: usize) {
let mut pool = ThreadPool::with_limit(threads); let mut pool = ThreadPool::with_limit(threads);
// number of elements in each vector for each thread // number of elements in each vector for each thread
@ -56,7 +55,7 @@ fn dot_parallel(a: Arc<Vec<f64>>, b: Arc<Vec<f64>>, threads: usize) {
dot(a, b) dot(a, b)
}); });
} }
pool.join_all(); pool.join_all();
black_box(pool.get_results().iter().sum::<f64>()); black_box(pool.get_results().iter().sum::<f64>());

View File

@ -1,4 +1,3 @@
extern crate core; extern crate core;
pub mod image; pub mod image;