Skip to content

Commit

Permalink
Work around NVHPC issue with enum types
Browse files Browse the repository at this point in the history
  • Loading branch information
crtrott committed May 5, 2023
1 parent edf63b3 commit ea134de
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions core/unit_test/TestJoinBackwardCompatibility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@
// unimplemented reduction features
namespace {

// FIXME_NVHPC errors out when using enums here
// NVC++-F-0000-Internal compiler error. process_acc_put_dinit: unexpected
// datatype 5339
#ifndef KOKKOS_COMPILER_NVHPC
enum MyErrorCode {
no_error = 0b000,
error_operator_plus_equal = 0b001,
error_operator_plus_equal_volatile = 0b010,
error_join_volatile = 0b100,
expected_join_volatile = 0b1000

};

KOKKOS_FUNCTION constexpr MyErrorCode operator|(MyErrorCode lhs,
Expand All @@ -36,6 +39,17 @@ KOKKOS_FUNCTION constexpr MyErrorCode operator|(MyErrorCode lhs,
static_cast<int>(rhs));
}

#else

using MyErrorCode = unsigned;
constexpr MyErrorCode no_error = 0b000;
constexpr MyErrorCode error_operator_plus_equal = 0b001;
constexpr MyErrorCode error_operator_plus_equal_volatile = 0b010;
constexpr MyErrorCode error_join_volatile = 0b100;
constexpr MyErrorCode expected_join_volatile = 0b1000;

#endif

static_assert((no_error | error_operator_plus_equal_volatile) ==
error_operator_plus_equal_volatile,
"");
Expand Down Expand Up @@ -130,10 +144,6 @@ void test_join_backward_compatibility() {
}

TEST(TEST_CATEGORY, join_backward_compatibility) {
#if defined(KOKKOS_ENABLE_CUDA) && \
defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC
GTEST_SKIP() << "FIXME wrong result";
#endif
test_join_backward_compatibility();
}

Expand Down

0 comments on commit ea134de

Please sign in to comment.