From 1f3fe51770f4743292c3cfbc91d4be5cd0f60770 Mon Sep 17 00:00:00 2001 From: Janggun Lee Date: Thu, 5 Sep 2024 16:39:18 +0900 Subject: [PATCH] Increse bound & debug info. --- src/assignments/assignment13/small_exercises_grade.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/assignments/assignment13/small_exercises_grade.rs b/src/assignments/assignment13/small_exercises_grade.rs index 22dbef096..9ca0c9007 100644 --- a/src/assignments/assignment13/small_exercises_grade.rs +++ b/src/assignments/assignment13/small_exercises_grade.rs @@ -117,8 +117,8 @@ mod test { assert_eq!(res_par, 55.0); for _ in 0..5 { - let vec1 = Array::random(500_000, Uniform::new(0., 10.)); - let vec2 = Array::random(500_000, Uniform::new(0., 10.)); + let vec1 = Array::random(1_000_000, Uniform::new(0., 10.)); + let vec2 = Array::random(1_000_000, Uniform::new(0., 10.)); let now_seq = Instant::now(); let res_seq = hint::black_box(dot_product( @@ -134,8 +134,10 @@ mod test { )); let elapsed_par = now_par.elapsed(); - let _res = relative_eq!(res_seq, vec1.dot(&vec2), epsilon = f64::EPSILON); - let _res = relative_eq!(res_par, vec1.dot(&vec2), epsilon = f64::EPSILON); + let _ress = relative_eq!(res_seq, vec1.dot(&vec2), epsilon = f64::EPSILON); + let _resp = relative_eq!(res_par, vec1.dot(&vec2), epsilon = f64::EPSILON); + println!("Sequential: {_ress} {elapsed_seq:?}, Parallel: {_resp} {elapsed_par:?}"); + assert!(elapsed_par < elapsed_seq); } }