40#ifndef TPETRA_DETAILS_UNPACKCRSGRAPHANDCOMBINE_DEF_HPP
41#define TPETRA_DETAILS_UNPACKCRSGRAPHANDCOMBINE_DEF_HPP
43#include "TpetraCore_config.h"
44#include "Teuchos_Array.hpp"
45#include "Teuchos_ArrayView.hpp"
54#include "Kokkos_Core.hpp"
84namespace UnpackAndCombineCrsGraphImpl {
95template<
class Packet,
class GO,
class Device,
class BufferDevice>
98 const Kokkos::View<int*,Device,Kokkos::MemoryUnmanaged>&
pids_out,
99 const Kokkos::View<const Packet*,BufferDevice>& imports,
103 using size_type =
typename Kokkos::View<GO*,Device>::size_type;
142 using GO =
typename IndicesView::value_type;
148 using device_type =
typename IndicesView::device_type;
149 using execution_space =
typename device_type::execution_space;
151 using num_packets_per_lid_type = Kokkos::View<const size_t*, buffer_device_type>;
152 using offsets_type = Kokkos::View<const size_t*, device_type>;
153 using input_buffer_type = Kokkos::View<const packet_type*, buffer_device_type>;
154 using import_lids_type = Kokkos::View<const LO*, buffer_device_type>;
156 using gids_scratch_type = Kokkos::View<GO*, device_type>;
157 using pids_scratch_type = Kokkos::View<int*,device_type>;
162 input_buffer_type imports;
163 num_packets_per_lid_type num_packets_per_lid;
164 import_lids_type import_lids;
165 offsets_type offsets;
168 Kokkos::Experimental::UniqueToken<execution_space,
169 Kokkos::Experimental::UniqueTokenScope::Global> tokens;
170 gids_scratch_type gids_scratch;
171 pids_scratch_type pids_scratch;
174 using value_type = Kokkos::pair<int, LO>;
195 tokens(execution_space()),
196 gids_scratch(
"gids_scratch", tokens.size() * max_num_ent),
197 pids_scratch(
"pids_scratch", tokens.size() * max_num_ent)
202 using Tpetra::Details::OrdinalTraits;
207 join(value_type& dst,
const value_type& src)
const
213 using Tpetra::Details::OrdinalTraits;
220 src.second < dst.second) {
227 void operator()(
const LO i, value_type& dst)
const
230 using Kokkos::subview;
231 using Kokkos::MemoryUnmanaged;
232 using size_type =
typename execution_space::size_type;
233 using slice =
typename Kokkos::pair<size_type, size_type>;
244 dst = Kokkos::make_pair(1,
i);
254 const size_t buf_size = imports.size();
255 const size_t offset = offsets(
i);
258 dst = Kokkos::make_pair(2,
i);
265 const size_type
token = tokens.acquire();
266 const size_t a =
static_cast<size_t>(
token) * max_num_ent;
274 dst = Kokkos::make_pair(3,
i);
275 tokens.release(
token);
286 tokens.release(
token);
305 Kokkos::MemoryUnmanaged>& imports,
307 Kokkos::MemoryUnmanaged>& num_packets_per_lid,
309 Kokkos::MemoryUnmanaged>& import_lids,
312 const bool unpack_pids,
318 using device_type =
typename Node::device_type;
319 using execution_space =
typename BufferDevice::execution_space;
321 Kokkos::RangePolicy<execution_space, Kokkos::IndexType<LO>>;
326 "Tpetra::Details::UnpackAndCombineCrsGraphImpl::unpackAndCombine: ";
328 const size_t num_import_lids =
static_cast<size_t>(import_lids.extent(0));
339 Kokkos::View<size_t*, device_type> offsets(
"offsets",
num_import_lids+1);
346 Kokkos::parallel_reduce
356 }, Kokkos::Max<size_t> (max_num_ent));
360 num_packets_per_lid, import_lids, offsets,
361 max_num_ent, unpack_pids);
363 typename unpack_functor_type::value_type
x;
365 auto x_h =
x.to_std_pair();
367 prefix <<
"UnpackAndCombineFunctor reported error code "
368 <<
x_h.first <<
" for the first bad row " <<
x_h.second);
371template<
class Packet,
class LocalGraph,
class BufferDevice>
375 const Kokkos::View<
const typename LocalGraph::data_type*,
376 typename LocalGraph::device_type,
378 const Kokkos::View<const Packet*, BufferDevice>& ,
379 const Kokkos::View<const size_t*, BufferDevice>& num_packets_per_lid,
382 using Kokkos::parallel_reduce;
384 using LO =
typename local_graph_type::data_type;
385 using device_type =
typename local_graph_type::device_type;
386 using execution_space =
typename device_type::execution_space;
387 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<LO>>;
399 update +=
static_cast<size_t>(local_graph.row_map[
lid+1]
400 -local_graph.row_map[
lid]);
406 num_items =
static_cast<LO
>(permute_from_lids.extent(0));
410 range_policy(0, num_items),
411 KOKKOS_LAMBDA(
const LO i,
size_t& update) {
412 const LO lid = permute_from_lids(i);
413 update +=
static_cast<size_t>(local_graph.row_map[lid+1]
414 - local_graph.row_map[lid]);
421 size_t tot_num_ent = 0;
422 parallel_reduce(
"SumReduce",
423 range_policy(0,num_packets_per_lid.size()),
424 KOKKOS_LAMBDA(
const int& i,
size_t& lsum) {
425 lsum += num_packets_per_lid(i) / 2;
426 }, Kokkos::Sum<size_t>(tot_num_ent));
427 count += tot_num_ent;
434template<
class Packet,
class LO,
class Device,
class BufferDevice>
437 const Kokkos::View<size_t*, Device>&
tgt_rowptr,
438 const Kokkos::View<const LO*, BufferDevice>& import_lids,
439 const Kokkos::View<const Packet*, BufferDevice>& ,
440 const Kokkos::View<const size_t*, BufferDevice>& num_packets_per_lid)
442 using Kokkos::parallel_reduce;
443 using device_type = Device;
444 using execution_space =
typename device_type::execution_space;
445 using size_type =
typename Kokkos::View<size_t*,device_type>::size_type;
446 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<size_type>>;
448 const size_type
N = num_packets_per_lid.extent(0);
460template<
class Device>
462makeCrsRowPtrFromLengths(
463 const Kokkos::View<size_t*,Device,Kokkos::MemoryUnmanaged>&
tgt_rowptr,
466 using Kokkos::parallel_scan;
467 using device_type = Device;
468 using execution_space =
typename device_type::execution_space;
469 using size_type =
typename Kokkos::View<size_t*,device_type>::size_type;
470 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<size_type>>;
474 KOKKOS_LAMBDA(
const size_t&
i,
size_t& update,
const bool&
final) {
485template<
class LocalGraph,
class LocalMap>
490 const Kokkos::View<int*, typename LocalMap::device_type>& tgt_pids,
491 const Kokkos::View<size_t*,typename LocalMap::device_type>& new_start_row,
492 const Kokkos::View<size_t*, typename LocalMap::device_type>& tgt_rowptr,
493 const Kokkos::View<const int*, typename LocalMap::device_type>& src_pids,
494 const LocalGraph& local_graph,
495 const LocalMap& local_col_map,
496 const size_t num_same_ids,
499 using Kokkos::parallel_for;
502 using execution_space =
typename device_type::execution_space;
503 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<size_t>>;
506 range_policy(0, num_same_ids),
507 KOKKOS_LAMBDA(
const size_t i) {
508 using atomic_incr_type =
typename std::remove_reference<
decltype(new_start_row(0))>::type;
510 const LO src_lid =
static_cast<LO
>(i);
511 size_t src_row = local_graph.row_map(src_lid);
513 const LO tgt_lid =
static_cast<LO
>(i);
514 const size_t tgt_row = tgt_rowptr(tgt_lid);
516 const size_t nsr = local_graph.row_map(src_lid+1)
517 - local_graph.row_map(src_lid);
518 Kokkos::atomic_fetch_add(&new_start_row(tgt_lid), atomic_incr_type(nsr));
520 for (
size_t j=local_graph.row_map(src_lid);
521 j<local_graph.row_map(src_lid+1); ++j) {
522 LO src_col = local_graph.entries(j);
523 tgt_colind(tgt_row + j - src_row) = local_col_map.getGlobalElement(src_col);
524 tgt_pids(tgt_row + j - src_row) = (src_pids(src_col) != my_pid) ? src_pids(src_col) : -1;
530template<
class LocalGraph,
class LocalMap,
class BufferDevice>
532copyDataFromPermuteIDs(
535 const Kokkos::View<
int*,
537 const Kokkos::View<
size_t*,
539 const Kokkos::View<
size_t*,
541 const Kokkos::View<
const int*,
544 BufferDevice, Kokkos::MemoryUnmanaged>& permute_to_lids,
546 BufferDevice, Kokkos::MemoryUnmanaged>& permute_from_lids,
547 const LocalGraph& local_graph,
548 const LocalMap& local_col_map,
551 using Kokkos::parallel_for;
554 using execution_space =
typename device_type::execution_space;
555 using size_type =
typename Kokkos::View<LO*,device_type>::size_type;
556 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<size_type>>;
558 const size_type num_permute_to_lids = permute_to_lids.extent(0);
561 range_policy(0, num_permute_to_lids),
562 KOKKOS_LAMBDA(
const size_t i) {
563 using atomic_incr_type =
typename std::remove_reference<
decltype(new_start_row(0))>::type;
565 const LO src_lid = permute_from_lids(i);
566 const size_t src_row = local_graph.row_map(src_lid);
568 const LO tgt_lid = permute_to_lids(i);
569 const size_t tgt_row = tgt_rowptr(tgt_lid);
571 size_t nsr = local_graph.row_map(src_lid+1)
572 - local_graph.row_map(src_lid);
573 Kokkos::atomic_fetch_add(&new_start_row(tgt_lid), atomic_incr_type(nsr));
575 for (
size_t j=local_graph.row_map(src_lid);
576 j<local_graph.row_map(src_lid+1); ++j) {
577 LO src_col = local_graph.entries(j);
578 tgt_colind(tgt_row + j - src_row) = local_col_map.getGlobalElement(src_col);
579 tgt_pids(tgt_row + j - src_row) = (src_pids(src_col) != my_pid) ? src_pids(src_col) : -1;
585template<
class Packet,
class LocalGraph,
class LocalMap,
class BufferDevice>
587unpackAndCombineIntoCrsArrays2(
588 const Kokkos::View<typename LocalMap::global_ordinal_type*, typename LocalMap::device_type>& tgt_colind,
589 const Kokkos::View<int*, typename LocalMap::device_type>& tgt_pids,
590 const Kokkos::View<size_t*,typename LocalMap::device_type>& new_start_row,
591 const Kokkos::View<const size_t*, typename LocalMap::device_type>& offsets,
595 Kokkos::MemoryUnmanaged>& import_lids,
596 const Kokkos::View<const Packet*, BufferDevice>& imports,
597 const Kokkos::View<const size_t*, BufferDevice>& num_packets_per_lid,
603 using Kokkos::subview;
604 using Kokkos::MemoryUnmanaged;
605 using Kokkos::parallel_reduce;
606 using Kokkos::atomic_fetch_add;
611 using execution_space =
typename device_type::execution_space;
612 using size_type =
typename Kokkos::View<LO*, device_type>::size_type;
613 using slice =
typename Kokkos::pair<size_type, size_type>;
614 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<size_type>>;
616 using pids_out_type = View<int*,device_type, MemoryUnmanaged>;
617 using gids_out_type = View<GO*, device_type, MemoryUnmanaged>;
619 const size_type num_import_lids = import_lids.size();
620 const char prefix[] =
"UnpackAndCombineCrsGraphImpl::unpackAndCombineIntoCrsArrays2: ";
624 parallel_reduce(
"Unpack and combine into CRS",
625 range_policy(0, num_import_lids),
626 KOKKOS_LAMBDA(
const size_t i,
int& err) {
627 using atomic_incr_type =
typename std::remove_reference<
decltype( new_start_row(0) )>::type;
628 const size_t num_packets_this_lid = num_packets_per_lid(i);
629 const size_t num_ent = num_packets_this_lid / 2;
630 const size_t offset = offsets(i);
631 const LO lcl_row = import_lids(i);
632 const size_t start_row = atomic_fetch_add(&new_start_row(lcl_row), atomic_incr_type(num_ent));
633 const size_t end_row = start_row + num_ent;
635 gids_out_type gids_out = subview(tgt_colind, slice(start_row, end_row));
636 pids_out_type pids_out = subview(tgt_pids, slice(start_row, end_row));
638 err +=
unpackRow (gids_out, pids_out, imports, offset, num_ent);
641 for (
size_t j = 0; j < static_cast<size_t>(num_ent); ++j) {
642 const int pid = pids_out(j);
643 pids_out(j) = (pid != my_pid) ? pid : -1;
647 TEUCHOS_TEST_FOR_EXCEPTION(gbl_err_count != 0,
648 std::invalid_argument, prefix <<
649 "Attempting to unpack PIDs, but num_ent is not even; this should never "
650 "happen! Please report this bug to the Tpetra developers.");
655template<
class Packet,
class LocalGraph,
class LocalMap,
class BufferDevice>
658 const LocalGraph & local_graph,
659 const LocalMap & local_col_map,
662 Kokkos::MemoryUnmanaged>& import_lids,
663 const Kokkos::View<const Packet*, BufferDevice>& imports,
664 const Kokkos::View<const size_t*, BufferDevice>& num_packets_per_lid,
667 Kokkos::MemoryUnmanaged>& permute_to_lids,
670 Kokkos::MemoryUnmanaged>& permute_from_lids,
671 const Kokkos::View<
size_t*,
673 Kokkos::MemoryUnmanaged>& tgt_rowptr,
676 Kokkos::MemoryUnmanaged>& tgt_colind,
677 const Kokkos::View<
const int*,
679 Kokkos::MemoryUnmanaged>& src_pids,
680 const Kokkos::View<
int*,
682 Kokkos::MemoryUnmanaged>& tgt_pids,
683 const size_t num_same_ids,
684 const size_t tgt_num_rows,
685 const size_t tgt_num_nonzeros,
686 const int my_tgt_pid)
689 using Kokkos::subview;
690 using Kokkos::parallel_for;
691 using Kokkos::MemoryUnmanaged;
692 using packet_type = Packet;
693 using local_map_type = LocalMap;
694 using local_graph_type = LocalGraph;
695 using buffer_device_type = BufferDevice;
698 using execution_space =
typename device_type::execution_space;
699 using size_type =
typename Kokkos::View<LO*, device_type>::size_type;
700 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<size_t>>;
702 const char prefix[] =
"UnpackAndCombineCrsGraphImpl::unpackAndCombineIntoCrsArrays: ";
704 const size_t N = tgt_num_rows;
705 const size_t mynnz = tgt_num_nonzeros;
709 const int my_pid = my_tgt_pid;
718 range_policy(0, N+1),
719 KOKKOS_LAMBDA(
const size_t i) {
726 range_policy(0, num_same_ids),
727 KOKKOS_LAMBDA(
const size_t i) {
728 const LO tgt_lid =
static_cast<LO
>(i);
729 const LO src_lid =
static_cast<LO
>(i);
730 tgt_rowptr(tgt_lid) = local_graph.row_map(src_lid+1)
731 - local_graph.row_map(src_lid);
736 const size_type num_permute_to_lids = permute_to_lids.extent(0);
738 range_policy(0, num_permute_to_lids),
739 KOKKOS_LAMBDA(
const size_t i) {
740 const LO tgt_lid = permute_to_lids(i);
741 const LO src_lid = permute_from_lids(i);
742 tgt_rowptr(tgt_lid) = local_graph.row_map(src_lid+1)
743 - local_graph.row_map(src_lid);
748 const size_type num_import_lids = import_lids.extent(0);
749 View<size_t*, device_type> offsets(
"offsets", num_import_lids+1);
752#ifdef HAVE_TPETRA_DEBUG
754 auto nth_offset_h = getEntryOnHost(offsets, num_import_lids);
755 const bool condition =
756 nth_offset_h !=
static_cast<size_t>(imports.extent(0));
757 TEUCHOS_TEST_FOR_EXCEPTION
758 (condition, std::logic_error, prefix
759 <<
"The final offset in bytes " << nth_offset_h
760 <<
" != imports.size() = " << imports.extent(0)
761 <<
". Please report this bug to the Tpetra developers.");
766 setupRowPointersForRemotes<packet_type,LO,device_type,buffer_device_type>(
767 tgt_rowptr, import_lids, imports, num_packets_per_lid);
771 View<size_t*, device_type> new_start_row(
"new_start_row", N+1);
774 makeCrsRowPtrFromLengths(tgt_rowptr, new_start_row);
776 auto nth_tgt_rowptr_h = getEntryOnHost(tgt_rowptr, N);
777 bool condition = nth_tgt_rowptr_h != mynnz;
778 TEUCHOS_TEST_FOR_EXCEPTION(condition, std::invalid_argument,
779 prefix <<
"CRS_rowptr[last] = " <<
780 nth_tgt_rowptr_h <<
"!= mynnz = " << mynnz <<
".");
784 copyDataFromSameIDs<LocalGraph,LocalMap>(tgt_colind, tgt_pids, new_start_row,
785 tgt_rowptr, src_pids, local_graph, local_col_map, num_same_ids, my_pid);
787 copyDataFromPermuteIDs<LocalGraph,LocalMap>(tgt_colind, tgt_pids, new_start_row,
788 tgt_rowptr, src_pids, permute_to_lids, permute_from_lids,
789 local_graph, local_col_map, my_pid);
791 if (imports.extent(0) <= 0) {
795 unpackAndCombineIntoCrsArrays2<
796 packet_type,local_graph_type,local_map_type,buffer_device_type>(
797 tgt_colind, tgt_pids, new_start_row, offsets, import_lids, imports,
798 num_packets_per_lid, local_graph, local_col_map, my_pid);
852template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
856 const Teuchos::ArrayView<const LocalOrdinal> &
importLIDs,
865 using Kokkos::MemoryUnmanaged;
867 using device_type =
typename Node::device_type;
871 const char prefix[] =
"unpackAndCombineWithOwningPIDsCount: ";
882 "CrsGraph 'sourceGraph' must be locally indexed.");
888 auto local_graph =
sourceGraph.getLocalGraphDevice();
893 "permute_from_lids");
897 imports.size(),
true,
903 "num_packets_per_lid");
905 return UnpackAndCombineCrsGraphImpl::unpackAndCombineWithOwningPIDsCount<
906 packet_type,local_graph_device_type,buffer_device_type>(
923template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
927 const Teuchos::ArrayView<const LocalOrdinal>&
importLIDs,
932 const size_t numSameIDs,
939 const Teuchos::ArrayView<GlobalOrdinal>&
CRS_colind,
940 const Teuchos::ArrayView<const int>&
SourcePids,
944 using Kokkos::deep_copy;
945 using Teuchos::outArg;
946 using Teuchos::REDUCE_MAX;
947 using Teuchos::reduceAll;
951 using packet_type =
typename crs_graph_type::packet_type;
952 using local_graph_device_type =
typename crs_graph_type::local_graph_device_type;
953 using buffer_device_type =
typename crs_graph_type::buffer_device_type;
954 using device_type =
typename Node::device_type;
955 using size_type =
typename Teuchos::ArrayView<const LO>::size_type;
957 const char prefix[] =
"Tpetra::Details::unpackAndCombineIntoCrsArrays: ";
961 std::invalid_argument,
prefix <<
"CRS_rowptr.size() = " <<
982 auto local_graph =
sourceGraph.getLocalGraphDevice();
983 auto local_col_map =
sourceGraph.getColMap()->getLocalMap();
994 Kokkos::View<const packet_type*, buffer_device_type>
imports_d =
997 imports.size(),
true,
"imports");
1002 true,
"num_packets_per_lid");
1007 true,
"permute_to_lids");
1012 true,
"permute_from_lids");
1017 true,
"crs_rowptr");
1022 true,
"crs_colidx");
1024 Kokkos::View<const int*, device_type>
src_pids_d =
1034 using local_map_type =
decltype(local_col_map);
1035 UnpackAndCombineCrsGraphImpl::unpackAndCombineIntoCrsArrays<
1036 packet_type,local_graph_device_type,local_map_type,buffer_device_type>(
1061#define TPETRA_DETAILS_UNPACKCRSGRAPHANDCOMBINE_INSTANT( LO, GO, NT ) \
1063 Details::unpackAndCombineIntoCrsArrays<LO, GO, NT>( \
1064 const CrsGraph<LO, GO, NT> &, \
1065 const Teuchos::ArrayView<const LO>&, \
1066 const Teuchos::ArrayView<const typename CrsGraph<LO,GO,NT>::packet_type>&, \
1067 const Teuchos::ArrayView<const size_t>&, \
1069 const CombineMode, \
1071 const Teuchos::ArrayView<const LO>&, \
1072 const Teuchos::ArrayView<const LO>&, \
1076 const Teuchos::ArrayView<size_t>&, \
1077 const Teuchos::ArrayView<GO>&, \
1078 const Teuchos::ArrayView<const int>&, \
1079 Teuchos::Array<int>&); \
1081 Details::unpackAndCombineWithOwningPIDsCount<LO, GO, NT>( \
1082 const CrsGraph<LO, GO, NT> &, \
1083 const Teuchos::ArrayView<const LO> &, \
1084 const Teuchos::ArrayView<const typename CrsGraph<LO,GO,NT>::packet_type> &, \
1085 const Teuchos::ArrayView<const size_t>&, \
1089 const Teuchos::ArrayView<const LO>&, \
1090 const Teuchos::ArrayView<const LO>&);
Declaration of the Tpetra::CrsGraph class.
Declaration of Tpetra::Details::Behavior, a class that describes Tpetra's behavior.
Import KokkosSparse::OrdinalTraits, a traits class for "invalid" (flag) values of integer types,...
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,...
Functions for manipulating CRS arrays.
Declaration and definition of Tpetra::Details::getEntryOnHost.
void unpackAndCombine(const RowView &row_ptrs_beg, const RowView &row_ptrs_end, IndicesView &indices, const Kokkos::View< const GlobalOrdinal *, BufferDevice, Kokkos::MemoryUnmanaged > &imports, const Kokkos::View< const size_t *, BufferDevice, Kokkos::MemoryUnmanaged > &num_packets_per_lid, const Kokkos::View< const LocalOrdinal *, BufferDevice, Kokkos::MemoryUnmanaged > &import_lids, const typename CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::padding_type &padding, const bool unpack_pids, const int myRank, const bool verbose)
Perform the unpack operation for the graph.
KOKKOS_FUNCTION int unpackRow(const Kokkos::View< GO *, Device, Kokkos::MemoryUnmanaged > &gids_out, const Kokkos::View< int *, Device, Kokkos::MemoryUnmanaged > &pids_out, const Kokkos::View< const Packet *, BufferDevice > &imports, const size_t offset, const size_t num_ent)
Unpack a single row of a CrsGraph.
void setupRowPointersForRemotes(const Kokkos::View< size_t *, Device > &tgt_rowptr, const Kokkos::View< const LO *, BufferDevice > &import_lids, const Kokkos::View< const Packet *, BufferDevice > &, const Kokkos::View< const size_t *, BufferDevice > &num_packets_per_lid)
Setup row pointers for remotes.
A distributed graph accessed by rows (adjacency lists) and stored sparsely.
Kokkos::StaticCrsGraph< local_ordinal_type, Kokkos::LayoutLeft, device_type, void, size_t > local_graph_device_type
The type of the part of the sparse graph on each MPI process.
typename dist_object_type::buffer_device_type buffer_device_type
Kokkos::Device specialization for communication buffers.
Struct that holds views of the contents of a CrsMatrix.
LocalOrdinal local_ordinal_type
The type of local indices.
GlobalOrdinal global_ordinal_type
The type of global indices.
DeviceType device_type
The device type.
Unpacks and combines a single row of the CrsGraph.
Implementation details of Tpetra.
void padCrsArrays(const RowPtr &rowPtrBeg, const RowPtr &rowPtrEnd, Indices &indices_wdv, const Padding &padding, const int my_rank, const bool verbose)
Determine if the row pointers and indices arrays need to be resized to accommodate new entries....
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.
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.