Update Kokkos library in LAMMPS to v3.3.0

This commit is contained in:
Stan Gerald Moore
2020-12-22 08:52:37 -07:00
parent b36363e0fb
commit eea14c55a9
927 changed files with 18603 additions and 46876 deletions

View File

@ -52,6 +52,24 @@
namespace Test {
void test_is_specialization_of() {
using Kokkos::Impl::is_specialization_of;
static_assert(is_specialization_of<Kokkos::pair<float, int>, Kokkos::pair>{},
"");
static_assert(!is_specialization_of<Kokkos::View<int*>, Kokkos::pair>{}, "");
static_assert(is_specialization_of<Kokkos::View<int*>, Kokkos::View>{}, "");
// NOTE Not removing cv-qualifiers
static_assert(!is_specialization_of<Kokkos::View<int*> const, Kokkos::View>{},
"");
// NOTE Would not compile because Kokkos::Array takes a non-type template
// parameter
// static_assert(is_specialization_of<Kokkos::Array<int, 4>, Kokkos::Array>{},
// "");
// But this is fine of course
static_assert(!is_specialization_of<Kokkos::Array<float, 2>, Kokkos::pair>{},
"");
}
inline void test_utilities() {
using namespace Kokkos::Impl;
@ -353,4 +371,22 @@ inline void test_utilities() {
}
}
template <std::size_t... Idxs, class... Args>
std::size_t do_comma_emulation_test(std::integer_sequence<std::size_t, Idxs...>,
Args... args) {
// Count the bugs, since ASSERT_EQ is a statement and not an expression
std::size_t bugs = 0;
// Ensure in-order evaluation
std::size_t i = 0;
KOKKOS_IMPL_FOLD_COMMA_OPERATOR(bugs += std::size_t(Idxs != i++) /*, ...*/);
// Ensure expansion of multiple packs works
KOKKOS_IMPL_FOLD_COMMA_OPERATOR(bugs += std::size_t(Idxs != args) /*, ...*/);
return bugs;
}
TEST(utilities, comma_operator_emulation) {
ASSERT_EQ(
0, do_comma_emulation_test(std::make_index_sequence<5>{}, 0, 1, 2, 3, 4));
}
} // namespace Test