Update Kokkos library in LAMMPS to v4.2
This commit is contained in:
@ -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";
|
||||
|
||||
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user