Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalobg committed Jun 5, 2024
1 parent fb52c11 commit 8d3f416
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,21 +332,22 @@ void check_solution(const size_t num_times, T const* a, T const* b, T const* c,
size_t failed = 0;
T max_rel = std::numeric_limits<T>::epsilon() * T(100.0);
T max_rel_dot = std::numeric_limits<T>::epsilon() * T(10000000.0);
auto check = [&](const char* name, T is, T should, T max_rel, size_t i = size_t(-1)) {
auto check = [&](const char* name, T is, T should, T mrel, size_t i = size_t(-1)) {
// Relative difference:
T diff = std::abs(is - should);
T abs_is = std::abs(is);
T abs_sh = std::abs(should);
T largest = std::max(abs_is, abs_sh);
T same = diff <= largest * max_rel;
T same = diff <= largest * mrel;
if (!same || std::isnan(is)) {
++failed;
if (failed > 10) return;
std::cerr << "FAILED validation of " << name;
if (i != size_t(-1)) std::cerr << "[" << i << "]";
std::cerr << ": " << is << " (is) != " << should
<< " (should)" << ", diff=" << diff << " > "
<< largest * max_rel << std::endl;
<< largest * mrel << " (largest=" << largest
<< ", max_rel=" << mrel << ")" << std::endl;
}
};

Expand All @@ -360,9 +361,9 @@ void check_solution(const size_t num_times, T const* a, T const* b, T const* c,

// Calculate the L^infty-norm relative error
for (size_t i = 0; i < array_size; ++i) {
check("a", a[i], goldA, i, max_rel);
check("b", b[i], goldB, i, max_rel);
check("c", c[i], goldC, i, max_rel);
check("a", a[i], goldA, max_rel, i);
check("b", b[i], goldB, max_rel, i);
check("c", c[i], goldC, max_rel, i);
}

if (failed > 0 && !silence_errors)
Expand Down
1 change: 0 additions & 1 deletion src/std/STDStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ void STDStream<T>::nstream()
auto as = std::ranges::subrange(a, a + array_size);
auto bs = std::ranges::subrange(b, b + array_size);
auto cs = std::ranges::subrange(c, c + array_size);
auto r = std::views::zip(as, bs, cs);
std::transform(exe_policy, r.begin(), r.end(), a, [](auto vs) {
auto [a, b, c] = vs;
return a + b + startScalar * c;
Expand Down
2 changes: 1 addition & 1 deletion src/std/model.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ macro(setup)
register_append_link_flags(${NVHPC_FLAGS})
endif ()
if (USE_TBB)
register_link_library(TBB::tbb)
register_link_library(TBB::tbb)
endif ()
if (USE_ONEDPL)
register_definitions(USE_ONEDPL)
Expand Down

0 comments on commit 8d3f416

Please sign in to comment.