Update Kokkos library in LAMMPS to v4.5.0

This commit is contained in:
Stan Moore
2024-12-13 09:23:03 -07:00
parent a78aee5731
commit 7f68aeb6d5
617 changed files with 21499 additions and 17255 deletions

View File

@ -63,9 +63,13 @@ struct TestIncrExecSpace {
ASSERT_GT(concurrency, 0);
#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS
KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_PUSH()
#endif
int in_parallel = ExecSpace::in_parallel();
#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS
KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_POP()
#endif
ASSERT_FALSE(in_parallel);
#endif

View File

@ -131,7 +131,7 @@ struct TestParallel_For {
};
TEST(TEST_CATEGORY, IncrTest_04_simple_parallelFor) {
if (std::is_same<Kokkos::DefaultExecutionSpace, TEST_EXECSPACE>::value) {
if (std::is_same_v<Kokkos::DefaultExecutionSpace, TEST_EXECSPACE>) {
TestParallel_For<TEST_EXECSPACE> test;
test.simple_test();
}

View File

@ -43,10 +43,10 @@ struct NonTrivialReduceFunctor {
UpdateSum += (i + 1) * value;
}
NonTrivialReduceFunctor() = default;
NonTrivialReduceFunctor(NonTrivialReduceFunctor const &) = default;
NonTrivialReduceFunctor(NonTrivialReduceFunctor &&) = default;
NonTrivialReduceFunctor &operator=(NonTrivialReduceFunctor &&) = default;
NonTrivialReduceFunctor() = default;
NonTrivialReduceFunctor(NonTrivialReduceFunctor const &) = default;
NonTrivialReduceFunctor(NonTrivialReduceFunctor &&) = default;
NonTrivialReduceFunctor &operator=(NonTrivialReduceFunctor &&) = default;
NonTrivialReduceFunctor &operator=(NonTrivialReduceFunctor const &) = default;
// Also make sure that it's OK if the destructor is not device-callable.
~NonTrivialReduceFunctor() {}

View File

@ -56,8 +56,8 @@ struct HierarchicalBasics {
Kokkos::fence();
auto h_v = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), v);
size_t check = 0;
size_t ref = nP * nT;
int check = 0;
int ref = nP * nT;
for (int i = 0; i < nP; ++i)
for (int j = 0; j < nT; ++j) check += h_v(i, j);

View File

@ -54,7 +54,7 @@ struct Hierarchical_ForLoop_A {
auto v_H = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), v);
long long int check = 0;
const long long int s = sY * sX;
const long long int s = static_cast<long long int>(sY) * sX;
for (int i = 0; i < sX; ++i)
for (int j = 0; j < sY; ++j) check += v_H(i, j);
ASSERT_EQ(check, s * (s - 1) / 2);

View File

@ -54,7 +54,7 @@ struct Hierarchical_ForLoop_B {
auto v_H = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), v);
long long int check = 0;
const long long int s = sY * sX;
const long long int s = static_cast<long long int>(sY) * sX;
for (int i = 0; i < sX; ++i)
for (int j = 0; j < sY; ++j) check += v_H(i, j);
ASSERT_EQ(check, s * (s - 1) / 2);

View File

@ -59,7 +59,7 @@ struct Hierarchical_ForLoop_C {
auto v_H = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), v);
size_t check = 0;
const size_t s = sX * sY * sZ;
const size_t s = static_cast<size_t>(sX) * sY * sZ;
for (int i = 0; i < sX; ++i)
for (int j = 0; j < sY; ++j)
for (int k = 0; k < sZ; ++k) check += v_H(i, j, k);

View File

