Update Kokkos library in LAMMPS to v4.1.0

This commit is contained in:
Stan Gerald Moore
2023-06-29 10:42:42 -06:00
parent 170173a213
commit 330107b77b
480 changed files with 24051 additions and 23393 deletions

View File

@ -203,55 +203,6 @@ struct TestRange {
update += 1 + m_flags(i - offset);
}
//----------------------------------------
void test_scan() {
Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, ScheduleType>(0, N),
*this);
auto check_scan_results = [&]() {
auto const host_mirror =
Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), result_view);
for (int i = 0; i < N; ++i) {
if (((i + 1) * i) / 2 != host_mirror(i)) {
std::cout << "Error at " << i << std::endl;
EXPECT_EQ(size_t(((i + 1) * i) / 2), size_t(host_mirror(i)));
}
}
};
Kokkos::parallel_scan(
"TestKernelScan",
Kokkos::RangePolicy<ExecSpace, ScheduleType, OffsetTag>(0, N), *this);
check_scan_results();
value_type total = 0;
Kokkos::parallel_scan(
"TestKernelScanWithTotal",
Kokkos::RangePolicy<ExecSpace, ScheduleType, OffsetTag>(0, N), *this,
total);
check_scan_results();
ASSERT_EQ(size_t((N - 1) * (N) / 2), size_t(total)); // sum( 0 .. N-1 )
}
KOKKOS_INLINE_FUNCTION
void operator()(const OffsetTag &, const int i, value_type &update,
bool final) const {
update += m_flags(i);
if (final) {
if (update != (i * (i + 1)) / 2) {
KOKKOS_IMPL_DO_NOT_USE_PRINTF(
"TestRange::test_scan error (%d,%d) : %d != %d\n", i, m_flags(i),
(i * (i + 1)) / 2, update);
}
result_view(i) = update;
}
}
void test_dynamic_policy() {
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
auto const N_no_implicit_capture = N;
@ -404,49 +355,17 @@ TEST(TEST_CATEGORY, range_reduce) {
}
#ifndef KOKKOS_ENABLE_OPENMPTARGET
TEST(TEST_CATEGORY, range_scan) {
{
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> > f(0);
f.test_scan();
}
{
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> > f(0);
f.test_scan();
}
TEST(TEST_CATEGORY, range_dynamic_policy) {
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP) && \
!defined(KOKKOS_ENABLE_SYCL)
{
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> > f(0);
f.test_dynamic_policy();
}
#endif
{
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> > f(2);
f.test_scan();
}
{
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> > f(3);
f.test_scan();
}
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP) && \
!defined(KOKKOS_ENABLE_SYCL)
{
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> > f(3);
f.test_dynamic_policy();
}
#endif
{
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static> > f(1000);
f.test_scan();
}
{
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> > f(1001);
f.test_scan();
}
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP) && \
!defined(KOKKOS_ENABLE_SYCL)
{
TestRange<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Dynamic> > f(1001);
f.test_dynamic_policy();
@ -454,4 +373,5 @@ TEST(TEST_CATEGORY, range_scan) {
#endif
}
#endif
} // namespace Test