10#ifndef TPETRA_DETAILS_UNPACKCRSGRAPHANDCOMBINE_DEF_HPP
11#define TPETRA_DETAILS_UNPACKCRSGRAPHANDCOMBINE_DEF_HPP
13#include "TpetraCore_config.h"
14#include "Teuchos_Array.hpp"
15#include "Teuchos_ArrayView.hpp"
24#include "Kokkos_Core.hpp"
54namespace UnpackAndCombineCrsGraphImpl {
65template<
class Packet,
class GO,
class Device,
class BufferDevice>
68 const Kokkos::View<int*,Device,Kokkos::MemoryUnmanaged>&
pids_out,
69 const Kokkos::View<const Packet*,BufferDevice>& imports,
73 using size_type =
typename Kokkos::View<GO*,Device>::size_type;
112 using GO =
typename IndicesView::value_type;
118 using device_type =
typename IndicesView::device_type;
119 using execution_space =
typename device_type::execution_space;
121 using num_packets_per_lid_type = Kokkos::View<const size_t*, buffer_device_type>;
122 using offsets_type = Kokkos::View<const size_t*, device_type>;
123 using input_buffer_type = Kokkos::View<const packet_type*, buffer_device_type>;
124 using import_lids_type = Kokkos::View<const LO*, buffer_device_type>;
126 using gids_scratch_type = Kokkos::View<GO*, device_type>;
127 using pids_scratch_type = Kokkos::View<int*,device_type>;
132 input_buffer_type imports;
133 num_packets_per_lid_type num_packets_per_lid;
134 import_lids_type import_lids;
135 offsets_type offsets;
138 Kokkos::Experimental::UniqueToken<execution_space,
139 Kokkos::Experimental::UniqueTokenScope::Global> tokens;
140 gids_scratch_type gids_scratch;
141 pids_scratch_type pids_scratch;
144 using value_type = Kokkos::pair<int, LO>;
165 tokens(execution_space()),
166 gids_scratch(
"gids_scratch", tokens.size() * max_num_ent),
167 pids_scratch(
"pids_scratch", tokens.size() * max_num_ent)
172 using Tpetra::Details::OrdinalTraits;
177 join(value_type& dst,
const value_type& src)
const
183 using Tpetra::Details::OrdinalTraits;
190 src.second < dst.second) {
197 void operator()(
const LO i, value_type& dst)
const
200 using Kokkos::subview;
201 using Kokkos::MemoryUnmanaged;
202 using size_type =
typename execution_space::size_type;
203 using slice =
typename Kokkos::pair<size_type, size_type>;
214 dst = Kokkos::make_pair(1,
i);
224 const size_t buf_size = imports.size();
225 const size_t offset = offsets(
i);
228 dst = Kokkos::make_pair(2,
i);
235 const size_type
token = tokens.acquire();
236 const size_t a =
static_cast<size_t>(
token) * max_num_ent;
244 dst = Kokkos::make_pair(3,
i);
245 tokens.release(
token);
256 tokens.release(
token);
275 Kokkos::MemoryUnmanaged>& imports,
277 Kokkos::MemoryUnmanaged>& num_packets_per_lid,
279 Kokkos::MemoryUnmanaged>& import_lids,
282 const bool unpack_pids,
288 using device_type =
typename Node::device_type;
289 using execution_space =
typename BufferDevice::execution_space;
291 Kokkos::RangePolicy<execution_space, Kokkos::IndexType<LO>>;
296 "Tpetra::Details::UnpackAndCombineCrsGraphImpl::unpackAndCombine: ";
298 const size_t num_import_lids =
static_cast<size_t>(import_lids.extent(0));
309 Kokkos::View<size_t*, device_type> offsets(
"offsets",
num_import_lids+1);
316 Kokkos::parallel_reduce
326 }, Kokkos::Max<size_t> (max_num_ent));
330 num_packets_per_lid, import_lids, offsets,
331 max_num_ent, unpack_pids);
333 typename unpack_functor_type::value_type
x;
335 auto x_h =
x.to_std_pair();
337 prefix <<
"UnpackAndCombineFunctor reported error code "
338 <<
x_h.first <<
" for the first bad row " <<
x_h.second);
341template<
class Packet,
class LocalGraph,
class BufferDevice>
345 const Kokkos::View<
const typename LocalGraph::data_type*,
346 typename LocalGraph::device_type,
348 const Kokkos::View<const Packet*, BufferDevice>& ,
349 const Kokkos::View<const size_t*, BufferDevice>& num_packets_per_lid,
352 using Kokkos::parallel_reduce;
354 using LO =
typename local_graph_type::data_type;
355 using device_type =
typename local_graph_type::device_type;
356 using execution_space =
typename device_type::execution_space;
357 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<LO>>;
369 update +=
static_cast<size_t>(local_graph.row_map[
lid+1]
370 -local_graph.row_map[
lid]);
376 num_items =
static_cast<LO
>(permute_from_lids.extent(0));
380 range_policy(0, num_items),
381 KOKKOS_LAMBDA(
const LO i,
size_t& update) {
382 const LO lid = permute_from_lids(i);
383 update +=
static_cast<size_t>(local_graph.row_map[lid+1]
384 - local_graph.row_map[lid]);
391 size_t tot_num_ent = 0;
392 parallel_reduce(
"SumReduce",
393 range_policy(0,num_packets_per_lid.size()),
394 KOKKOS_LAMBDA(
const int& i,
size_t& lsum) {
395 lsum += num_packets_per_lid(i) / 2;
396 }, Kokkos::Sum<size_t>(tot_num_ent));
397 count += tot_num_ent;
404template<
class Packet,
class LO,
class Device,
class BufferDevice>
407 const Kokkos::View<size_t*, Device>&
tgt_rowptr,
408 const Kokkos::View<const LO*, BufferDevice>& import_lids,
409 const Kokkos::View<const Packet*, BufferDevice>& ,
410 const Kokkos::View<const size_t*, BufferDevice>& num_packets_per_lid)
412 using Kokkos::parallel_reduce;
413 using device_type = Device;
414 using execution_space =
typename device_type::execution_space;
415 using size_type =
typename Kokkos::View<size_t*,device_type>::size_type;
416 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<size_type>>;
418 const size_type
N = num_packets_per_lid.extent(0);
430template<
class Device>
432makeCrsRowPtrFromLengths(
433 const Kokkos::View<size_t*,Device,Kokkos::MemoryUnmanaged>&
tgt_rowptr,
436 using Kokkos::parallel_scan;
437 using device_type = Device;
438 using execution_space =
typename device_type::execution_space;
439 using size_type =
typename Kokkos::View<size_t*,device_type>::size_type;
440 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<size_type>>;
444 KOKKOS_LAMBDA(
const size_t&
i,
size_t& update,
const bool&
final) {
455template<
class LocalGraph,
class LocalMap>
460 const Kokkos::View<int*, typename LocalMap::device_type>& tgt_pids,
461 const Kokkos::View<size_t*,typename LocalMap::device_type>& new_start_row,
462 const Kokkos::View<size_t*, typename LocalMap::device_type>& tgt_rowptr,
463 const Kokkos::View<const int*, typename LocalMap::device_type>& src_pids,
464 const LocalGraph& local_graph,
465 const LocalMap& local_col_map,
466 const size_t num_same_ids,
469 using Kokkos::parallel_for;
472 using execution_space =
typename device_type::execution_space;
473 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<size_t>>;
476 range_policy(0, num_same_ids),
477 KOKKOS_LAMBDA(
const size_t i) {
478 using atomic_incr_type =
typename std::remove_reference<
decltype(new_start_row(0))>::type;
480 const LO src_lid =
static_cast<LO
>(i);
481 size_t src_row = local_graph.row_map(src_lid);
483 const LO tgt_lid =
static_cast<LO
>(i);
484 const size_t tgt_row = tgt_rowptr(tgt_lid);
486 const size_t nsr = local_graph.row_map(src_lid+1)
487 - local_graph.row_map(src_lid);
488 Kokkos::atomic_fetch_add(&new_start_row(tgt_lid), atomic_incr_type(nsr));
490 for (
size_t j=local_graph.row_map(src_lid);
491 j<local_graph.row_map(src_lid+1); ++j) {
492 LO src_col = local_graph.entries(j);
493 tgt_colind(tgt_row + j - src_row) = local_col_map.getGlobalElement(src_col);
494 tgt_pids(tgt_row + j - src_row) = (src_pids(src_col) != my_pid) ? src_pids(src_col) : -1;
500template<
class LocalGraph,
class LocalMap,
class BufferDevice>
502copyDataFromPermuteIDs(
505 const Kokkos::View<
int*,
507 const Kokkos::View<
size_t*,
509 const Kokkos::View<
size_t*,
511 const Kokkos::View<
const int*,
514 BufferDevice, Kokkos::MemoryUnmanaged>& permute_to_lids,
516 BufferDevice, Kokkos::MemoryUnmanaged>& permute_from_lids,
517 const LocalGraph& local_graph,
518 const LocalMap& local_col_map,
521 using Kokkos::parallel_for;
524 using execution_space =
typename device_type::execution_space;
525 using size_type =
typename Kokkos::View<LO*,device_type>::size_type;
526 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<size_type>>;
528 const size_type num_permute_to_lids = permute_to_lids.extent(0);
531 range_policy(0, num_permute_to_lids),
532 KOKKOS_LAMBDA(
const size_t i) {
533 using atomic_incr_type =
typename std::remove_reference<
decltype(new_start_row(0))>::type;
535 const LO src_lid = permute_from_lids(i);
536 const size_t src_row = local_graph.row_map(src_lid);
538 const LO tgt_lid = permute_to_lids(i);
539 const size_t tgt_row = tgt_rowptr(tgt_lid);
541 size_t nsr = local_graph.row_map(src_lid+1)
542 - local_graph.row_map(src_lid);
543 Kokkos::atomic_fetch_add(&new_start_row(tgt_lid), atomic_incr_type(nsr));
545 for (
size_t j=local_graph.row_map(src_lid);
546 j<local_graph.row_map(src_lid+1); ++j) {
547 LO src_col = local_graph.entries(j);
548 tgt_colind(tgt_row + j - src_row) = local_col_map.getGlobalElement(src_col);
549 tgt_pids(tgt_row + j - src_row) = (src_pids(src_col) != my_pid) ? src_pids(src_col) : -1;
555template<
class Packet,
class LocalGraph,
class LocalMap,
class BufferDevice>
557unpackAndCombineIntoCrsArrays2(
558 const Kokkos::View<typename LocalMap::global_ordinal_type*, typename LocalMap::device_type>& tgt_colind,
559 const Kokkos::View<int*, typename LocalMap::device_type>& tgt_pids,
560 const Kokkos::View<size_t*,typename LocalMap::device_type>& new_start_row,
561 const Kokkos::View<const size_t*, typename LocalMap::device_type>& offsets,
565 Kokkos::MemoryUnmanaged>& import_lids,
566 const Kokkos::View<const Packet*, BufferDevice>& imports,
567 const Kokkos::View<const size_t*, BufferDevice>& num_packets_per_lid,
573 using Kokkos::subview;
574 using Kokkos::MemoryUnmanaged;
575 using Kokkos::parallel_reduce;
576 using Kokkos::atomic_fetch_add;
581 using execution_space =
typename device_type::execution_space;
582 using size_type =
typename Kokkos::View<LO*, device_type>::size_type;
583 using slice =
typename Kokkos::pair<size_type, size_type>;
584 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<size_type>>;
586 using pids_out_type = View<int*,device_type, MemoryUnmanaged>;
587 using gids_out_type = View<GO*, device_type, MemoryUnmanaged>;
589 const size_type num_import_lids = import_lids.size();
590 const char prefix[] =
"UnpackAndCombineCrsGraphImpl::unpackAndCombineIntoCrsArrays2: ";
594 parallel_reduce(
"Unpack and combine into CRS",
595 range_policy(0, num_import_lids),
596 KOKKOS_LAMBDA(
const size_t i,
int& err) {
597 using atomic_incr_type =
typename std::remove_reference<
decltype( new_start_row(0) )>::type;
598 const size_t num_packets_this_lid = num_packets_per_lid(i);
599 const size_t num_ent = num_packets_this_lid / 2;
600 const size_t offset = offsets(i);
601 const LO lcl_row = import_lids(i);
602 const size_t start_row = atomic_fetch_add(&new_start_row(lcl_row), atomic_incr_type(num_ent));
603 const size_t end_row = start_row + num_ent;
605 gids_out_type gids_out = subview(tgt_colind, slice(start_row, end_row));
606 pids_out_type pids_out = subview(tgt_pids, slice(start_row, end_row));
608 err +=
unpackRow (gids_out, pids_out, imports, offset, num_ent);
611 for (
size_t j = 0; j < static_cast<size_t>(num_ent); ++j) {
612 const int pid = pids_out(j);
613 pids_out(j) = (pid != my_pid) ? pid : -1;
617 TEUCHOS_TEST_FOR_EXCEPTION(gbl_err_count != 0,
618 std::invalid_argument, prefix <<
619 "Attempting to unpack PIDs, but num_ent is not even; this should never "
620 "happen! Please report this bug to the Tpetra developers.");
625template<
class Packet,
class LocalGraph,
class LocalMap,
class BufferDevice>
628 const LocalGraph & local_graph,
629 const LocalMap & local_col_map,
632 Kokkos::MemoryUnmanaged>& import_lids,
633 const Kokkos::View<const Packet*, BufferDevice>& imports,
634 const Kokkos::View<const size_t*, BufferDevice>& num_packets_per_lid,
637 Kokkos::MemoryUnmanaged>& permute_to_lids,
640 Kokkos::MemoryUnmanaged>& permute_from_lids,
641 const Kokkos::View<
size_t*,
643 Kokkos::MemoryUnmanaged>& tgt_rowptr,
646 Kokkos::MemoryUnmanaged>& tgt_colind,
647 const Kokkos::View<
const int*,
649 Kokkos::MemoryUnmanaged>& src_pids,
650 const Kokkos::View<
int*,
652 Kokkos::MemoryUnmanaged>& tgt_pids,
653 const size_t num_same_ids,
654 const size_t tgt_num_rows,
655 const size_t tgt_num_nonzeros,
656 const int my_tgt_pid)
659 using Kokkos::subview;
660 using Kokkos::parallel_for;
661 using Kokkos::MemoryUnmanaged;
662 using packet_type = Packet;
663 using local_map_type = LocalMap;
664 using local_graph_type = LocalGraph;
665 using buffer_device_type = BufferDevice;
668 using execution_space =
typename device_type::execution_space;
669 using size_type =
typename Kokkos::View<LO*, device_type>::size_type;
670 using range_policy = Kokkos::RangePolicy<execution_space, Kokkos::IndexType<size_t>>;
672 const char prefix[] =
"UnpackAndCombineCrsGraphImpl::unpackAndCombineIntoCrsArrays: ";
674 const size_t N = tgt_num_rows;
675 const size_t mynnz = tgt_num_nonzeros;
679 const int my_pid = my_tgt_pid;
688 range_policy(0, N+1),
689 KOKKOS_LAMBDA(
const size_t i) {
696 range_policy(0, num_same_ids),
697 KOKKOS_LAMBDA(
const size_t i) {
698 const LO tgt_lid =
static_cast<LO
>(i);
699 const LO src_lid =
static_cast<LO
>(i);
700 tgt_rowptr(tgt_lid) = local_graph.row_map(src_lid+1)
701 - local_graph.row_map(src_lid);
706 const size_type num_permute_to_lids = permute_to_lids.extent(0);
708 range_policy(0, num_permute_to_lids),
709 KOKKOS_LAMBDA(
const size_t i) {
710 const LO tgt_lid = permute_to_lids(i);
711 const LO src_lid = permute_from_lids(i);
712 tgt_rowptr(tgt_lid) = local_graph.row_map(src_lid+1)
713 - local_graph.row_map(src_lid);
718 const size_type num_import_lids = import_lids.extent(0);
719 View<size_t*, device_type> offsets(
"offsets", num_import_lids+1);
722#ifdef HAVE_TPETRA_DEBUG
724 auto nth_offset_h = getEntryOnHost(offsets, num_import_lids);
725 const bool condition =
726 nth_offset_h !=
static_cast<size_t>(imports.extent(0));
727 TEUCHOS_TEST_FOR_EXCEPTION
728 (condition, std::logic_error, prefix
729 <<
"The final offset in bytes " << nth_offset_h
730 <<
" != imports.size() = " << imports.extent(0)
731 <<
". Please report this bug to the Tpetra developers.");
736 setupRowPointersForRemotes<packet_type,LO,device_type,buffer_device_type>(
737 tgt_rowptr, import_lids, imports, num_packets_per_lid);
741 View<size_t*, device_type> new_start_row(
"new_start_row", N+1);
744 makeCrsRowPtrFromLengths(tgt_rowptr, new_start_row);
746 auto nth_tgt_rowptr_h = getEntryOnHost(tgt_rowptr, N);
747 bool condition = nth_tgt_rowptr_h != mynnz;
748 TEUCHOS_TEST_FOR_EXCEPTION(condition, std::invalid_argument,
749 prefix <<
"CRS_rowptr[last] = " <<
750 nth_tgt_rowptr_h <<
"!= mynnz = " << mynnz <<
".");
754 copyDataFromSameIDs<LocalGraph,LocalMap>(tgt_colind, tgt_pids, new_start_row,
755 tgt_rowptr, src_pids, local_graph, local_col_map, num_same_ids, my_pid);
757 copyDataFromPermuteIDs<LocalGraph,LocalMap>(tgt_colind, tgt_pids, new_start_row,
758 tgt_rowptr, src_pids, permute_to_lids, permute_from_lids,
759 local_graph, local_col_map, my_pid);
761 if (imports.extent(0) <= 0) {
765 unpackAndCombineIntoCrsArrays2<
766 packet_type,local_graph_type,local_map_type,buffer_device_type>(
767 tgt_colind, tgt_pids, new_start_row, offsets, import_lids, imports,
768 num_packets_per_lid, local_graph, local_col_map, my_pid);
822template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
826 const Teuchos::ArrayView<const LocalOrdinal> &
importLIDs,
835 using Kokkos::MemoryUnmanaged;
837 using device_type =
typename Node::device_type;
841 const char prefix[] =
"unpackAndCombineWithOwningPIDsCount: ";
852 "CrsGraph 'sourceGraph' must be locally indexed.");
858 auto local_graph =
sourceGraph.getLocalGraphDevice();
863 "permute_from_lids");
867 imports.size(),
true,
873 "num_packets_per_lid");
875 return UnpackAndCombineCrsGraphImpl::unpackAndCombineWithOwningPIDsCount<
876 packet_type,local_graph_device_type,buffer_device_type>(
893template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
897 const Teuchos::ArrayView<const LocalOrdinal>&
importLIDs,
902 const size_t numSameIDs,
909 const Teuchos::ArrayView<GlobalOrdinal>&
CRS_colind,
910 const Teuchos::ArrayView<const int>&
SourcePids,
914 using Kokkos::deep_copy;
915 using Teuchos::outArg;
916 using Teuchos::REDUCE_MAX;
917 using Teuchos::reduceAll;
921 using packet_type =
typename crs_graph_type::packet_type;
922 using local_graph_device_type =
typename crs_graph_type::local_graph_device_type;
923 using buffer_device_type =
typename crs_graph_type::buffer_device_type;
924 using device_type =
typename Node::device_type;
925 using size_type =
typename Teuchos::ArrayView<const LO>::size_type;
927 const char prefix[] =
"Tpetra::Details::unpackAndCombineIntoCrsArrays: ";
931 std::invalid_argument,
prefix <<
"CRS_rowptr.size() = " <<
952 auto local_graph =
sourceGraph.getLocalGraphDevice();
953 auto local_col_map =
sourceGraph.getColMap()->getLocalMap();
964 Kokkos::View<const packet_type*, buffer_device_type>
imports_d =
967 imports.size(),
true,
"imports");
972 true,
"num_packets_per_lid");
977 true,
"permute_to_lids");
982 true,
"permute_from_lids");
994 Kokkos::View<const int*, device_type>
src_pids_d =
1004 using local_map_type =
decltype(local_col_map);
1005 UnpackAndCombineCrsGraphImpl::unpackAndCombineIntoCrsArrays<
1006 packet_type,local_graph_device_type,local_map_type,buffer_device_type>(
1031#define TPETRA_DETAILS_UNPACKCRSGRAPHANDCOMBINE_INSTANT( LO, GO, NT ) \
1033 Details::unpackAndCombineIntoCrsArrays<LO, GO, NT>( \
1034 const CrsGraph<LO, GO, NT> &, \
1035 const Teuchos::ArrayView<const LO>&, \
1036 const Teuchos::ArrayView<const typename CrsGraph<LO,GO,NT>::packet_type>&, \
1037 const Teuchos::ArrayView<const size_t>&, \
1039 const CombineMode, \
1041 const Teuchos::ArrayView<const LO>&, \
1042 const Teuchos::ArrayView<const LO>&, \
1046 const Teuchos::ArrayView<size_t>&, \
1047 const Teuchos::ArrayView<GO>&, \
1048 const Teuchos::ArrayView<const int>&, \
1049 Teuchos::Array<int>&); \
1051 Details::unpackAndCombineWithOwningPIDsCount<LO, GO, NT>( \
1052 const CrsGraph<LO, GO, NT> &, \
1053 const Teuchos::ArrayView<const LO> &, \
1054 const Teuchos::ArrayView<const typename CrsGraph<LO,GO,NT>::packet_type> &, \
1055 const Teuchos::ArrayView<const size_t>&, \
1059 const Teuchos::ArrayView<const LO>&, \
1060 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.
typename dist_object_type::buffer_device_type buffer_device_type
Kokkos::Device specialization for communication buffers.
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.
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.