From 2b0f36a0cc2423de5b933bf0ba9f05585934279b Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Fri, 8 May 2020 09:08:39 +0200 Subject: [PATCH] Make a few tests check what they are supposed to --- tests/matrix_free/pre_and_post_loops_01.cc | 14 ++++++++------ tests/matrix_free/pre_and_post_loops_02.cc | 14 ++++++++------ tests/matrix_free/pre_and_post_loops_03.cc | 14 ++++++++------ tests/matrix_free/pre_and_post_loops_04.cc | 14 ++++++++------ tests/matrix_free/pre_and_post_loops_05.cc | 14 ++++++++------ 5 files changed, 40 insertions(+), 30 deletions(-) diff --git a/tests/matrix_free/pre_and_post_loops_01.cc b/tests/matrix_free/pre_and_post_loops_01.cc index 632345b13d..e117e539f9 100644 --- a/tests/matrix_free/pre_and_post_loops_01.cc +++ b/tests/matrix_free/pre_and_post_loops_01.cc @@ -159,11 +159,13 @@ test() for (unsigned int i = 0; i < vec1.local_size(); ++i) { - double entry = random_value(); + // Multiply by 0.01 to make float error with roundoff less than the + // numdiff absolute tolerance + double entry = 0.01 * random_value(); vec1.local_element(i) = entry; - entry = random_value(); + entry = 0.01 * random_value(); vec2.local_element(i) = entry; - entry = random_value(); + entry = 0.01 * random_value(); vec3.local_element(i) = entry; } @@ -172,7 +174,7 @@ test() LinearAlgebra::distributed::Vector ref3 = vec3; mf.vmult_with_update_basic(ref3, ref2, ref1); - mf.vmult_with_update_basic(vec3, vec2, vec1); + mf.vmult_with_update_merged(vec3, vec2, vec1); vec3 -= ref3; deallog << "Error in 1x merged operation: " << vec3.linfty_norm() @@ -181,10 +183,10 @@ test() ref3 = 0; mf.vmult_with_update_basic(ref1, ref2, ref3); - mf.vmult_with_update_basic(vec1, vec2, vec3); + mf.vmult_with_update_merged(vec1, vec2, vec3); mf.vmult_with_update_basic(ref1, ref2, ref3); - mf.vmult_with_update_basic(vec1, vec2, vec3); + mf.vmult_with_update_merged(vec1, vec2, vec3); vec3 -= ref3; deallog << "Error in 2x merged operation: " << vec3.linfty_norm() diff --git a/tests/matrix_free/pre_and_post_loops_02.cc b/tests/matrix_free/pre_and_post_loops_02.cc index 099a309c90..ce4431b1b7 100644 --- a/tests/matrix_free/pre_and_post_loops_02.cc +++ b/tests/matrix_free/pre_and_post_loops_02.cc @@ -172,11 +172,13 @@ test() vec1.get_partitioner()->local_to_global(i))) continue; - double entry = random_value(); + // Multiply by 0.01 to make float error with roundoff less than the + // numdiff absolute tolerance + double entry = 0.01 * random_value(); vec1.local_element(i) = entry; - entry = random_value(); + entry = 0.01 * random_value(); vec2.local_element(i) = entry; - entry = random_value(); + entry = 0.01 * random_value(); vec3.local_element(i) = entry; } @@ -185,7 +187,7 @@ test() LinearAlgebra::distributed::Vector ref3 = vec3; mf.vmult_with_update_basic(ref3, ref2, ref1); - mf.vmult_with_update_basic(vec3, vec2, vec1); + mf.vmult_with_update_merged(vec3, vec2, vec1); vec3 -= ref3; deallog << "Error in 1x merged operation: " << vec3.linfty_norm() @@ -194,10 +196,10 @@ test() ref3 = 0; mf.vmult_with_update_basic(ref1, ref2, ref3); - mf.vmult_with_update_basic(vec1, vec2, vec3); + mf.vmult_with_update_merged(vec1, vec2, vec3); mf.vmult_with_update_basic(ref1, ref2, ref3); - mf.vmult_with_update_basic(vec1, vec2, vec3); + mf.vmult_with_update_merged(vec1, vec2, vec3); vec3 -= ref3; deallog << "Error in 2x merged operation: " << vec3.linfty_norm() diff --git a/tests/matrix_free/pre_and_post_loops_03.cc b/tests/matrix_free/pre_and_post_loops_03.cc index 42dbe772cd..1b477e7116 100644 --- a/tests/matrix_free/pre_and_post_loops_03.cc +++ b/tests/matrix_free/pre_and_post_loops_03.cc @@ -161,11 +161,13 @@ test() for (unsigned int i = 0; i < vec1.local_size(); ++i) { - double entry = random_value(); + // Multiply by 0.01 to make float error with roundoff less than the + // numdiff absolute tolerance + double entry = 0.01 * random_value(); vec1.local_element(i) = entry; - entry = random_value(); + entry = 0.01 * random_value(); vec2.local_element(i) = entry; - entry = random_value(); + entry = 0.01 * random_value(); vec3.local_element(i) = entry; } @@ -174,7 +176,7 @@ test() LinearAlgebra::distributed::Vector ref3 = vec3; mf.vmult_with_update_basic(ref3, ref2, ref1); - mf.vmult_with_update_basic(vec3, vec2, vec1); + mf.vmult_with_update_merged(vec3, vec2, vec1); vec3 -= ref3; deallog << "Error in 1x merged operation: " << vec3.linfty_norm() @@ -183,10 +185,10 @@ test() ref3 = 0; mf.vmult_with_update_basic(ref1, ref2, ref3); - mf.vmult_with_update_basic(vec1, vec2, vec3); + mf.vmult_with_update_merged(vec1, vec2, vec3); mf.vmult_with_update_basic(ref1, ref2, ref3); - mf.vmult_with_update_basic(vec1, vec2, vec3); + mf.vmult_with_update_merged(vec1, vec2, vec3); vec3 -= ref3; deallog << "Error in 2x merged operation: " << vec3.linfty_norm() diff --git a/tests/matrix_free/pre_and_post_loops_04.cc b/tests/matrix_free/pre_and_post_loops_04.cc index 43362cf2da..907903ce7c 100644 --- a/tests/matrix_free/pre_and_post_loops_04.cc +++ b/tests/matrix_free/pre_and_post_loops_04.cc @@ -158,11 +158,13 @@ test() for (unsigned int i = 0; i < vec1.local_size(); ++i) { - double entry = random_value(); + // Multiply by 0.01 to make float error with roundoff less than the + // numdiff absolute tolerance + double entry = 0.01 * random_value(); vec1.local_element(i) = entry; - entry = random_value(); + entry = 0.01 * random_value(); vec2.local_element(i) = entry; - entry = random_value(); + entry = 0.01 * random_value(); vec3.local_element(i) = entry; } @@ -171,7 +173,7 @@ test() LinearAlgebra::distributed::Vector ref3 = vec3; mf.vmult_with_update_basic(ref3, ref2, ref1); - mf.vmult_with_update_basic(vec3, vec2, vec1); + mf.vmult_with_update_merged(vec3, vec2, vec1); vec3 -= ref3; deallog << "Error in 1x merged operation: " << vec3.linfty_norm() @@ -180,10 +182,10 @@ test() ref3 = 0; mf.vmult_with_update_basic(ref1, ref2, ref3); - mf.vmult_with_update_basic(vec1, vec2, vec3); + mf.vmult_with_update_merged(vec1, vec2, vec3); mf.vmult_with_update_basic(ref1, ref2, ref3); - mf.vmult_with_update_basic(vec1, vec2, vec3); + mf.vmult_with_update_merged(vec1, vec2, vec3); vec3 -= ref3; deallog << "Error in 2x merged operation: " << vec3.linfty_norm() diff --git a/tests/matrix_free/pre_and_post_loops_05.cc b/tests/matrix_free/pre_and_post_loops_05.cc index 3b8ceb953b..898d5fa11d 100644 --- a/tests/matrix_free/pre_and_post_loops_05.cc +++ b/tests/matrix_free/pre_and_post_loops_05.cc @@ -175,11 +175,13 @@ test() for (unsigned int i = 0; i < vec1.local_size(); ++i) { - double entry = random_value(); + // Multiply by 0.01 to make float error with roundoff less than the + // numdiff absolute tolerance + double entry = 0.01 * random_value(); vec1.local_element(i) = entry; - entry = random_value(); + entry = 0.01 * random_value(); vec2.local_element(i) = entry; - entry = random_value(); + entry = 0.01 * random_value(); vec3.local_element(i) = entry; } @@ -188,7 +190,7 @@ test() LinearAlgebra::distributed::Vector ref3 = vec3; mf.vmult_with_update_basic(ref3, ref2, ref1); - mf.vmult_with_update_basic(vec3, vec2, vec1); + mf.vmult_with_update_merged(vec3, vec2, vec1); vec3 -= ref3; deallog << "Error in 1x merged operation: " << vec3.linfty_norm() @@ -197,10 +199,10 @@ test() ref3 = 0; mf.vmult_with_update_basic(ref1, ref2, ref3); - mf.vmult_with_update_basic(vec1, vec2, vec3); + mf.vmult_with_update_merged(vec1, vec2, vec3); mf.vmult_with_update_basic(ref1, ref2, ref3); - mf.vmult_with_update_basic(vec1, vec2, vec3); + mf.vmult_with_update_merged(vec1, vec2, vec3); vec3 -= ref3; deallog << "Error in 2x merged operation: " << vec3.linfty_norm() -- 2.39.5