Update Kokkos library in LAMMPS to v4.3.1

This commit is contained in:
Stan Gerald Moore
2024-05-15 14:14:08 -06:00
parent 008a8fcb11
commit a495aff480
20 changed files with 164 additions and 97 deletions

View File

@ -28,6 +28,17 @@ struct SumFunctor {
void operator()(int i, int& lsum) const { lsum += i; }
};
template <class ExecSpace>
void check_space_member_for_policies(const ExecSpace& exec) {
Kokkos::RangePolicy<ExecSpace> range_policy(exec, 0, 1);
ASSERT_EQ(range_policy.space(), exec);
Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<2>> mdrange_policy(exec, {0, 0},
{1, 1});
ASSERT_EQ(mdrange_policy.space(), exec);
Kokkos::TeamPolicy<ExecSpace> team_policy(exec, 1, Kokkos::AUTO);
ASSERT_EQ(team_policy.space(), exec);
}
template <class ExecSpace>
void check_distinctive([[maybe_unused]] ExecSpace exec1,
[[maybe_unused]] ExecSpace exec2) {
@ -89,6 +100,9 @@ void run_threaded_test(const Lambda1 l1, const Lambda2 l2) {
void test_partitioning(std::vector<TEST_EXECSPACE>& instances) {
check_distinctive(instances[0], instances[1]);
check_space_member_for_policies(instances[0]);
check_space_member_for_policies(instances[1]);
int sum1, sum2;
int N = 3910;
run_threaded_test(

View File

@ -625,4 +625,30 @@ TEST(TEST_CATEGORY, int_combined_reduce_mixed) {
}
#endif
#endif
#if defined(NDEBUG)
// the following test was made for:
// https://github.com/kokkos/kokkos/issues/6517
struct FunctorReductionWithLargeIterationCount {
KOKKOS_FUNCTION void operator()(const int64_t /*i*/, double& update) const {
update += 1.0;
}
};
TEST(TEST_CATEGORY, reduction_with_large_iteration_count) {
if constexpr (std::is_same_v<typename TEST_EXECSPACE::memory_space,
Kokkos::HostSpace>) {
GTEST_SKIP() << "Disabling for host backends";
}
const int64_t N = pow(2LL, 39LL) - pow(2LL, 8LL) + 1;
Kokkos::RangePolicy<TEST_EXECSPACE, Kokkos::IndexType<int64_t>> p(0, N);
double nu = 0;
EXPECT_NO_THROW(Kokkos::parallel_reduce(
"sample reduction", p, FunctorReductionWithLargeIterationCount(), nu));
ASSERT_DOUBLE_EQ(nu, double(N));
}
#endif
} // namespace Test

View File

@ -38,8 +38,13 @@ TEST(hip, space_access) {
static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace,
Kokkos::HIPSpace>::assignable);
#if !defined(KOKKOS_ENABLE_IMPL_HIP_UNIFIED_MEMORY)
static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace,
Kokkos::HIPSpace>::accessible);
#else
static_assert(Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace,
Kokkos::HIPSpace>::accessible);
#endif
static_assert(
!Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace,
@ -149,8 +154,13 @@ TEST(hip, space_access) {
Kokkos::SpaceAccessibility<Kokkos::HIP,
Kokkos::HIPManagedSpace>::accessible);
#if !defined(KOKKOS_ENABLE_IMPL_HIP_UNIFIED_MEMORY)
static_assert(!Kokkos::SpaceAccessibility<Kokkos::HostSpace,
Kokkos::HIPSpace>::accessible);
#else
static_assert(Kokkos::SpaceAccessibility<Kokkos::HostSpace,
Kokkos::HIPSpace>::accessible);
#endif
static_assert(
Kokkos::SpaceAccessibility<Kokkos::HostSpace,
@ -160,8 +170,14 @@ TEST(hip, space_access) {
Kokkos::SpaceAccessibility<Kokkos::HostSpace,
Kokkos::HIPManagedSpace>::accessible);
#if !defined(KOKKOS_ENABLE_IMPL_HIP_UNIFIED_MEMORY)
static_assert(std::is_same<Kokkos::Impl::HostMirror<Kokkos::HIPSpace>::Space,
Kokkos::HostSpace>::value);
#else
static_assert(std::is_same<Kokkos::Impl::HostMirror<Kokkos::HIPSpace>::Space,
Kokkos::Device<Kokkos::HostSpace::execution_space,
Kokkos::HIPSpace>>::value);
#endif
static_assert(
std::is_same<Kokkos::Impl::HostMirror<Kokkos::HIPHostPinnedSpace>::Space,