44#ifndef TPETRA_KOKKOS_REFACTOR_DETAILS_MULTI_VECTOR_DIST_OBJECT_KERNELS_MP_VECTOR_HPP
45#define TPETRA_KOKKOS_REFACTOR_DETAILS_MULTI_VECTOR_DIST_OBJECT_KERNELS_MP_VECTOR_HPP
51#include "Tpetra_KokkosRefactor_Details_MultiVectorDistObjectKernels.hpp"
62 template <
typename DstView,
typename SrcView,
typename IdxView>
64 DstView, SrcView, IdxView,
65 typename
std::enable_if< Kokkos::is_view_mp_vector<DstView>::value &&
66 Kokkos::is_view_mp_vector<SrcView>::value >::type >
69 typedef typename execution_space::size_type
size_type;
82 KOKKOS_INLINE_FUNCTION
87 KOKKOS_INLINE_FUNCTION
89 dst(k).fastAccessCoeff(tidx) =
src(
idx(k),
col).fastAccessCoeff(tidx);
104 template <
typename DstView,
typename SrcView,
typename IdxView>
106 DstView, SrcView, IdxView,
107 typename
std::enable_if< Kokkos::is_view_mp_vector<DstView>::value &&
108 Kokkos::is_view_mp_vector<SrcView>::value >::type >
124 KOKKOS_INLINE_FUNCTION
126 const typename IdxView::value_type localRow =
idx(k);
127 const size_t offset = k*
numCols;
132 KOKKOS_INLINE_FUNCTION
134 const typename IdxView::value_type localRow =
idx(k);
135 const size_t offset = k*
numCols;
137 dst(offset +
j).fastAccessCoeff(tidx) =
138 src(localRow,
j).fastAccessCoeff(tidx);
146 Kokkos::parallel_for(
152 template <
typename DstView,
typename SrcView,
typename IdxView,
155 DstView, SrcView, IdxView, ColView,
156 typename
std::enable_if< Kokkos::is_view_mp_vector<DstView>::value &&
157 Kokkos::is_view_mp_vector<SrcView>::value >::type >
175 KOKKOS_INLINE_FUNCTION
177 const typename IdxView::value_type localRow =
idx(k);
178 const size_t offset = k*
numCols;
183 KOKKOS_INLINE_FUNCTION
185 const typename IdxView::value_type localRow =
idx(k);
186 const size_t offset = k*
numCols;
188 dst(offset +
j).fastAccessCoeff(tidx) =
189 src(localRow,
col(
j)).fastAccessCoeff(tidx);
198 Kokkos::parallel_for(
205 template <
typename ExecutionSpace,
211 ExecutionSpace, DstView, SrcView, IdxView, Op,
212 typename
std::enable_if< Kokkos::is_view_mp_vector<DstView>::value &&
213 Kokkos::is_view_mp_vector<SrcView>::value >::type >
229 const size_t numCols_) :
237 template <
class TagType>
238 KOKKOS_INLINE_FUNCTION
void
241 const typename IdxView::value_type localRow =
idx(k);
242 const size_t offset = k*
numCols;
248 template <
class TagType>
249 KOKKOS_INLINE_FUNCTION
void
252 const typename IdxView::value_type localRow =
idx(k);
253 const size_t offset = k*
numCols;
267 const bool use_atomic_updates)
269 if (use_atomic_updates) {
271 (
"Tpetra::MultiVector (Sacado::MP::Vector) unpack (constant stride)",
278 (
"Tpetra::MultiVector (Sacado::MP::Vector) unpack (constant stride)",
286 template <
typename ExecutionSpace,
293 ExecutionSpace, DstView, SrcView, IdxView, ColView, Op,
294 typename
std::enable_if< Kokkos::is_view_mp_vector<DstView>::value &&
295 Kokkos::is_view_mp_vector<SrcView>::value >::type >
313 const size_t numCols_) :
322 template <
class TagType>
323 KOKKOS_INLINE_FUNCTION
void
326 const typename IdxView::value_type localRow =
idx(k);
327 const size_t offset = k*
numCols;
333 template <
class TagType>
334 KOKKOS_INLINE_FUNCTION
void
337 const typename IdxView::value_type localRow =
idx(k);
338 const size_t offset = k*
numCols;
353 const bool use_atomic_updates)
355 if (use_atomic_updates) {
357 (
"Tpetra::MultiVector unpack (Sacado::MP::Vector) (nonconstant stride)",
364 (
"Tpetra::MultiVector unpack (Sacado::MP::Vector) (nonconstant stride)",
372 template <
typename DstView,
typename SrcView,
373 typename DstIdxView,
typename SrcIdxView,
typename Op>
375 DstView, SrcView, DstIdxView, SrcIdxView, Op,
376 typename
std::enable_if< Kokkos::is_view_mp_vector<DstView>::value &&
377 Kokkos::is_view_mp_vector<SrcView>::value >::type >
391 const DstIdxView& dst_idx_,
392 const SrcIdxView& src_idx_,
393 size_t numCols_,
const Op& op_) :
397 KOKKOS_INLINE_FUNCTION
399 const typename DstIdxView::value_type toRow =
dst_idx(k);
400 const typename SrcIdxView::value_type fromRow =
src_idx(k);
406 KOKKOS_INLINE_FUNCTION
408 const typename DstIdxView::value_type toRow =
dst_idx(k);
409 const typename SrcIdxView::value_type fromRow =
src_idx(k);
416 template <
typename ExecutionSpace>
417 static void permute(
const ExecutionSpace &space,
425 Kokkos::parallel_for(
432 template <
typename DstView,
typename SrcView,
433 typename DstIdxView,
typename SrcIdxView,
434 typename DstColView,
typename SrcColView,
typename Op>
436 DstView, SrcView, DstIdxView, SrcIdxView, DstColView, SrcColView, Op,
437 typename
std::enable_if< Kokkos::is_view_mp_vector<DstView>::value &&
438 Kokkos::is_view_mp_vector<SrcView>::value >::type >
454 const DstIdxView& dst_idx_,
455 const SrcIdxView& src_idx_,
456 const DstColView& dst_col_,
457 const SrcColView& src_col_,
464 KOKKOS_INLINE_FUNCTION
466 const typename DstIdxView::value_type toRow =
dst_idx(k);
467 const typename SrcIdxView::value_type fromRow =
src_idx(k);
473 KOKKOS_INLINE_FUNCTION
475 const typename DstIdxView::value_type toRow =
dst_idx(k);
476 const typename SrcIdxView::value_type fromRow =
src_idx(k);
483 template <
typename ExecutionSpace>
484 static void permute(
const ExecutionSpace &space,
494 Kokkos::parallel_for(
expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 c fastAccessCoeff(j) - expr2.val(j)
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< is_view_uq_pce< View< T, P... > >::value, unsigned >::type dimension_scalar(const View< T, P... > &view)
Team-based parallel work configuration for Sacado::MP::Vector.
DstView::execution_space execution_space
PackArrayMultiColumnVariableStride(const DstView &dst_, const SrcView &src_, const IdxView &idx_, const ColView &col_, size_t numCols_)
KOKKOS_INLINE_FUNCTION void operator()(const size_type k) const
KOKKOS_INLINE_FUNCTION void operator()(const size_type k, const size_type tidx) const
static void pack(const DstView &dst, const SrcView &src, const IdxView &idx, const ColView &col, size_t numCols, const execution_space &space)
execution_space::size_type size_type
PackArrayMultiColumn(const DstView &dst_, const SrcView &src_, const IdxView &idx_, size_t numCols_)
KOKKOS_INLINE_FUNCTION void operator()(const size_type k, const size_type tidx) const
execution_space::size_type size_type
static void pack(const DstView &dst, const SrcView &src, const IdxView &idx, size_t numCols, const execution_space &space)
KOKKOS_INLINE_FUNCTION void operator()(const size_type k) const
DstView::execution_space execution_space
PackArraySingleColumn(const DstView &dst_, const SrcView &src_, const IdxView &idx_, size_t col_)
KOKKOS_INLINE_FUNCTION void operator()(const size_type k) const
KOKKOS_INLINE_FUNCTION void operator()(const size_type k, const size_type tidx) const
static void pack(const DstView &dst, const SrcView &src, const IdxView &idx, size_t col, const execution_space &space)
execution_space::size_type size_type
DstView::execution_space execution_space
execution_space::size_type size_type
static void permute(const ExecutionSpace &space, const DstView &dst, const SrcView &src, const DstIdxView &dst_idx, const SrcIdxView &src_idx, const DstColView &dst_col, const SrcColView &src_col, size_t numCols, const Op &op)
KOKKOS_INLINE_FUNCTION void operator()(const size_type k, const size_type tidx) const
DstView::execution_space execution_space
PermuteArrayMultiColumnVariableStride(const DstView &dst_, const SrcView &src_, const DstIdxView &dst_idx_, const SrcIdxView &src_idx_, const DstColView &dst_col_, const SrcColView &src_col_, size_t numCols_, const Op &op_)
KOKKOS_INLINE_FUNCTION void operator()(const size_type k) const
execution_space::size_type size_type
PermuteArrayMultiColumn(const DstView &dst_, const SrcView &src_, const DstIdxView &dst_idx_, const SrcIdxView &src_idx_, size_t numCols_, const Op &op_)
KOKKOS_INLINE_FUNCTION void operator()(const size_type k, const size_type tidx) const
static void permute(const ExecutionSpace &space, const DstView &dst, const SrcView &src, const DstIdxView &dst_idx, const SrcIdxView &src_idx, size_t numCols, const Op &op)
KOKKOS_INLINE_FUNCTION void operator()(const size_type k) const
DstView::execution_space execution_space
UnpackArrayMultiColumnVariableStride(const ExecutionSpace &, const DstView &dst_, const SrcView &src_, const IdxView &idx_, const ColView &col_, const Op &op_, const size_t numCols_)
static void unpack(const ExecutionSpace &execSpace, const DstView &dst, const SrcView &src, const IdxView &idx, const ColView &col, const Op &op, const size_t numCols, const bool use_atomic_updates)
ExecutionSpace::execution_space execution_space
execution_space::size_type size_type
ExecutionSpace::execution_space execution_space
execution_space::size_type size_type
static void unpack(const ExecutionSpace &execSpace, const DstView &dst, const SrcView &src, const IdxView &idx, const Op &op, const size_t numCols, const bool use_atomic_updates)
UnpackArrayMultiColumn(const ExecutionSpace &, const DstView &dst_, const SrcView &src_, const IdxView &idx_, const Op &op_, const size_t numCols_)