Ready for fvm steady case
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
|
||||
#include "test_common.h"
|
||||
#include "./utils/utils.h" // matrix.h, vector.h
|
||||
#include "./numerics/matvec.h" // numerics::matvec / inplace_transpose
|
||||
|
||||
#include "./numerics/matvec.h" // numerics::matvec / inplace_transpose
|
||||
#include <chrono>
|
||||
|
||||
using utils::Vi; using utils::Vf; using utils::Vd;
|
||||
@@ -107,7 +106,7 @@ TEST_CASE(Matvec_Speed_Sanity) {
|
||||
|
||||
auto t0 = std::chrono::high_resolution_clock::now();
|
||||
auto yS = numerics::matvec(A,x);
|
||||
double tp = std::chrono::duration<double>(t0 - std::chrono::high_resolution_clock::now()).count();
|
||||
double tp = std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - t0).count();
|
||||
|
||||
#ifdef _OPENMP
|
||||
int threads = omp_get_max_threads();
|
||||
@@ -117,13 +116,13 @@ TEST_CASE(Matvec_Speed_Sanity) {
|
||||
|
||||
t0 = std::chrono::high_resolution_clock::now();
|
||||
auto yP = numerics::matvec_omp(A,x);
|
||||
double ts = std::chrono::duration<double>(t0 - std::chrono::high_resolution_clock::now()).count();
|
||||
double ts = std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - t0).count();
|
||||
|
||||
CHECK((yS.nearly_equal_vec(yP)), "matvec_omp != matvec_serial (large)");
|
||||
// Only enforce basic sanity if we *can* use >1 threads:
|
||||
if (threads > 1) {
|
||||
// Be generous: just require not significantly slower.
|
||||
CHECK(tp <= ts, "matvec_omp unexpectedly much slower than serial");
|
||||
CHECK(tp >= ts, "matvec_omp unexpectedly much slower than serial");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user