Skip to content

Commit

Permalink
Reenabling tests for nvhpc 23.7
Browse files Browse the repository at this point in the history
  • Loading branch information
crtrott committed Aug 25, 2023
1 parent 775cc55 commit 5a9aee3
Show file tree
Hide file tree
Showing 21 changed files with 56 additions and 130 deletions.
10 changes: 5 additions & 5 deletions core/src/Kokkos_MathematicalFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ KOKKOS_INLINE_FUNCTION int abs(int n) {
}
KOKKOS_INLINE_FUNCTION long abs(long n) {
// FIXME_NVHPC ptxas fatal : unresolved extern function 'labs'
#ifdef KOKKOS_COMPILER_NVHPC
#if defined(KOKKOS_COMPILER_NVHPC) && KOKKOS_COMPILER_NVHPC<230700
return n > 0 ? n : -n;
#else
using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::abs;
Expand All @@ -295,7 +295,7 @@ KOKKOS_INLINE_FUNCTION long abs(long n) {
}
KOKKOS_INLINE_FUNCTION long long abs(long long n) {
// FIXME_NVHPC ptxas fatal : unresolved extern function 'labs'
#ifdef KOKKOS_COMPILER_NVHPC
#if defined(KOKKOS_COMPILER_NVHPC) && KOKKOS_COMPILER_NVHPC<230700
return n > 0 ? n : -n;
#else
using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::abs;
Expand Down Expand Up @@ -345,9 +345,7 @@ KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED(
// Exponential functions
KOKKOS_IMPL_MATH_UNARY_FUNCTION(exp)
// FIXME_NVHPC nvc++ has issues with exp2
#ifndef KOKKOS_COMPILER_NVHPC
KOKKOS_IMPL_MATH_UNARY_FUNCTION(exp2)
#else
#if defined(KOKKOS_COMPILER_NVHPC) && KOKKOS_COMPILER_NVHPC<230700
KOKKOS_INLINE_FUNCTION float exp2(float val) {
constexpr float ln2 = 0.693147180559945309417232121458176568L;
return exp(ln2 * val);
Expand All @@ -365,6 +363,8 @@ KOKKOS_INLINE_FUNCTION double exp2(T val) {
constexpr double ln2 = 0.693147180559945309417232121458176568L;
return exp(ln2 * static_cast<double>(val));
}
#else
KOKKOS_IMPL_MATH_UNARY_FUNCTION(exp2)
#endif
KOKKOS_IMPL_MATH_UNARY_FUNCTION(expm1)
KOKKOS_IMPL_MATH_UNARY_FUNCTION(log)
Expand Down
6 changes: 2 additions & 4 deletions core/src/Kokkos_Pair.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ struct pair {
///
/// This calls the copy constructors of T1 and T2. It won't compile
/// if those copy constructors are not defined and public.
#ifdef KOKKOS_COMPILER_NVHPC // FIXME_NVHPC bug in NVHPC regarding constexpr
// constructors used in device code
#if defined(KOKKOS_COMPILER_NVHPC) && KOKKOS_COMPILER_NVHPC<230700
KOKKOS_FORCEINLINE_FUNCTION
#else
KOKKOS_FORCEINLINE_FUNCTION constexpr
Expand All @@ -75,8 +74,7 @@ struct pair {
/// This calls the copy constructors of T1 and T2. It won't compile
/// if those copy constructors are not defined and public.
template <class U, class V>
#ifdef KOKKOS_COMPILER_NVHPC // FIXME_NVHPC bug in NVHPC regarding constexpr
// constructors used in device code
#if defined(KOKKOS_COMPILER_NVHPC) && KOKKOS_COMPILER_NVHPC<230700
KOKKOS_FORCEINLINE_FUNCTION
#else
KOKKOS_FORCEINLINE_FUNCTION constexpr
Expand Down
2 changes: 0 additions & 2 deletions core/unit_test/TestAbort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <regex>
#include <Kokkos_Core.hpp>

#ifndef KOKKOS_COMPILER_NVHPC // FIXME_NVHPC
TEST(TEST_CATEGORY_DEATH, abort_from_host) {
::testing::FLAGS_gtest_death_test_style = "threadsafe";

Expand Down Expand Up @@ -100,4 +99,3 @@ TEST(TEST_CATEGORY_DEATH, abort_from_device) {
::testing::FLAGS_gtest_death_test_style = "threadsafe";
test_abort_from_device<TEST_EXECSPACE>();
}
#endif
4 changes: 0 additions & 4 deletions core/unit_test/TestAtomics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,10 +582,6 @@ struct TpetraUseCase {
};

TEST(TEST_CATEGORY, atomics_tpetra_max_abs) {
#ifdef KOKKOS_COMPILER_NVHPC
GTEST_SKIP() << "FIXME_NVHPC (?)";
#endif

TpetraUseCase().check();
}

Expand Down
2 changes: 1 addition & 1 deletion core/unit_test/TestBitManipulationBuiltins.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ struct TestBitCastFunction {
}

#if defined(KOKKOS_ENABLE_CUDA) && \
defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC
defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC 23.7
if constexpr (std::is_same_v<Space, Kokkos::Cuda>) {
return;
}
Expand Down
6 changes: 0 additions & 6 deletions core/unit_test/TestHostSharedPtrAccessOnDevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,6 @@ TEST(TEST_CATEGORY, host_shared_ptr_dereference_on_device) {
static_cast<T*>(Kokkos::kokkos_malloc<MemorySpace>(sizeof(T))),
[](T* p) { Kokkos::kokkos_free<MemorySpace>(p); });

#if defined(KOKKOS_ENABLE_CUDA) && \
defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC
if constexpr (std::is_same_v<TEST_EXECSPACE, Kokkos::Cuda>) {
GTEST_SKIP() << "FIXME wrong result";
}
#endif
check_access_stored_pointer_and_dereference_on_device(device_ptr);
}

Expand Down
22 changes: 0 additions & 22 deletions core/unit_test/TestJoinBackwardCompatibility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@

#ifndef KOKKOS_ENABLE_OPENACC // FIXME_OPENACC - temporarily disabled due to
// unimplemented reduction features
#ifndef KOKKOS_COMPILER_NVHPC // doesn't work with 23.1
namespace {

// FIXME_NVHPC 23.3 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,
Expand All @@ -40,17 +35,6 @@ 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 @@ -138,14 +122,8 @@ void test_join_backward_compatibility() {
}

TEST(TEST_CATEGORY, join_backward_compatibility) {
#if defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_COMPILER_NVHPC) && \
KOKKOS_COMPILER_NVHPC < \
230300 // FIXME_NVHPC test passes with workaround in 23.3
GTEST_SKIP() << "FIXME wrong result";
#endif
test_join_backward_compatibility();
}

} // namespace
#endif
#endif
16 changes: 16 additions & 0 deletions core/unit_test/TestLocalDeepCopy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,10 @@ void impl_test_local_deepcopy_rangepolicy_rank_7(const int N) {

#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
TEST(TEST_CATEGORY, local_deepcopy_teampolicy_layoutleft) {
#ifdef KOKKOS_COMPILER_NVHPC // 23.7
GTEST_SKIP() << "FIXME_NVHPC (?)";
#endif

using ExecSpace = TEST_EXECSPACE;
using ViewType = Kokkos::View<double********, Kokkos::LayoutLeft, ExecSpace>;

Expand Down Expand Up @@ -933,6 +937,10 @@ TEST(TEST_CATEGORY, local_deepcopy_teampolicy_layoutleft) {
}
//-------------------------------------------------------------------------------------------------------------
TEST(TEST_CATEGORY, local_deepcopy_rangepolicy_layoutleft) {
#ifdef KOKKOS_COMPILER_NVHPC // 23.7
GTEST_SKIP() << "FIXME_NVHPC (?)";
#endif

using ExecSpace = TEST_EXECSPACE;
using ViewType = Kokkos::View<double********, Kokkos::LayoutLeft, ExecSpace>;

Expand Down Expand Up @@ -960,6 +968,10 @@ TEST(TEST_CATEGORY, local_deepcopy_rangepolicy_layoutleft) {
}
//-------------------------------------------------------------------------------------------------------------
TEST(TEST_CATEGORY, local_deepcopy_teampolicy_layoutright) {
#ifdef KOKKOS_COMPILER_NVHPC // 23.7
GTEST_SKIP() << "FIXME_NVHPC (?)";
#endif

using ExecSpace = TEST_EXECSPACE;
using ViewType = Kokkos::View<double********, Kokkos::LayoutRight, ExecSpace>;

Expand Down Expand Up @@ -987,6 +999,10 @@ TEST(TEST_CATEGORY, local_deepcopy_teampolicy_layoutright) {
}
//-------------------------------------------------------------------------------------------------------------
TEST(TEST_CATEGORY, local_deepcopy_rangepolicy_layoutright) {
#ifdef KOKKOS_COMPILER_NVHPC //23.7
GTEST_SKIP() << "FIXME_NVHPC (?)";
#endif

using ExecSpace = TEST_EXECSPACE;
using ViewType = Kokkos::View<double********, Kokkos::LayoutRight, ExecSpace>;

Expand Down
2 changes: 0 additions & 2 deletions core/unit_test/TestMDRangePolicyConstructors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ TEST(TEST_CATEGORY, md_range_policy_construction_from_arrays) {
construct_mdrange_policy_variable_type<std::int64_t>();
}

#ifndef KOKKOS_COMPILER_NVHPC // FIXME_NVHPC
#ifndef KOKKOS_ENABLE_OPENMPTARGET // FIXME_OPENMPTARGET
TEST(TEST_CATEGORY_DEATH, policy_bounds_unsafe_narrowing_conversions) {
using Policy = Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>,
Expand All @@ -95,6 +94,5 @@ TEST(TEST_CATEGORY_DEATH, policy_bounds_unsafe_narrowing_conversions) {
"unsafe narrowing conversion");
}
#endif
#endif

} // namespace
2 changes: 1 addition & 1 deletion core/unit_test/TestMathematicalConstants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct TestMathematicalConstants {

KOKKOS_FUNCTION void use_on_device() const {
#if defined(KOKKOS_COMPILER_NVCC) || defined(KOKKOS_ENABLE_OPENMPTARGET) || \
defined(KOKKOS_ENABLE_OPENACC) || defined(KOKKOS_COMPILER_NVHPC)
defined(KOKKOS_ENABLE_OPENACC) || defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC 23.7
take_by_value(Trait::value);
#else
(void)take_address_of(Trait::value);
Expand Down
7 changes: 1 addition & 6 deletions core/unit_test/TestMathematicalFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,7 @@ struct math_function_name;
// https://www.gnu.org/software/libc/manual/html_node/Errors-in-Math-Functions.html
// For now 1s largely seem to work ...
DEFINE_UNARY_FUNCTION_EVAL(exp, 2);
#ifdef KOKKOS_COMPILER_NVHPC // FIXME_NVHPC exp2 not device callable,
// workaround computes it via exp
DEFINE_UNARY_FUNCTION_EVAL(exp2, 30);
#else
DEFINE_UNARY_FUNCTION_EVAL(exp2, 2);
#endif
DEFINE_UNARY_FUNCTION_EVAL(expm1, 2);
DEFINE_UNARY_FUNCTION_EVAL(log, 2);
DEFINE_UNARY_FUNCTION_EVAL(log10, 2);
Expand Down Expand Up @@ -1151,7 +1146,7 @@ struct TestIsNaN {
Kokkos::printf("failed isnan(float)\n");
}
if (isnan(3.)
#ifndef KOKKOS_COMPILER_NVHPC // FIXME_NVHPC
#ifndef KOKKOS_COMPILER_NVHPC // FIXME_NVHPC 23.7
|| !isnan(quiet_NaN<double>::value) ||
!isnan(signaling_NaN<double>::value)
#endif
Expand Down
5 changes: 0 additions & 5 deletions core/unit_test/TestMinMaxClamp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,6 @@ TEST(TEST_CATEGORY, minmax) {
EXPECT_EQ(r2.first, 2);
EXPECT_EQ(r2.second, 3);

#ifndef KOKKOS_COMPILER_NVHPC // FIXME_NVHPC nvhpc can't deal with device side
// constexpr constructors so I removed the
// constexpr in pair, which makes static_assert
// here fail
static_assert((Kokkos::pair<float, float>(Kokkos::minmax(3.f, 2.f)) ==
Kokkos::make_pair(2.f, 3.f)));
static_assert(
Expand Down Expand Up @@ -208,7 +204,6 @@ TEST(TEST_CATEGORY, minmax) {
::Test::PairIntCompareFirst{0, 5},
})
.second.second == 4); // rightmost
#endif
}

template <class ViewType>
Expand Down

0 comments on commit 5a9aee3

Please sign in to comment.