Skip to content

Commit

Permalink
fixes build error for TeamReduce and TeamTranformReduced tests for sp…
Browse files Browse the repository at this point in the history
…ecific GCC (kokkos#6459)
  • Loading branch information
fnrizzi committed Sep 21, 2023
1 parent e1c8266 commit 9b37781
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
11 changes: 6 additions & 5 deletions algorithms/unit_tests/TestStdAlgorithmsCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,12 @@ auto make_bounds(const ValueType1& lower, const ValueType2 upper) {
return Kokkos::pair<ValueType1, ValueType2>{lower, upper};
}

#if defined(__GNUC__) && __GNUC__ == 8

// GCC 8 doesn't come with reduce, transform_reduce, exclusive_scan,
// inclusive_scan, transform_exclusive_scan and transform_inclusive_scan so here
// are simplified versions of them, only for testing purpose
// libstdc++ as provided by GCC 8 does not have reduce, transform_reduce,
// exclusive_scan, inclusive_scan, transform_exclusive_scan,
// transform_inclusive_scan and for GCC 9.1, 9.2 fails to compile them for
// missing overload not accepting policy so use here simplified versions of
// them, only for testing purpose
#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE <= 9)

template <class InputIterator, class ValueType, class BinaryOp>
ValueType testing_reduce(InputIterator first, InputIterator last,
Expand Down
8 changes: 6 additions & 2 deletions algorithms/unit_tests/TestStdAlgorithmsTeamReduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,12 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) {

ASSERT_TRUE(intraTeamSentinelView_h(i));

// GCC 8 does not have reduce so guard against this
#if defined(__GNUC__) && __GNUC__ == 8
// libstdc++ as provided by GCC 8 does not have reduce, transform_reduce,
// exclusive_scan, inclusive_scan, transform_exclusive_scan,
// transform_inclusive_scan and for GCC 9.1, 9.2 fails to compile them for
// missing overload not accepting policy

#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE <= 9)
#define reduce testing_reduce
#else
#define reduce std::reduce
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,11 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) {

ASSERT_TRUE(intraTeamSentinelView_h(i));

// GCC 8 does not have transform_reduce so guard against this
#if defined(__GNUC__) && __GNUC__ == 8
// libstdc++ as provided by GCC 8 does not have reduce, transform_reduce,
// exclusive_scan, inclusive_scan, transform_exclusive_scan,
// transform_inclusive_scan and for GCC 9.1, 9.2 fails to compile them for
// missing overload not accepting policy
#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE <= 9)
#define transform_reduce testing_transform_reduce
#else
#define transform_reduce std::transform_reduce
Expand Down

0 comments on commit 9b37781

Please sign in to comment.