Update Kokkos library in LAMMPS to v3.2

This commit is contained in:
Stan Moore
2020-08-25 20:21:48 -06:00
parent 450fd12d31
commit 4d90c2b74b
1410 changed files with 19364 additions and 71953 deletions

View File

@ -51,14 +51,14 @@
// which means "column major," the same as in Fortran, the BLAS, or
// LAPACK. right_type has "layout right," which means "row major,"
// the same as in C, C++, or Java.
typedef Kokkos::View<double**, Kokkos::LayoutLeft> left_type;
typedef Kokkos::View<double**, Kokkos::LayoutRight> right_type;
using left_type = Kokkos::View<double**, Kokkos::LayoutLeft>;
using right_type = Kokkos::View<double**, Kokkos::LayoutRight>;
// This is a one-dimensional View, so the layout matters less.
// However, it still has a layout! Since its layout is not specified
// explicitly in the type, its layout is a function of the memory
// space. For example, the default Cuda layout is LayoutLeft, and the
// default Host layout is LayoutRight.
typedef Kokkos::View<double*> view_type;
using view_type = Kokkos::View<double*>;
// parallel_for functor that fills the given View with some data. It
// expects to access the View by rows in parallel: each call i of
@ -114,7 +114,7 @@ struct contraction {
struct dot {
view_type a;
dot(view_type a_) : a(a_) {}
typedef double value_type; // Specify type for reduction target, lsum
using value_type = double; // Specify type for reduction target, lsum
KOKKOS_INLINE_FUNCTION
void operator()(const view_type::size_type i, double& lsum) const {
lsum += a(i) * a(i);

View File

@ -47,7 +47,7 @@
#include <cstdio>
#include <cstdlib>
typedef Kokkos::View<double*> view_type;
using view_type = Kokkos::View<double*>;
// Kokkos::Views have an MemoryTraits template parameter which
// allows users to specify usage scenarios of a View.
// Some of those act simply as hints, which can be used to insert
@ -71,10 +71,10 @@ typedef Kokkos::View<double*> view_type;
// data (i.e. const double* and double*). While these pointers can point to the
// same data you should not use them together if that brakes the const guarantee
// of the first pointer.
typedef Kokkos::View<const double*, Kokkos::MemoryTraits<Kokkos::RandomAccess> >
view_type_rnd;
typedef Kokkos::View<int**> idx_type;
typedef idx_type::HostMirror idx_type_host;
using view_type_rnd =
Kokkos::View<const double*, Kokkos::MemoryTraits<Kokkos::RandomAccess> >;
using idx_type = Kokkos::View<int**>;
using idx_type_host = idx_type::HostMirror;
// We template this functor on the ViewTypes to show the effect of the
// RandomAccess trait.

View File

@ -52,7 +52,7 @@
#include <impl/Kokkos_Timer.hpp>
#include <cstdio>
typedef Kokkos::View<double***, Kokkos::LayoutRight> mesh_type;
using mesh_type = Kokkos::View<double***, Kokkos::LayoutRight>;
// These View types represent subviews of the mesh. Some of the Views
// have layout LayoutStride, meaning that they have run-time "strides"
@ -63,10 +63,10 @@ typedef Kokkos::View<double***, Kokkos::LayoutRight> mesh_type;
// may safely always use a LayoutStride layout when taking a subview
// of a LayoutRight or LayoutLeft subview, but strided accesses may
// cost a bit more, especially for 1-D Views.
typedef Kokkos::View<double**, Kokkos::LayoutStride> xz_plane_type;
typedef Kokkos::View<double**, Kokkos::LayoutRight> yz_plane_type;
typedef Kokkos::View<double**, Kokkos::LayoutStride> xy_plane_type;
typedef Kokkos::View<double***, Kokkos::LayoutStride> inner_mesh_type;
using xz_plane_type = Kokkos::View<double**, Kokkos::LayoutStride>;
using yz_plane_type = Kokkos::View<double**, Kokkos::LayoutRight>;
using xy_plane_type = Kokkos::View<double**, Kokkos::LayoutStride>;
using inner_mesh_type = Kokkos::View<double***, Kokkos::LayoutStride>;
// Functor to set all entries of a boundary of the mesh to a constant
// value. The functor is templated on ViewType because different
@ -98,7 +98,7 @@ struct set_inner {
KOKKOS_INLINE_FUNCTION
void operator()(const typename ViewType::size_type i) const {
typedef typename ViewType::size_type size_type;
using size_type = typename ViewType::size_type;
for (size_type j = 0; j < a.extent(1); ++j) {
for (size_type k = 0; k < a.extent(2); ++k) {
a(i, j, k) = value;
@ -118,7 +118,7 @@ struct update {
KOKKOS_INLINE_FUNCTION
void operator()(typename ViewType::size_type i) const {
typedef typename ViewType::size_type size_type;
using size_type = typename ViewType::size_type;
i++;
for (size_type j = 1; j < a.extent(1) - 1; j++) {
for (size_type k = 1; k < a.extent(2) - 1; k++) {
@ -134,7 +134,7 @@ int main(int narg, char* arg[]) {
using Kokkos::pair;
using Kokkos::parallel_for;
using Kokkos::subview;
typedef mesh_type::size_type size_type;
using size_type = mesh_type::size_type;
Kokkos::initialize(narg, arg);

View File

@ -66,30 +66,30 @@
// operations to help you manage memory take almost no time in that
// case. This makes your code even more performance portable.
typedef Kokkos::DualView<double*> view_type;
typedef Kokkos::DualView<int**> idx_type;
using view_type = Kokkos::DualView<double*>;
using idx_type = Kokkos::DualView<int**>;
template <class ExecutionSpace>
struct localsum {
// If the functor has a public 'execution_space' typedef, that defines
// If the functor has a public 'execution_space' alias, that defines
// the functor's execution space (where it runs in parallel). This
// overrides Kokkos' default execution space.
typedef ExecutionSpace execution_space;
using execution_space = ExecutionSpace;
typedef typename Kokkos::Impl::if_c<
using memory_space = typename Kokkos::Impl::if_c<
std::is_same<ExecutionSpace, Kokkos::DefaultExecutionSpace>::value,
idx_type::memory_space, idx_type::host_mirror_space>::type memory_space;
idx_type::memory_space, idx_type::host_mirror_space>::type;
// Get the view types on the particular device for which the functor
// is instantiated.
//
// "const_data_type" is a typedef in View (and DualView) which is
// "const_data_type" is an alias in View (and DualView) which is
// the const version of the first template parameter of the View.
// For example, the const_data_type version of double** is const
// double**.
Kokkos::View<idx_type::const_data_type, idx_type::array_layout, memory_space>
idx;
// "scalar_array_type" is a typedef in ViewTraits (and DualView) which is the
// "scalar_array_type" is an alias in ViewTraits (and DualView) which is the
// array version of the value(s) stored in the View.
Kokkos::View<view_type::scalar_array_type, view_type::array_layout,
memory_space>
@ -150,7 +150,7 @@ class ParticleType {
protected:
};
typedef Kokkos::DualView<ParticleType[10]> ParticleTypes;
using ParticleTypes = Kokkos::DualView<ParticleType[10]>;
int main(int narg, char* arg[]) {
Kokkos::initialize(narg, arg);

View File

@ -49,18 +49,18 @@
#include <cstdlib>
#ifdef KOKKOS_ENABLE_CUDA
typedef Kokkos::View<double*, Kokkos::CudaUVMSpace> view_type;
typedef Kokkos::View<int**, Kokkos::CudaUVMSpace> idx_type;
using view_type = Kokkos::View<double*, Kokkos::CudaUVMSpace>;
using idx_type = Kokkos::View<int**, Kokkos::CudaUVMSpace>;
#else
typedef Kokkos::View<double*, Kokkos::HostSpace> view_type;
typedef Kokkos::View<int**, Kokkos::HostSpace> idx_type;
using view_type = Kokkos::View<double*, Kokkos::HostSpace>;
using idx_type = Kokkos::View<int**, Kokkos::HostSpace>;
#endif
template <class Device>
struct localsum {
// Define the execution space for the functor (overrides the
// DefaultExecutionSpace)
typedef Device execution_space;
using execution_space = Device;
// Get the view types on the particular device the functor is instantiated for
idx_type::const_type idx;

View File

@ -106,7 +106,7 @@ struct MergeDevice {
int main(int argc, char* argv[]) {
int size = 100000000;
Kokkos::initialize();
int synch = atoi(argv[1]);
int synch = std::stoi(argv[1]);
Kokkos::View<double*, Kokkos::LayoutLeft, Kokkos::CudaSpace> d_a("Device A",
size);
Kokkos::View<double*, Kokkos::LayoutLeft, Kokkos::CudaSpace> d_b("Device B",