@ -75,7 +75,8 @@ struct ThreadScratch {
.set_scratch_size(scratch_level, Kokkos::PerThread(scratchSize));
int max_team_size = policy.team_size_max(*this, Kokkos::ParallelForTag());
v = data_t("Matrix", pN, max_team_size);
ASSERT_GT(max_team_size, 0);
v = data_t("Matrix", pN, max_team_size);
Kokkos::parallel_for(
"Test12a_ThreadScratch",
@ -87,7 +88,7 @@ struct ThreadScratch {
auto v_H = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), v);
size_t check = 0;
const size_t s = pN * sX * sY;
const size_t s = static_cast<size_t>(pN) * sX * sY;
for (int n = 0; n < pN; ++n)
for (int m = 0; m < max_team_size; ++m) {
check += v_H(n, m);
@ -96,12 +97,14 @@ struct ThreadScratch {
}
};
KOKKOS_IMPL_DISABLE_UNREACHABLE_WARNINGS_PUSH()
TEST(TEST_CATEGORY, IncrTest_12a_ThreadScratch) {
ThreadScratch<TEST_EXECSPACE> test;
#ifdef KOKKOS_ENABLE_OPENACC // FIXME_OPENACC
GTEST_SKIP() << "skipping since scratch memory is not yet implemented in the "
"OpenACC backend";
#endif
ThreadScratch<TEST_EXECSPACE> test;
// FIXME_OPENMPTARGET - team_size has to be a multiple of 32 for the tests to
// pass in the Release and RelWithDebInfo builds. Does not need the team_size
// to be a multiple of 32 for the Debug builds.
@ -115,5 +118,6 @@ TEST(TEST_CATEGORY, IncrTest_12a_ThreadScratch) {
test.run(14, 277, 321);
#endif
}
KOKKOS_IMPL_DISABLE_UNREACHABLE_WARNINGS_POP()
} // namespace Test

View File

@ -79,19 +79,21 @@ struct TeamScratch {
auto v_H = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), v);
size_t check = 0;
const size_t s = pN * sX * sY;
const size_t s = static_cast<size_t>(pN) * sX * sY;
for (int n = 0; n < pN; ++n)
for (int m = 0; m < sX; ++m) check += v_H(n, m);
ASSERT_EQ(check, s * (s - 1) / 2);
}
};
KOKKOS_IMPL_DISABLE_UNREACHABLE_WARNINGS_PUSH()
TEST(TEST_CATEGORY, IncrTest_12b_TeamScratch) {
TeamScratch<TEST_EXECSPACE> test;
#ifdef KOKKOS_ENABLE_OPENACC // FIXME_OPENACC
GTEST_SKIP() << "skipping since scratch memory is not yet implemented in the "
"OpenACC backend";
#endif
TeamScratch<TEST_EXECSPACE> test;
// FIXME_OPENMPTARGET - team_size has to be a multiple of 32 for the tests to
// pass in the Release and RelWithDebInfo builds. Does not need the team_size
// to be a multiple of 32 for the Debug builds.
@ -105,5 +107,6 @@ TEST(TEST_CATEGORY, IncrTest_12b_TeamScratch) {
test.run(14, 277, 321);
#endif
}
KOKKOS_IMPL_DISABLE_UNREACHABLE_WARNINGS_POP()
} // namespace Test

View File

@ -48,7 +48,7 @@ struct Hierarchical_Red_C {
Kokkos::parallel_reduce(
Kokkos::ThreadVectorRange(team, sY),
[=](const int k, int &tmp_inner) {
tmp_inner += n * sX * v.extent(0) + sX * i + k;
tmp_inner += n * sX * v.extent_int(0) + sX * i + k;
},
out_inner);

View File

@ -53,9 +53,9 @@ struct NonTrivialScanFunctor {
NonTrivialScanFunctor(const Kokkos::View<value_type *, ExecSpace> &data)
: d_data(data) {}
NonTrivialScanFunctor(NonTrivialScanFunctor const &) = default;
NonTrivialScanFunctor(NonTrivialScanFunctor &&) = default;
NonTrivialScanFunctor &operator=(NonTrivialScanFunctor &&) = default;
NonTrivialScanFunctor(NonTrivialScanFunctor const &) = default;
NonTrivialScanFunctor(NonTrivialScanFunctor &&) = default;
NonTrivialScanFunctor &operator=(NonTrivialScanFunctor &&) = default;
NonTrivialScanFunctor &operator=(NonTrivialScanFunctor const &) = default;
// Also make sure that it's OK if the destructor is not device-callable.
~NonTrivialScanFunctor() {}