Update Kokkos library in LAMMPS to v3.1
This commit is contained in:
@ -84,8 +84,9 @@ struct TestComplexConstruction {
|
||||
ASSERT_FLOAT_EQ(h_results(8).real(), double(8));
|
||||
ASSERT_FLOAT_EQ(h_results(8).imag(), 0.0);
|
||||
|
||||
#ifndef KOKKOS_ENABLE_ROCM // Copy construction conversion between
|
||||
// Kokkos::complex and std::complex doesn't compile
|
||||
// Copy construction conversion between
|
||||
// Kokkos::complex and std::complex doesn't compile
|
||||
#ifndef KOKKOS_ENABLE_HIP // FIXME_HIP
|
||||
Kokkos::complex<double> a(1.5, 2.5), b(3.25, 5.25), r_kk;
|
||||
std::complex<double> sa(a), sb(3.25, 5.25), r;
|
||||
r = a;
|
||||
@ -104,7 +105,7 @@ struct TestComplexConstruction {
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(const int &i) const {
|
||||
void operator()(const int & /*i*/) const {
|
||||
Kokkos::complex<double> a(1.5, 2.5);
|
||||
d_results(0) = a;
|
||||
Kokkos::complex<double> b(a);
|
||||
@ -164,8 +165,10 @@ struct TestComplexBasicMath {
|
||||
ASSERT_FLOAT_EQ(h_results(2).real(), r.real());
|
||||
ASSERT_FLOAT_EQ(h_results(2).imag(), r.imag());
|
||||
r = a / b;
|
||||
#ifndef KOKKOS_WORKAROUND_OPENMPTARGET_CLANG
|
||||
ASSERT_FLOAT_EQ(h_results(3).real(), r.real());
|
||||
ASSERT_FLOAT_EQ(h_results(3).imag(), r.imag());
|
||||
#endif
|
||||
r = d + a;
|
||||
ASSERT_FLOAT_EQ(h_results(4).real(), r.real());
|
||||
ASSERT_FLOAT_EQ(h_results(4).imag(), r.imag());
|
||||
@ -212,8 +215,10 @@ struct TestComplexBasicMath {
|
||||
ASSERT_FLOAT_EQ(h_results(18).real(), r.real());
|
||||
ASSERT_FLOAT_EQ(h_results(18).imag(), r.imag());
|
||||
r = c / a;
|
||||
#ifndef KOKKOS_WORKAROUND_OPENMPTARGET_CLANG
|
||||
ASSERT_FLOAT_EQ(h_results(19).real(), r.real());
|
||||
ASSERT_FLOAT_EQ(h_results(19).imag(), r.imag());
|
||||
#endif
|
||||
|
||||
r = a;
|
||||
/* r = a+e; */ ASSERT_FLOAT_EQ(h_results(20).real(), r.real() + e);
|
||||
@ -227,7 +232,7 @@ struct TestComplexBasicMath {
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(const int &i) const {
|
||||
void operator()(const int & /*i*/) const {
|
||||
Kokkos::complex<double> a(1.5, 2.5);
|
||||
Kokkos::complex<double> b(3.25, 5.75);
|
||||
// Basic math complex / complex
|
||||
@ -320,7 +325,7 @@ struct TestComplexSpecialFunctions {
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(const int &i) const {
|
||||
void operator()(const int & /*i*/) const {
|
||||
Kokkos::complex<double> a(1.5, 2.5);
|
||||
Kokkos::complex<double> b(3.25, 5.75);
|
||||
double c = 9.3;
|
||||
@ -356,4 +361,41 @@ TEST(TEST_CATEGORY, complex_special_funtions) {
|
||||
|
||||
TEST(TEST_CATEGORY, complex_io) { testComplexIO(); }
|
||||
|
||||
TEST(TEST_CATEGORY, complex_trivially_copyable) {
|
||||
using RealType = double;
|
||||
|
||||
// Kokkos::complex<RealType> is trivially copyable when RealType is
|
||||
// trivially copyable
|
||||
// Simply disable the check for IBM's XL compiler since we can't reliably
|
||||
// check for a version that defines relevant functions.
|
||||
#if !defined(__ibmxl__)
|
||||
// clang claims compatibility with gcc 4.2.1 but all versions tested know
|
||||
// about std::is_trivially_copyable.
|
||||
#if !defined(__clang__)
|
||||
#define KOKKOS_COMPILER_GNU_VERSION \
|
||||
__GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__
|
||||
#endif
|
||||
#if KOKKOS_COMPILER_GNU_VERSION == 0 || KOKKOS_COMPILER_GNU_VERSION > 500
|
||||
ASSERT_TRUE(std::is_trivially_copyable<Kokkos::complex<RealType>>::value ||
|
||||
!std::is_trivially_copyable<RealType>::value);
|
||||
#elif KOKKOS_COMPILER_GNU_VERSION > 480
|
||||
ASSERT_TRUE(
|
||||
(std::has_trivial_copy_constructor<Kokkos::complex<RealType>>::value &&
|
||||
std::has_trivial_copy_assign<Kokkos::complex<RealType>>::value &&
|
||||
std::is_trivially_destructible<Kokkos::complex<RealType>>::value) ||
|
||||
!(std::has_trivial_copy_constructor<RealType>::value &&
|
||||
std::has_trivial_copy_assign<RealType>::value &&
|
||||
std::is_trivially_destructible<RealType>::value));
|
||||
#else
|
||||
ASSERT_TRUE(
|
||||
(std::has_trivial_copy_constructor<Kokkos::complex<RealType>>::value &&
|
||||
std::has_trivial_copy_assign<Kokkos::complex<RealType>>::value &&
|
||||
std::has_trivial_destructor<Kokkos::complex<RealType>>::value) ||
|
||||
!(std::has_trivial_copy_constructor<RealType>::value &&
|
||||
std::has_trivial_copy_assign<RealType>::value &&
|
||||
std::has_trivial_destructor<RealType>::value));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace Test
|
||||
|
||||
Reference in New Issue
Block a user