Update Kokkos library in LAMMPS to v4.4.0

This commit is contained in:
Stan Moore
2024-09-11 09:20:36 -06:00
parent 16b19c71c1
commit a44955dd2e
254 changed files with 14227 additions and 9881 deletions

View File

@ -103,34 +103,35 @@ inline void host_check_shift_op_all_loaders(ShiftOp shift_op,
template <typename Abi, typename DataType>
inline void host_check_shift_ops() {
if constexpr (std::is_integral_v<DataType>) {
using simd_type = Kokkos::Experimental::simd<DataType, Abi>;
constexpr std::size_t width = simd_type::size();
constexpr std::size_t num_cases = 8;
constexpr size_t alignment =
Kokkos::Experimental::simd<DataType, Abi>::size() * sizeof(DataType);
if constexpr (is_type_v<Kokkos::Experimental::simd<DataType, Abi>>) {
if constexpr (std::is_integral_v<DataType>) {
using simd_type = Kokkos::Experimental::simd<DataType, Abi>;
constexpr std::size_t width = simd_type::size();
constexpr std::size_t num_cases = 16;
constexpr size_t alignment =
Kokkos::Experimental::simd<DataType, Abi>::size() * sizeof(DataType);
DataType max = std::numeric_limits<DataType>::max();
DataType max = std::numeric_limits<DataType>::max();
alignas(alignment) DataType shift_by[num_cases] = {
0, 1, 3, width / 2, width / 2 + 1, width - 1, width, width + 1};
alignas(alignment) DataType test_vals[width];
for (std::size_t i = 0; i < width; ++i) {
DataType inc = max / width;
test_vals[i] = i * inc + 1;
}
alignas(alignment) DataType shift_by[num_cases] = {
0, 1, 3, width / 2, width / 2 + 1, width - 1, width, width + 1,
0, 1, 3, width / 2, width / 2 + 1, width - 1, width, width + 1};
alignas(alignment) DataType test_vals[width];
for (std::size_t i = 0; i < width; ++i) {
DataType inc = max / width;
test_vals[i] = i * inc + 1;
}
host_check_shift_op_all_loaders<Abi>(shift_right(), test_vals, shift_by,
num_cases);
host_check_shift_op_all_loaders<Abi>(shift_left(), test_vals, shift_by,
num_cases);
if constexpr (std::is_signed_v<DataType>) {
for (std::size_t i = 0; i < width; ++i) test_vals[i] *= -1;
host_check_shift_op_all_loaders<Abi>(shift_right(), test_vals, shift_by,
num_cases);
host_check_shift_op_all_loaders<Abi>(shift_left(), test_vals, shift_by,
num_cases);
if constexpr (std::is_signed_v<DataType>) {
for (std::size_t i = 0; i < width; ++i) test_vals[i] *= -1;
host_check_shift_op_all_loaders<Abi>(shift_right(), test_vals, shift_by,
num_cases);
}
}
}
}
@ -224,33 +225,34 @@ KOKKOS_INLINE_FUNCTION void device_check_shift_op_all_loaders(
template <typename Abi, typename DataType>
KOKKOS_INLINE_FUNCTION void device_check_shift_ops() {
if constexpr (std::is_integral_v<DataType>) {
using simd_type = Kokkos::Experimental::simd<DataType, Abi>;
constexpr std::size_t width = simd_type::size();
constexpr std::size_t num_cases = 8;
if constexpr (is_type_v<Kokkos::Experimental::simd<DataType, Abi>>) {
if constexpr (std::is_integral_v<DataType>) {
using simd_type = Kokkos::Experimental::simd<DataType, Abi>;
constexpr std::size_t width = simd_type::size();
constexpr std::size_t num_cases = 16;
DataType max = Kokkos::reduction_identity<DataType>::max();
DataType max = Kokkos::reduction_identity<DataType>::max();
DataType shift_by[num_cases] = {
0, 1, 3, width / 2, width / 2 + 1, width - 1, width, width + 1};
DataType test_vals[width];
DataType shift_by[num_cases] = {
0, 1, 3, width / 2, width / 2 + 1, width - 1, width, width + 1,
0, 1, 3, width / 2, width / 2 + 1, width - 1, width, width + 1};
DataType test_vals[width];
for (std::size_t i = 0; i < width; ++i) {
DataType inc = max / width;
test_vals[i] = i * inc + 1;
}
for (std::size_t i = 0; i < width; ++i) {
DataType inc = max / width;
test_vals[i] = i * inc + 1;
}
device_check_shift_op_all_loaders<Abi>(shift_right(), test_vals, shift_by,
num_cases);
device_check_shift_op_all_loaders<Abi>(shift_left(), test_vals, shift_by,
num_cases);
if constexpr (std::is_signed_v<DataType>) {
for (std::size_t i = 0; i < width; ++i) test_vals[i] *= -1;
device_check_shift_op_all_loaders<Abi>(shift_right(), test_vals, shift_by,
num_cases);
device_check_shift_op_all_loaders<Abi>(shift_left(), test_vals, shift_by,
num_cases);
if constexpr (std::is_signed_v<DataType>) {
for (std::size_t i = 0; i < width; ++i) test_vals[i] *= -1;
device_check_shift_op_all_loaders<Abi>(shift_right(), test_vals,
shift_by, num_cases);
}
}
}
}