10#ifndef TPETRA_DETAILS_UNPACKCRSMATRIXANDCOMBINE_DEF_HPP
11#define TPETRA_DETAILS_UNPACKCRSMATRIXANDCOMBINE_DEF_HPP
15#include "TpetraCore_config.h"
16#include "Kokkos_Core.hpp"
17#include "Teuchos_Array.hpp"
18#include "Teuchos_ArrayView.hpp"
19#include "Teuchos_OrdinalTraits.hpp"
20#include "Teuchos_TimeMonitor.hpp"
28#include "Tpetra_Details_DefaultTypes.hpp"
59namespace UnpackAndCombineCrsMatrixImpl {
70template <
class ST,
class LO,
class GO>
79 const size_t bytes_per_value) {
84 bool unpack_pids =
pids_out.size() > 0;
101 const char*
const pids_in = unpack_pids ? imports +
pids_beg :
nullptr;
112 Kokkos::pair<int, size_t>
p;
151template <
class LocalMatrix,
class LocalMap,
class BufferDeviceType>
156 typedef typename local_matrix_type::value_type ST;
160 typedef typename DT::execution_space XS;
162 typedef Kokkos::View<const size_t*, BufferDeviceType>
163 num_packets_per_lid_type;
164 typedef Kokkos::View<const size_t*, DT> offsets_type;
165 typedef Kokkos::View<const char*, BufferDeviceType> input_buffer_type;
166 typedef Kokkos::View<const LO*, BufferDeviceType> import_lids_type;
168 typedef Kokkos::View<int, DT> error_type;
169 using member_type =
typename Kokkos::TeamPolicy<XS>::member_type;
171 static_assert(std::is_same<LO, typename local_matrix_type::ordinal_type>::value,
172 "LocalMap::local_ordinal_type and "
173 "LocalMatrix::ordinal_type must be the same.");
177 input_buffer_type imports;
178 num_packets_per_lid_type num_packets_per_lid;
179 import_lids_type import_lids;
180 Kokkos::View<const LO* [2], DT> batch_info;
181 offsets_type offsets;
184 size_t bytes_per_value;
186 error_type error_code;
211 , error_code(
"error") {}
214 void operator()(member_type team_member)
const {
215 using Kokkos::MemoryUnmanaged;
216 using Kokkos::subview;
219 const LO
batch = team_member.league_rank();
231 const size_t buf_size = imports.size();
250 "*** Error: UnpackCrsMatrixAndCombineFunctor: "
251 "At row %d, the expected number of bytes (%d) != number of unpacked bytes (%d)\n",
254 Kokkos::atomic_compare_exchange(error_code.data(), 0, 21);
260 "*** Error: UnpackCrsMatrixAndCombineFunctor: "
261 "At row %d, the offset (%d) > buffer size (%d)\n",
264 Kokkos::atomic_compare_exchange(error_code.data(), 0, 22);
296 "*** Error: UnpackCrsMatrixAndCombineFunctor: "
297 "At row %d, number of entries (%d) != number of entries unpacked (%d)\n",
300 Kokkos::atomic_compare_exchange(error_code.data(), 0, 23);
306 Kokkos::parallel_for(
308 [=, *
this](
const LO&
j) {
325 if (combine_mode ==
ADD) {
330 (
void)local_matrix.sumIntoValues(
337 }
else if (combine_mode ==
REPLACE) {
342 (
void)local_matrix.replaceValues(
352 "*** Error: UnpackCrsMatrixAndCombineFunctor: "
353 "At row %d, an unknown error occurred during unpack\n",
355 Kokkos::atomic_compare_exchange(error_code.data(), 0, 31);
359 team_member.team_barrier();
364 auto error_code_h = Kokkos::create_mirror_view_and_copy(
365 Kokkos::HostSpace(), error_code);
371struct MaxNumEntTag {};
372struct TotNumEntTag {};
382template <
class LO,
class DT,
class BDT>
385 typedef Kokkos::View<const size_t*, BDT> num_packets_per_lid_type;
386 typedef Kokkos::View<const size_t*, DT> offsets_type;
387 typedef Kokkos::View<const char*, BDT> input_buffer_type;
393 num_packets_per_lid_type num_packets_per_lid;
394 offsets_type offsets;
395 input_buffer_type imports;
406 operator()(
const MaxNumEntTag,
const LO
i,
value_type& update)
const {
408 const size_t num_bytes = num_packets_per_lid(
i);
411 const char*
const in_buf = imports.data() + offsets(
i);
420 join(
const MaxNumEntTag,
423 if (dst < src) dst = src;
429 const size_t num_bytes = num_packets_per_lid(
i);
432 const char*
const in_buf = imports.data() + offsets(
i);
446template <
class LO,
class DT,
class BDT>
449 const Kokkos::View<const size_t*, BDT>& num_packets_per_lid,
450 const Kokkos::View<const size_t*, DT>& offsets,
451 const Kokkos::View<const char*, BDT>& imports) {
452 typedef typename DT::execution_space XS;
453 typedef Kokkos::RangePolicy<XS, Kokkos::IndexType<LO>,
460 static_cast<LO
>(num_packets_per_lid.extent(0));
461 size_t max_num_ent = 0;
462 Kokkos::parallel_reduce(
"Max num entries in CRS",
475template <
class LO,
class DT,
class BDT>
478 const Kokkos::View<const size_t*, BDT>& num_packets_per_lid,
479 const Kokkos::View<const size_t*, DT>& offsets,
480 const Kokkos::View<const char*, BDT>& imports) {
481 typedef typename DT::execution_space XS;
482 typedef Kokkos::RangePolicy<XS, Kokkos::IndexType<LO>, TotNumEntTag> range_policy;
487 static_cast<LO
>(num_packets_per_lid.extent(0));
488 Kokkos::parallel_reduce(
"Total num entries in CRS to unpack",
497 unpackRowCount(
const char imports[],
511 return static_cast<size_t>(num_ent_LO);
518template <
class View1,
class View2>
523 using LO =
typename View2::value_type;
527 batch_info(
batch, 0) =
static_cast<LO
>(
i);
532 return batch == batch_info.extent(0);
542template <
class LocalMatrix,
class LocalMap,
class BufferDeviceType>
546 const Kokkos::View<const char*, BufferDeviceType>& imports,
547 const Kokkos::View<const size_t*, BufferDeviceType>& num_packets_per_lid,
550 using ST =
typename LocalMatrix::value_type;
553 using XS =
typename DT::execution_space;
555 "Tpetra::Details::UnpackAndCombineCrsMatrixImpl::"
556 "unpackAndCombineIntoCrsMatrix: ";
558 const size_t num_import_lids =
static_cast<size_t>(import_lids.extent(0));
567 std::invalid_argument,
568 prefix <<
"ABSMAX combine mode is not yet implemented for a matrix that has a "
569 "static graph (i.e., was constructed with the CrsMatrix constructor "
570 "that takes a const CrsGraph pointer).");
573 std::invalid_argument,
574 prefix <<
"INSERT combine mode is not allowed if the matrix has a static graph "
575 "(i.e., was constructed with the CrsMatrix constructor that takes a "
576 "const CrsGraph pointer).");
580 std::invalid_argument,
581 prefix <<
"Invalid combine mode; should never get "
582 "here! Please report this bug to the Tpetra developers.");
588 std::invalid_argument,
590 "numPacketsPerLID.size() ("
591 << num_packets_per_lid.extent(0) <<
").");
605 Kokkos::View<LO* [2], DT> batch_info(
"",
num_batches);
608 Kokkos::parallel_reduce(
609 Kokkos::RangePolicy<XS, Kokkos::IndexType<size_t>>(0,
num_import_lids),
612 imports.data(), offsets(
i), num_packets_per_lid(
i));
637 const bool atomic = XS().concurrency() != 1;
652 using policy = Kokkos::TeamPolicy<XS, Kokkos::IndexType<LO>>;
654 if (!Spaces::is_gpu_exec_space<XS>() ||
team_size == Teuchos::OrdinalTraits<size_t>::invalid()) {
660 auto error_code =
f.error();
664 prefix <<
"UnpackCrsMatrixAndCombineFunctor reported error code " << error_code);
667template <
class LocalMatrix,
class BufferDeviceType>
673 const Kokkos::View<const char*, BufferDeviceType, void, void>& imports,
674 const Kokkos::View<const size_t*, BufferDeviceType, void, void>& num_packets_per_lid,
676 const Kokkos::View<const char*, BufferDeviceType>& imports,
677 const Kokkos::View<const size_t*, BufferDeviceType>& num_packets_per_lid,
680 using Kokkos::parallel_reduce;
681 typedef typename LocalMatrix::ordinal_type LO;
682 typedef typename LocalMatrix::device_type device_type;
683 typedef typename device_type::execution_space XS;
684 typedef typename Kokkos::View<LO*, device_type>::size_type size_type;
685 typedef Kokkos::RangePolicy<XS, Kokkos::IndexType<LO>> range_policy;
698 update +=
static_cast<size_t>(local_matrix.graph.row_map[
lid + 1] - local_matrix.graph.row_map[
lid]);
705 num_items =
static_cast<LO
>(permute_from_lids.extent(0));
709 range_policy(0, num_items),
710 KOKKOS_LAMBDA(
const LO i,
size_t& update) {
711 const LO lid = permute_from_lids(i);
712 update +=
static_cast<size_t>(local_matrix.graph.row_map[lid + 1] - local_matrix.graph.row_map[lid]);
720 const size_type np = num_packets_per_lid.extent(0);
721 Kokkos::View<size_t*, device_type> offsets(
"offsets", np + 1);
724 compute_total_num_entries<LO, device_type, BDT>(num_packets_per_lid,
732template <
class LO,
class DT,
class BDT>
733int setupRowPointersForRemotes(
736 const Kokkos::View<const char*, BDT>& imports,
737 const Kokkos::View<const size_t*, BDT>& num_packets_per_lid,
739 using Kokkos::parallel_reduce;
740 typedef typename DT::execution_space XS;
742 typedef Kokkos::RangePolicy<XS, Kokkos::IndexType<size_type>> range_policy;
745 const size_type
N = num_packets_per_lid.extent(0);
749 "Setup row pointers for remotes",
753 const size_t num_bytes = num_packets_per_lid(
i);
754 const size_t offset = offsets(
i);
767void makeCrsRowPtrFromLengths(
770 using Kokkos::parallel_scan;
771 typedef typename DT::execution_space XS;
772 typedef typename Kokkos::View<size_t*, DT>::size_type size_type;
773 typedef Kokkos::RangePolicy<XS, Kokkos::IndexType<size_type>> range_policy;
777 KOKKOS_LAMBDA(
const size_t&
i,
size_t& update,
const bool&
final) {
787template <
class LocalMatrix,
class LocalMap>
788void copyDataFromSameIDs(
790 const typename PackTraits<int>::output_array_type& tgt_pids,
792 const Kokkos::View<size_t*, typename LocalMap::device_type>& new_start_row,
794 const typename PackTraits<int>::input_array_type& src_pids,
795 const LocalMatrix& local_matrix,
796 const LocalMap& local_col_map,
797 const size_t num_same_ids,
799 using Kokkos::parallel_for;
802 typedef typename DT::execution_space XS;
803 typedef Kokkos::RangePolicy<XS, Kokkos::IndexType<size_t>> range_policy;
806 range_policy(0, num_same_ids),
807 KOKKOS_LAMBDA(
const size_t i) {
808 typedef typename std::remove_reference<
decltype(new_start_row(0))>::type atomic_incr_type;
810 const LO src_lid =
static_cast<LO
>(i);
811 size_t src_row = local_matrix.graph.row_map(src_lid);
813 const LO tgt_lid =
static_cast<LO
>(i);
814 const size_t tgt_row = tgt_rowptr(tgt_lid);
816 const size_t nsr = local_matrix.graph.row_map(src_lid + 1) - local_matrix.graph.row_map(src_lid);
817 Kokkos::atomic_fetch_add(&new_start_row(tgt_lid), atomic_incr_type(nsr));
819 for (
size_t j = local_matrix.graph.row_map(src_lid);
820 j < local_matrix.graph.row_map(src_lid + 1); ++j) {
821 LO src_col = local_matrix.graph.entries(j);
822 tgt_vals(tgt_row + j - src_row) = local_matrix.values(j);
823 tgt_colind(tgt_row + j - src_row) = local_col_map.getGlobalElement(src_col);
824 tgt_pids(tgt_row + j - src_row) = (src_pids(src_col) != my_pid) ? src_pids(src_col) : -1;
829template <
class LocalMatrix,
class LocalMap>
830void copyDataFromPermuteIDs(
832 const typename PackTraits<int>::output_array_type& tgt_pids,
834 const Kokkos::View<size_t*, typename LocalMap::device_type>& new_start_row,
836 const typename PackTraits<int>::input_array_type& src_pids,
839 const LocalMatrix& local_matrix,
840 const LocalMap& local_col_map,
842 using Kokkos::parallel_for;
845 typedef typename DT::execution_space XS;
846 typedef typename PackTraits<LO>::input_array_type::size_type size_type;
847 typedef Kokkos::RangePolicy<XS, Kokkos::IndexType<size_type>> range_policy;
849 const size_type num_permute_to_lids = permute_to_lids.extent(0);
852 range_policy(0, num_permute_to_lids),
853 KOKKOS_LAMBDA(
const size_t i) {
854 typedef typename std::remove_reference<
decltype(new_start_row(0))>::type atomic_incr_type;
856 const LO src_lid = permute_from_lids(i);
857 const size_t src_row = local_matrix.graph.row_map(src_lid);
859 const LO tgt_lid = permute_to_lids(i);
860 const size_t tgt_row = tgt_rowptr(tgt_lid);
862 size_t nsr = local_matrix.graph.row_map(src_lid + 1) - local_matrix.graph.row_map(src_lid);
863 Kokkos::atomic_fetch_add(&new_start_row(tgt_lid), atomic_incr_type(nsr));
865 for (
size_t j = local_matrix.graph.row_map(src_lid);
866 j < local_matrix.graph.row_map(src_lid + 1); ++j) {
867 LO src_col = local_matrix.graph.entries(j);
868 tgt_vals(tgt_row + j - src_row) = local_matrix.values(j);
869 tgt_colind(tgt_row + j - src_row) = local_col_map.getGlobalElement(src_col);
870 tgt_pids(tgt_row + j - src_row) = (src_pids(src_col) != my_pid) ? src_pids(src_col) : -1;
875template <
typename LocalMatrix,
typename LocalMap,
typename BufferDeviceType>
876int unpackAndCombineIntoCrsArrays2(
878 const typename PackTraits<int>::output_array_type& tgt_pids,
880 const Kokkos::View<size_t*, typename LocalMap::device_type>& new_start_row,
883#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
884 const Kokkos::View<const char*, BufferDeviceType, void, void>& imports,
885 const Kokkos::View<const size_t*, BufferDeviceType, void, void>& num_packets_per_lid,
887 const Kokkos::View<const char*, BufferDeviceType>& imports,
888 const Kokkos::View<const size_t*, BufferDeviceType>& num_packets_per_lid,
893 const size_t bytes_per_value) {
894 using Kokkos::atomic_fetch_add;
895 using Kokkos::MemoryUnmanaged;
896 using Kokkos::parallel_reduce;
897 using Kokkos::subview;
903 typedef typename LocalMatrix::value_type ST;
904 typedef typename DT::execution_space XS;
905 typedef typename Kokkos::View<LO*, DT>::size_type size_type;
906 typedef typename Kokkos::pair<size_type, size_type> slice;
907 typedef Kokkos::RangePolicy<XS, Kokkos::IndexType<size_type>> range_policy;
909 typedef View<int*, DT, MemoryUnmanaged> pids_out_type;
910 typedef View<GO*, DT, MemoryUnmanaged> gids_out_type;
911 typedef View<ST*, DT, MemoryUnmanaged> vals_out_type;
913 const size_t InvalidNum = OrdinalTraits<size_t>::invalid();
916 const size_type num_import_lids = import_lids.size();
920 "Unpack and combine into CRS",
921 range_policy(0, num_import_lids),
922 KOKKOS_LAMBDA(
const size_t i,
int& k_error) {
923 typedef typename std::remove_reference<
decltype(new_start_row(0))>::type atomic_incr_type;
924 const size_t num_bytes = num_packets_per_lid(i);
925 const size_t offset = offsets(i);
926 if (num_bytes == 0) {
930 size_t num_ent = unpackRowCount<LO>(imports.data(), offset, num_bytes);
931 if (num_ent == InvalidNum) {
935 const LO lcl_row = import_lids(i);
936 const size_t start_row = atomic_fetch_add(&new_start_row(lcl_row), atomic_incr_type(num_ent));
937 const size_t end_row = start_row + num_ent;
939 gids_out_type gids_out = subview(tgt_colind, slice(start_row, end_row));
940 vals_out_type vals_out = subview(tgt_vals, slice(start_row, end_row));
941 pids_out_type pids_out = subview(tgt_pids, slice(start_row, end_row));
943 k_error += unpackRow<ST, LO, GO>(gids_out, pids_out, vals_out,
944 imports.data(), offset, num_bytes,
945 num_ent, bytes_per_value);
948 for (
size_t j = 0; j < static_cast<size_t>(num_ent); ++j) {
949 const int pid = pids_out(j);
950 pids_out(j) = (pid != my_pid) ? pid : -1;
958template <
typename LocalMatrix,
typename LocalMap,
typename BufferDeviceType>
960 const LocalMatrix& local_matrix,
961 const LocalMap& local_col_map,
963#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
964 const Kokkos::View<const char*, BufferDeviceType, void, void>& imports,
965 const Kokkos::View<const size_t*, BufferDeviceType, void, void>& num_packets_per_lid,
967 const Kokkos::View<const char*, BufferDeviceType>& imports,
968 const Kokkos::View<const size_t*, BufferDeviceType>& num_packets_per_lid,
975 const typename PackTraits<int>::input_array_type& src_pids,
976 const typename PackTraits<int>::output_array_type& tgt_pids,
977 const size_t num_same_ids,
978 const size_t tgt_num_rows,
979 const size_t tgt_num_nonzeros,
980 const int my_tgt_pid,
981 const size_t bytes_per_value) {
982 using Kokkos::MemoryUnmanaged;
983 using Kokkos::parallel_for;
984 using Kokkos::subview;
989 typedef typename DT::execution_space XS;
990 typedef typename Kokkos::View<LO*, DT>::size_type size_type;
991 typedef Kokkos::RangePolicy<XS, Kokkos::IndexType<size_t>> range_policy;
992 typedef BufferDeviceType BDT;
994 const char prefix[] =
"unpackAndCombineIntoCrsArrays: ";
996 const size_t N = tgt_num_rows;
1000 const int my_pid = my_tgt_pid;
1004 range_policy(0, N + 1),
1005 KOKKOS_LAMBDA(
const size_t i) {
1011 range_policy(0, num_same_ids),
1012 KOKKOS_LAMBDA(
const size_t i) {
1013 const LO tgt_lid =
static_cast<LO
>(i);
1014 const LO src_lid =
static_cast<LO
>(i);
1015 tgt_rowptr(tgt_lid) = local_matrix.graph.row_map(src_lid + 1) - local_matrix.graph.row_map(src_lid);
1019 const size_type num_permute_to_lids = permute_to_lids.extent(0);
1021 range_policy(0, num_permute_to_lids),
1022 KOKKOS_LAMBDA(
const size_t i) {
1023 const LO tgt_lid = permute_to_lids(i);
1024 const LO src_lid = permute_from_lids(i);
1025 tgt_rowptr(tgt_lid) = local_matrix.graph.row_map(src_lid + 1) - local_matrix.graph.row_map(src_lid);
1029 const size_type num_import_lids = import_lids.extent(0);
1030 View<size_t*, DT> offsets(
"offsets", num_import_lids + 1);
1033#ifdef HAVE_TPETRA_DEBUG
1035 auto nth_offset_h = getEntryOnHost(offsets, num_import_lids);
1036 const bool condition =
1037 nth_offset_h !=
static_cast<size_t>(imports.extent(0));
1038 TEUCHOS_TEST_FOR_EXCEPTION(condition, std::logic_error, prefix <<
"The final offset in bytes " << nth_offset_h <<
" != imports.size() = " << imports.extent(0) <<
". Please report this bug to the Tpetra developers.");
1044 setupRowPointersForRemotes<LO, DT, BDT>(tgt_rowptr,
1045 import_lids, imports, num_packets_per_lid, offsets);
1046 TEUCHOS_TEST_FOR_EXCEPTION(k_error != 0, std::logic_error, prefix <<
" Error transferring data to target row pointers. "
1047 "Please report this bug to the Tpetra developers.");
1051 View<size_t*, DT> new_start_row(
"new_start_row", N + 1);
1054 makeCrsRowPtrFromLengths(tgt_rowptr, new_start_row);
1057 copyDataFromSameIDs(tgt_colind, tgt_pids, tgt_vals, new_start_row,
1058 tgt_rowptr, src_pids, local_matrix, local_col_map, num_same_ids, my_pid);
1060 copyDataFromPermuteIDs(tgt_colind, tgt_pids, tgt_vals, new_start_row,
1061 tgt_rowptr, src_pids, permute_to_lids, permute_from_lids,
1062 local_matrix, local_col_map, my_pid);
1064 if (imports.extent(0) <= 0) {
1068 int unpack_err = unpackAndCombineIntoCrsArrays2(tgt_colind, tgt_pids,
1069 tgt_vals, new_start_row, offsets, import_lids, imports, num_packets_per_lid,
1070 local_matrix, local_col_map, my_pid, bytes_per_value);
1071 TEUCHOS_TEST_FOR_EXCEPTION(
1072 unpack_err != 0, std::logic_error, prefix <<
"unpack loop failed. This "
1073 "should never happen. Please report this bug to the Tpetra developers.");
1114template <
typename ST,
typename LO,
typename GO,
typename Node>
1117 const Teuchos::ArrayView<const char>& imports,
1119 const Teuchos::ArrayView<const LO>&
importLIDs,
1123 typedef typename Node::device_type device_type;
1125 static_assert(std::is_same<device_type, typename local_matrix_device_type::device_type>::value,
1126 "Node::device_type and LocalMatrix::device_type must be the same.");
1144 imports.size(),
true,
"imports");
1146 auto local_matrix =
sourceMatrix.getLocalMatrixDevice();
1147 auto local_col_map =
sourceMatrix.getColMap()->getLocalMap();
1158 UnpackAndCombineCrsMatrixImpl::unpackAndCombineIntoCrsMatrix(
1163template <
typename ST,
typename LO,
typename GO,
typename NT>
1164void unpackCrsMatrixAndCombineNew(
1166 Kokkos::DualView<
char*,
1169 Kokkos::DualView<
size_t*,
1172 const Kokkos::DualView<
const LO*,
1179 using device_type =
typename crs_matrix_type::device_type;
1180 using local_matrix_device_type =
typename crs_matrix_type::local_matrix_device_type;
1181 using buffer_device_type =
typename dist_object_type::buffer_device_type;
1183 static_assert(std::is_same<device_type, typename local_matrix_device_type::device_type>::value,
1184 "crs_matrix_type::device_type and local_matrix_device_type::device_type "
1185 "must be the same.");
1190 auto num_packets_per_lid_d = numPacketsPerLID.view_device();
1192 TEUCHOS_ASSERT(!importLIDs.need_sync_device());
1193 auto import_lids_d = importLIDs.view_device();
1195 if (imports.need_sync_device()) {
1196 imports.sync_device();
1198 auto imports_d = imports.view_device();
1200 auto local_matrix = sourceMatrix.getLocalMatrixDevice();
1201 auto local_col_map = sourceMatrix.getColMap()->getLocalMap();
1202 typedef decltype(local_col_map) local_map_type;
1204 UnpackAndCombineCrsMatrixImpl::unpackAndCombineIntoCrsMatrix<
1205 local_matrix_device_type,
1207 buffer_device_type>(local_matrix, local_col_map, imports_d, num_packets_per_lid_d,
1208 import_lids_d, combineMode);
1266template <
typename Scalar,
typename LocalOrdinal,
typename GlobalOrdinal,
typename Node>
1270 const Teuchos::ArrayView<const LocalOrdinal>&
importLIDs,
1271 const Teuchos::ArrayView<const char>& imports,
1276 const Teuchos::ArrayView<const LocalOrdinal>&
permuteToLIDs,
1278 using Kokkos::MemoryUnmanaged;
1280 typedef typename Node::device_type DT;
1281 const char prefix[] =
"unpackAndCombineWithOwningPIDsCount: ";
1285 "permuteFromLIDs.size() = "
1291 "CrsMatrix 'sourceMatrix' must be locally indexed.");
1294 "numPacketsPerLID.size() = "
1297 auto local_matrix =
sourceMatrix.getLocalMatrixDevice();
1299 using kokkos_device_type = Kokkos::Device<
typename Node::device_type::execution_space,
1300 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>;
1302#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
1310 "permute_from_lids");
1312#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
1313 Kokkos::View<const char*, kokkos_device_type, void, void>
imports_d =
1315 Kokkos::View<const char*, kokkos_device_type>
imports_d =
1318 imports.getRawPtr(),
1319 imports.size(),
true,
1322#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
1330 "num_packets_per_lid");
1332 return UnpackAndCombineCrsMatrixImpl::unpackAndCombineWithOwningPIDsCount(
1352template <
typename Scalar,
typename LocalOrdinal,
typename GlobalOrdinal,
typename Node>
1356 Kokkos::Device<
typename Node::device_type::execution_space,
1357 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
1364 const Kokkos::View<
const char*,
1365 Kokkos::Device<
typename Node::device_type::execution_space,
1366 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
1373 const Kokkos::View<
const size_t*,
1374 Kokkos::Device<
typename Node::device_type::execution_space,
1375 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
1382 const size_t numSameIDs,
1384 Kokkos::Device<
typename Node::device_type::execution_space,
1385 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
1393 Kokkos::Device<
typename Node::device_type::execution_space,
1394 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
1403 Kokkos::View<size_t*, typename Node::device_type>&
crs_rowptr_d,
1404 Kokkos::View<GlobalOrdinal*, typename Node::device_type>&
crs_colind_d,
1406 const Teuchos::ArrayView<const int>&
SourcePids,
1407 Kokkos::View<int*, typename Node::device_type>&
TargetPids) {
1408 using execution_space =
typename Node::execution_space;
1411 using Kokkos::deep_copy;
1414 using Teuchos::ArrayView;
1415 using Teuchos::outArg;
1416 using Teuchos::REDUCE_MAX;
1417 using Teuchos::reduceAll;
1419 typedef typename Node::device_type DT;
1422 typedef typename matrix_type::impl_scalar_type ST;
1424 const char prefix[] =
"Tpetra::Details::unpackAndCombineIntoCrsArrays_new: ";
1425 Teuchos::RCP<Tpetra::Details::ProfilingRegion> tm;
1427 using Kokkos::MemoryUnmanaged;
1431 "permute_from_lids_d.size() = "
1437 "CrsMatrix 'sourceMatrix' must be locally indexed.");
1440 "num_packets_per_lid_d.size() = "
1443 auto local_matrix =
sourceMatrix.getLocalMatrixDevice();
1448 UnpackAndCombineCrsMatrixImpl::unpackAndCombineWithOwningPIDsCount(
1467 Kokkos::deep_copy(execution_space(),
TargetPids, -1);
1470 auto local_col_map =
sourceMatrix.getColMap()->getLocalMap();
1482 size_t bytes_per_value = 0;
1496 if (local_matrix.values.extent(0) > 0) {
1497 const ST&
val = local_matrix.values(0);
1503 Teuchos::reduceAll<int, size_t>(*(
sourceMatrix.getComm()),
1504 Teuchos::REDUCE_MAX,
1506 outArg(bytes_per_value));
1510 UnpackAndCombineCrsMatrixImpl::unpackAndCombineIntoCrsArrays(
1521 Kokkos::parallel_for(
1522 "setLocalEntriesToPID", Kokkos::RangePolicy<typename DT::execution_space>(0,
TargetPids.size()),
KOKKOS_LAMBDA(
const size_t i) {
1528template <
typename Scalar,
typename LocalOrdinal,
typename GlobalOrdinal,
typename Node>
1532 Kokkos::Device<
typename Node::device_type::execution_space,
1533 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
1540 const Kokkos::View<
const char*,
1541 Kokkos::Device<
typename Node::device_type::execution_space,
1542 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
1549 const Kokkos::View<
const size_t*,
1550 Kokkos::Device<
typename Node::device_type::execution_space,
1551 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
1558 const size_t numSameIDs,
1560 Kokkos::Device<
typename Node::device_type::execution_space,
1561 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
1569 Kokkos::Device<
typename Node::device_type::execution_space,
1570 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
1580 Teuchos::ArrayRCP<GlobalOrdinal>&
CRS_colind,
1581 Teuchos::ArrayRCP<Scalar>&
CRS_vals,
1582 const Teuchos::ArrayView<const int>&
SourcePids,
1584 using execution_space =
typename Node::execution_space;
1587 using Kokkos::deep_copy;
1590 using Teuchos::ArrayView;
1591 using Teuchos::outArg;
1592 using Teuchos::REDUCE_MAX;
1593 using Teuchos::reduceAll;
1595 typedef typename Node::device_type DT;
1598 typedef typename matrix_type::impl_scalar_type ST;
1600 const char prefix[] =
"Tpetra::Details::unpackAndCombineIntoCrsArrays_new: ";
1601 Teuchos::RCP<Tpetra::Details::ProfilingRegion> tm;
1603 using Kokkos::MemoryUnmanaged;
1607 "permute_from_lids_d.size() = "
1613 "CrsMatrix 'sourceMatrix' must be locally indexed.");
1616 "num_packets_per_lid_d.size() = "
1619 auto local_matrix =
sourceMatrix.getLocalMatrixDevice();
1624 UnpackAndCombineCrsMatrixImpl::unpackAndCombineWithOwningPIDsCount(
1648 auto local_col_map =
sourceMatrix.getColMap()->getLocalMap();
1661#ifdef HAVE_TPETRA_INST_COMPLEX_DOUBLE
1662 static_assert(!std::is_same<
1663 typename std::remove_const<
1664 typename std::decay<
1666 std::complex<double>>::value,
1667 "CRS_vals::value_type is std::complex<double>; this should never happen"
1668 ", since std::complex does not work in Kokkos::View objects.");
1675#ifdef HAVE_TPETRA_INST_COMPLEX_DOUBLE
1676 static_assert(!std::is_same<
1677 typename decltype(
crs_vals_d)::non_const_value_type,
1678 std::complex<double>>::value,
1679 "crs_vals_d::non_const_value_type is std::complex<double>; this should "
1680 "never happen, since std::complex does not work in Kokkos::View objects.");
1693 size_t bytes_per_value = 0;
1707 if (local_matrix.values.extent(0) > 0) {
1708 const ST&
val = local_matrix.values(0);
1714 Teuchos::reduceAll<int, size_t>(*(
sourceMatrix.getComm()),
1715 Teuchos::REDUCE_MAX,
1717 outArg(bytes_per_value));
1720#ifdef HAVE_TPETRA_INST_COMPLEX_DOUBLE
1721 static_assert(!std::is_same<
1722 typename decltype(
crs_vals_d)::non_const_value_type,
1723 std::complex<double>>::value,
1724 "crs_vals_d::non_const_value_type is std::complex<double>; this should "
1725 "never happen, since std::complex does not work in Kokkos::View objects.");
1729 UnpackAndCombineCrsMatrixImpl::unpackAndCombineIntoCrsArrays(
1764#define TPETRA_DETAILS_UNPACKCRSMATRIXANDCOMBINE_INSTANT_KOKKOS_DEPRECATED_CODE_4_ON(ST, LO, GO, NT) \
1766 Details::unpackCrsMatrixAndCombine<ST, LO, GO, NT>( \
1767 const CrsMatrix<ST, LO, GO, NT>&, \
1768 const Teuchos::ArrayView<const char>&, \
1769 const Teuchos::ArrayView<const size_t>&, \
1770 const Teuchos::ArrayView<const LO>&, \
1774 Details::unpackAndCombineWithOwningPIDsCount<ST, LO, GO, NT>( \
1775 const CrsMatrix<ST, LO, GO, NT>&, \
1776 const Teuchos::ArrayView<const LO>&, \
1777 const Teuchos::ArrayView<const char>&, \
1778 const Teuchos::ArrayView<const size_t>&, \
1782 const Teuchos::ArrayView<const LO>&, \
1783 const Teuchos::ArrayView<const LO>&); \
1785 Details::unpackCrsMatrixAndCombineNew<ST, LO, GO, NT>( \
1786 const CrsMatrix<ST, LO, GO, NT>&, \
1787 Kokkos::DualView<char*, typename DistObject<char, LO, GO, NT>::buffer_device_type>, \
1788 Kokkos::DualView<size_t*, typename DistObject<char, LO, GO, NT>::buffer_device_type>, \
1789 const Kokkos::DualView<const LO*, typename DistObject<char, LO, GO, NT>::buffer_device_type>&, \
1791 const CombineMode); \
1793 Details::unpackAndCombineIntoCrsArrays<ST, LO, GO, NT>( \
1794 const CrsMatrix<ST, LO, GO, NT>&, \
1795 const Kokkos::View<LO const*, \
1796 Kokkos::Device<typename NT::device_type::execution_space, \
1797 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>, \
1799 const Kokkos::View<const char*, \
1800 Kokkos::Device<typename NT::device_type::execution_space, \
1801 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>, \
1803 const Kokkos::View<const size_t*, \
1804 Kokkos::Device<typename NT::device_type::execution_space, \
1805 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>, \
1808 const Kokkos::View<LO const*, \
1809 Kokkos::Device<typename NT::device_type::execution_space, \
1810 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>, \
1812 const Kokkos::View<LO const*, \
1813 Kokkos::Device<typename NT::device_type::execution_space, \
1814 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>, \
1818 Kokkos::View<size_t*, typename NT::device_type>&, \
1819 Kokkos::View<GO*, typename NT::device_type>&, \
1820 Kokkos::View<typename CrsMatrix<ST, LO, GO, NT>::impl_scalar_type*, typename NT::device_type>&, \
1821 const Teuchos::ArrayView<const int>&, \
1822 Kokkos::View<int*, typename NT::device_type>&); \
1824 Details::unpackAndCombineIntoCrsArrays<ST, LO, GO, NT>( \
1825 const CrsMatrix<ST, LO, GO, NT>&, \
1826 const Kokkos::View<LO const*, \
1827 Kokkos::Device<typename NT::device_type::execution_space, \
1828 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>, \
1830 const Kokkos::View<const char*, \
1831 Kokkos::Device<typename NT::device_type::execution_space, \
1832 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>, \
1834 const Kokkos::View<const size_t*, \
1835 Kokkos::Device<typename NT::device_type::execution_space, \
1836 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>, \
1839 const Kokkos::View<LO const*, \
1840 Kokkos::Device<typename NT::device_type::execution_space, \
1841 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>, \
1843 const Kokkos::View<LO const*, \
1844 Kokkos::Device<typename NT::device_type::execution_space, \
1845 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>, \
1849 Teuchos::ArrayRCP<size_t>&, \
1850 Teuchos::ArrayRCP<GO>&, \
1851 Teuchos::ArrayRCP<ST>&, \
1852 const Teuchos::ArrayView<const int>&, \
1853 Teuchos::Array<int>&);
1855#define TPETRA_DETAILS_UNPACKCRSMATRIXANDCOMBINE_INSTANT_KOKKOS_DEPRECATED_CODE_4_OFF(ST, LO, GO, NT) \
1857 Details::unpackCrsMatrixAndCombine<ST, LO, GO, NT>( \
1858 const CrsMatrix<ST, LO, GO, NT>&, \
1859 const Teuchos::ArrayView<const char>&, \
1860 const Teuchos::ArrayView<const size_t>&, \
1861 const Teuchos::ArrayView<const LO>&, \
1865 Details::unpackAndCombineWithOwningPIDsCount<ST, LO, GO, NT>( \
1866 const CrsMatrix<ST, LO, GO, NT>&, \
1867 const Teuchos::ArrayView<const LO>&, \
1868 const Teuchos::ArrayView<const char>&, \
1869 const Teuchos::ArrayView<const size_t>&, \
1873 const Teuchos::ArrayView<const LO>&, \
1874 const Teuchos::ArrayView<const LO>&); \
1876 Details::unpackCrsMatrixAndCombineNew<ST, LO, GO, NT>( \
1877 const CrsMatrix<ST, LO, GO, NT>&, \
1878 Kokkos::DualView<char*, typename DistObject<char, LO, GO, NT>::buffer_device_type>, \
1879 Kokkos::DualView<size_t*, typename DistObject<char, LO, GO, NT>::buffer_device_type>, \
1880 const Kokkos::DualView<const LO*, typename DistObject<char, LO, GO, NT>::buffer_device_type>&, \
1882 const CombineMode); \
1884 Details::unpackAndCombineIntoCrsArrays<ST, LO, GO, NT>( \
1885 const CrsMatrix<ST, LO, GO, NT>&, \
1886 const Kokkos::View<LO const*, \
1887 Kokkos::Device<typename NT::device_type::execution_space, \
1888 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>>, \
1889 const Kokkos::View<const char*, \
1890 Kokkos::Device<typename NT::device_type::execution_space, \
1891 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>>, \
1892 const Kokkos::View<const size_t*, \
1893 Kokkos::Device<typename NT::device_type::execution_space, \
1894 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>>, \
1896 const Kokkos::View<LO const*, \
1897 Kokkos::Device<typename NT::device_type::execution_space, \
1898 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>>, \
1899 const Kokkos::View<LO const*, \
1900 Kokkos::Device<typename NT::device_type::execution_space, \
1901 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>>, \
1904 Kokkos::View<size_t*, typename NT::device_type>&, \
1905 Kokkos::View<GO*, typename NT::device_type>&, \
1906 Kokkos::View<typename CrsMatrix<ST, LO, GO, NT>::impl_scalar_type*, typename NT::device_type>&, \
1907 const Teuchos::ArrayView<const int>&, \
1908 Kokkos::View<int*, typename NT::device_type>&); \
1910 Details::unpackAndCombineIntoCrsArrays<ST, LO, GO, NT>( \
1911 const CrsMatrix<ST, LO, GO, NT>&, \
1912 const Kokkos::View<LO const*, \
1913 Kokkos::Device<typename NT::device_type::execution_space, \
1914 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>>, \
1915 const Kokkos::View<const char*, \
1916 Kokkos::Device<typename NT::device_type::execution_space, \
1917 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>>, \
1918 const Kokkos::View<const size_t*, \
1919 Kokkos::Device<typename NT::device_type::execution_space, \
1920 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>>, \
1922 const Kokkos::View<LO const*, \
1923 Kokkos::Device<typename NT::device_type::execution_space, \
1924 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>>, \
1925 const Kokkos::View<LO const*, \
1926 Kokkos::Device<typename NT::device_type::execution_space, \
1927 Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>>>, \
1930 Teuchos::ArrayRCP<size_t>&, \
1931 Teuchos::ArrayRCP<GO>&, \
1932 Teuchos::ArrayRCP<ST>&, \
1933 const Teuchos::ArrayView<const int>&, \
1934 Teuchos::Array<int>&);
1936#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
1937#define TPETRA_DETAILS_UNPACKCRSMATRIXANDCOMBINE_INSTANT(ST, LO, GO, NT) \
1938 TPETRA_DETAILS_UNPACKCRSMATRIXANDCOMBINE_INSTANT_KOKKOS_DEPRECATED_CODE_4_ON(ST, LO, GO, NT)
1940#define TPETRA_DETAILS_UNPACKCRSMATRIXANDCOMBINE_INSTANT(ST, LO, GO, NT) \
1941 TPETRA_DETAILS_UNPACKCRSMATRIXANDCOMBINE_INSTANT_KOKKOS_DEPRECATED_CODE_4_OFF(ST, LO, GO, NT)
Declaration of the Tpetra::CrsMatrix class.
Import KokkosSparse::OrdinalTraits, a traits class for "invalid" (flag) values of integer types,...
Declaration and generic definition of traits class that tells Tpetra::CrsMatrix how to pack and unpac...
Declaration and definition of Tpetra::Details::castAwayConstDualView, an implementation detail of Tpe...
Declare and define the functions Tpetra::Details::computeOffsetsFromCounts and Tpetra::computeOffsets...
Functions that wrap Kokkos::create_mirror_view, in order to avoid deep copies when not necessary,...
Declaration and definition of Tpetra::Details::getEntryOnHost.
size_t compute_total_num_entries(const Kokkos::View< const size_t *, BDT > &num_packets_per_lid, const Kokkos::View< const size_t *, DT > &offsets, const Kokkos::View< const char *, BDT > &imports)
Total number of entries in any row of the packed matrix.
void unpackAndCombineIntoCrsMatrix(const LocalMatrix &local_matrix, const LocalMap &local_map, const Kokkos::View< const char *, BufferDeviceType > &imports, const Kokkos::View< const size_t *, BufferDeviceType > &num_packets_per_lid, const typename PackTraits< typename LocalMap::local_ordinal_type >::input_array_type import_lids, const Tpetra::CombineMode combine_mode)
Perform the unpack operation for the matrix.
size_t compute_maximum_num_entries(const Kokkos::View< const size_t *, BDT > &num_packets_per_lid, const Kokkos::View< const size_t *, DT > &offsets, const Kokkos::View< const char *, BDT > &imports)
Maximum number of entries in any row of the packed matrix.
bool compute_batch_info(const View1 &batches_per_lid, View2 &batch_info)
Compute the index and batch number associated with each batch.
KokkosSparse::CrsMatrix< impl_scalar_type, local_ordinal_type, device_type, void, typename local_graph_device_type::size_type > local_matrix_device_type
The specialization of Kokkos::CrsMatrix that represents the part of the sparse matrix on each MPI pro...
typename row_matrix_type::impl_scalar_type impl_scalar_type
The type used internally in place of Scalar.
Struct that holds views of the contents of a CrsMatrix.
static size_t hierarchicalUnpackBatchSize()
Size of batch for hierarchical unpacking.
static size_t hierarchicalUnpackTeamSize()
Size of team for hierarchical unpacking.
"Local" part of Map suitable for Kokkos kernels.
KOKKOS_INLINE_FUNCTION LocalOrdinal getLocalElement(const GlobalOrdinal globalIndex) const
Get the local index corresponding to the given global index. (device only)
LocalOrdinal local_ordinal_type
The type of local indices.
GlobalOrdinal global_ordinal_type
The type of global indices.
DeviceType device_type
The device type.
Kokkos::parallel_reduce functor to determine the number of entries (to unpack) in a KokkosSparse::Crs...
Kokkos::Device< typename device_type::execution_space, buffer_memory_space > buffer_device_type
Kokkos::Device specialization for communication buffers.
Implementation details of Tpetra.
void unpackAndCombineIntoCrsArrays(const CrsGraph< LO, GO, NT > &sourceGraph, const Teuchos::ArrayView< const LO > &importLIDs, const Teuchos::ArrayView< const typename CrsGraph< LO, GO, NT >::packet_type > &imports, const Teuchos::ArrayView< const size_t > &numPacketsPerLID, const size_t constantNumPackets, const CombineMode combineMode, const size_t numSameIDs, const Teuchos::ArrayView< const LO > &permuteToLIDs, const Teuchos::ArrayView< const LO > &permuteFromLIDs, size_t TargetNumRows, size_t TargetNumNonzeros, const int MyTargetPID, const Teuchos::ArrayView< size_t > &CRS_rowptr, const Teuchos::ArrayView< GO > &CRS_colind, const Teuchos::ArrayView< const int > &SourcePids, Teuchos::Array< int > &TargetPids)
unpackAndCombineIntoCrsArrays
Impl::CreateMirrorViewFromUnmanagedHostArray< ValueType, OutputDeviceType >::output_view_type create_mirror_view_from_raw_host_array(const OutputDeviceType &, ValueType *inPtr, const size_t inSize, const bool copy=true, const char label[]="")
Variant of Kokkos::create_mirror_view that takes a raw host 1-d array as input.
size_t unpackAndCombineWithOwningPIDsCount(const CrsGraph< LO, GO, NT > &sourceGraph, const Teuchos::ArrayView< const LO > &importLIDs, const Teuchos::ArrayView< const typename CrsGraph< LO, GO, NT >::packet_type > &imports, const Teuchos::ArrayView< const size_t > &numPacketsPerLID, size_t constantNumPackets, CombineMode combineMode, size_t numSameIDs, const Teuchos::ArrayView< const LO > &permuteToLIDs, const Teuchos::ArrayView< const LO > &permuteFromLIDs)
Special version of Tpetra::Details::unpackCrsGraphAndCombine that also unpacks owning process ranks.
void unpackCrsMatrixAndCombine(const CrsMatrix< ST, LO, GO, NT > &sourceMatrix, const Teuchos::ArrayView< const char > &imports, const Teuchos::ArrayView< const size_t > &numPacketsPerLID, const Teuchos::ArrayView< const LO > &importLIDs, size_t constantNumPackets, CombineMode combineMode)
Unpack the imported column indices and values, and combine into matrix.
OffsetsViewType::non_const_value_type computeOffsetsFromCounts(const ExecutionSpace &execSpace, const OffsetsViewType &ptr, const CountsViewType &counts)
Compute offsets from counts.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
void deep_copy(MultiVector< DS, DL, DG, DN > &dst, const MultiVector< SS, SL, SG, SN > &src)
Copy the contents of the MultiVector src into dst.
CombineMode
Rule for combining data in an Import or Export.
@ REPLACE
Replace existing values with new values.
@ ABSMAX
Replace old value with maximum of magnitudes of old and new values.
@ INSERT
Insert new values that don't currently exist.
Traits class for packing / unpacking data of type T.
static KOKKOS_INLINE_FUNCTION Kokkos::pair< int, size_t > unpackArray(value_type outBuf[], const char inBuf[], const size_t numEnt)
Unpack numEnt value_type entries from the given input buffer of bytes, to the given output buffer of ...
static KOKKOS_INLINE_FUNCTION size_t unpackValue(T &outVal, const char inBuf[])
Unpack the given value from the given output buffer.
Kokkos::View< value_type *, Kokkos::AnonymousSpace > output_array_type
The type of an output array of value_type.
static KOKKOS_INLINE_FUNCTION size_t packValueCount(const T &)
Number of bytes required to pack or unpack the given value of type value_type.
Kokkos::View< const value_type *, Kokkos::AnonymousSpace > input_array_type
The type of an input array of value_type.
Unpacks and combines a single row of the CrsMatrix.
int error() const
Host function for getting the error.