diff --git a/HeterogeneousCore/AlpakaInterface/test/alpaka/testWorkDivision.dev.cc b/HeterogeneousCore/AlpakaInterface/test/alpaka/testWorkDivision.dev.cc index 6b49d1692b361..384e972ac469c 100644 --- a/HeterogeneousCore/AlpakaInterface/test/alpaka/testWorkDivision.dev.cc +++ b/HeterogeneousCore/AlpakaInterface/test/alpaka/testWorkDivision.dev.cc @@ -21,16 +21,6 @@ enum class RangeType { Default, ExtentLimited, ExtentLimitedWithShift }; // The concurrency scope between threads enum class LoopScope { Block, Grid }; -// Utility for one time initializations -template -bool constexpr firstInLoopRange(TAcc const& acc) { - if constexpr (loopScope == LoopScope::Block) - return not alpaka::getIdx(acc)[0u]; - if constexpr (loopScope == LoopScope::Grid) - return not alpaka::getIdx(acc)[0u]; - assert(false); -} - template size_t constexpr expectedCount(TAcc const& acc, size_t skip, size_t size) { if constexpr (rangeType == RangeType::ExtentLimitedWithShift) @@ -65,8 +55,9 @@ struct testWordDivisionDefaultRange { (loopScope == LoopScope::Grid ? *globalCounter : alpaka::declareSharedVar(acc)); // Init the counter for block range. Grid range does so my mean of memset. if constexpr (loopScope == LoopScope::Block) { - if (firstInLoopRange(acc)) + if (cms::alpakatools::once_per_block(acc)) { counter = 0; + } alpaka::syncBlockThreads(acc); } // The loop we are testing @@ -82,7 +73,7 @@ struct testWordDivisionDefaultRange { alpaka::syncBlockThreads(acc); // Check the result. Grid range will check by memcpy-ing the result. if constexpr (loopScope == LoopScope::Block) { - if (firstInLoopRange(acc)) { + if (cms::alpakatools::once_per_block(acc)) { auto expected = expectedCount(acc, skip, size); ALPAKA_ASSERT_ACC(counter == expected); }