From 69727ca773fc7e8863138932c35691eaeab03d9b Mon Sep 17 00:00:00 2001 From: Vladimir Dimic Date: Fri, 30 Sep 2022 17:58:33 +0200 Subject: [PATCH] Allow for a tolerance in error checking in ALP gemm unit test --- tests/unit/alp_gemm.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/alp_gemm.cpp b/tests/unit/alp_gemm.cpp index f72e74214..04e04737f 100644 --- a/tests/unit/alp_gemm.cpp +++ b/tests/unit/alp_gemm.cpp @@ -26,6 +26,8 @@ using namespace alp; +static double tol = 1.e-7; + /** * Initializes matrix elements to random values between 0 and 1. * Assumes the matrix uses full storage. @@ -199,7 +201,7 @@ void alp_program( const size_t &unit, alp::RC &rc ) { const auto calculated_value = alp::internal::access( C, alp::internal::getStorageIndex( C, i, j ) ); // Compare and report - if( expected_value != calculated_value ) { + if( std::abs( expected_value - calculated_value ) > tol ) { #ifndef NDEBUG std::cerr << "Numerically incorrect: " "at (" << i << ", " << j << ") "