Update Kokkos library in LAMMPS to v4.2

This commit is contained in:
Stan Gerald Moore
2023-11-21 15:02:12 -07:00
parent 33dcfb5390
commit 3306b95589
493 changed files with 41548 additions and 15629 deletions

View File

@ -145,6 +145,12 @@ Serial::Serial()
: m_space_instance(&Impl::SerialInternal::singleton(),
[](Impl::SerialInternal*) {}) {}
Serial::Serial(NewInstance)
: m_space_instance(new Impl::SerialInternal, [](Impl::SerialInternal* ptr) {
ptr->finalize();
delete ptr;
}) {}
void Serial::print_configuration(std::ostream& os, bool /*verbose*/) const {
os << "Host Serial Execution Space:\n";
os << " KOKKOS_ENABLE_SERIAL: yes\n";

View File

@ -72,6 +72,10 @@ class SerialInternal {
};
} // namespace Impl
struct NewInstance {
explicit NewInstance() = default;
};
/// \class Serial
/// \brief Kokkos device for non-parallel execution
///
@ -108,6 +112,8 @@ class Serial {
Serial();
Serial(NewInstance);
/// \brief True if and only if this method is being called in a
/// thread-parallel function.
///
@ -218,6 +224,38 @@ struct MemorySpaceAccess<Kokkos::Serial::memory_space,
} // namespace Impl
} // namespace Kokkos
namespace Kokkos::Experimental {
template <class... Args>
std::vector<Serial> partition_space(const Serial&, Args...) {
static_assert(
(... && std::is_arithmetic_v<Args>),
"Kokkos Error: partitioning arguments must be integers or floats");
std::vector<Serial> instances;
instances.reserve(sizeof...(Args));
std::generate_n(std::back_inserter(instances), sizeof...(Args),
[]() { return Serial{NewInstance{}}; });
return instances;
}
template <class T>
std::vector<Serial> partition_space(const Serial&,
std::vector<T> const& weights) {
static_assert(
std::is_arithmetic<T>::value,
"Kokkos Error: partitioning arguments must be integers or floats");
// We only care about the number of instances to create and ignore weights
// otherwise.
std::vector<Serial> instances;
instances.reserve(weights.size());
std::generate_n(std::back_inserter(instances), weights.size(),
[]() { return Serial{NewInstance{}}; });
return instances;
}
} // namespace Kokkos::Experimental
#include <Serial/Kokkos_Serial_Parallel_Range.hpp>
#include <Serial/Kokkos_Serial_Parallel_MDRange.hpp>
#include <Serial/Kokkos_Serial_Parallel_Team.hpp>