Tpetra parallel linear algebra Version of the Day
|
Functions for packing the entries of a Tpetra::CrsMatrix for communication, in the case where it is valid to go to the KokkosSparse::CrsMatrix (local sparse matrix data structure) directly. More...
#include "TpetraCore_config.h"
#include "Teuchos_Array.hpp"
#include "Teuchos_ArrayView.hpp"
#include "Tpetra_Details_Behavior.hpp"
#include "Tpetra_Details_castAwayConstDualView.hpp"
#include "Tpetra_Details_createMirrorView.hpp"
#include "Tpetra_Details_getEntryOnHost.hpp"
#include "Tpetra_Details_OrdinalTraits.hpp"
#include "Tpetra_Details_PackTraits.hpp"
#include "Tpetra_Details_Profiling.hpp"
#include "Tpetra_CrsMatrix_decl.hpp"
#include <memory>
#include <sstream>
#include <stdexcept>
#include <string>
Go to the source code of this file.
Classes | |
class | Tpetra::Details::PackCrsMatrixImpl::NumPacketsAndOffsetsFunctor< OutputOffsetsViewType, CountsViewType, InputOffsetsViewType, InputLocalRowIndicesViewType, InputLocalRowPidsViewType, debug > |
Compute the number of packets and offsets for the pack procedure. More... | |
Namespaces | |
namespace | Tpetra |
Namespace Tpetra contains the class and methods constituting the Tpetra library. | |
namespace | Tpetra::Details |
Nonmember function that computes a residual Computes R = B - A * X. | |
Functions | |
template<class OutputOffsetsViewType , class CountsViewType , class InputOffsetsViewType , class InputLocalRowIndicesViewType , class InputLocalRowPidsViewType > | |
CountsViewType::non_const_value_type | Tpetra::Details::PackCrsMatrixImpl::computeNumPacketsAndOffsets (const OutputOffsetsViewType &outputOffsets, const CountsViewType &counts, const InputOffsetsViewType &rowOffsets, const InputLocalRowIndicesViewType &lclRowInds, const InputLocalRowPidsViewType &lclRowPids, const typename CountsViewType::non_const_value_type sizeOfLclCount, const typename CountsViewType::non_const_value_type sizeOfGblColInd, const typename CountsViewType::non_const_value_type sizeOfPid, const typename CountsViewType::non_const_value_type sizeOfValue) |
Compute the number of packets and offsets for the pack procedure. | |
template<class ST , class ColumnMap , class BufferDeviceType > | |
KOKKOS_FUNCTION Kokkos::pair< int, size_t > | Tpetra::Details::PackCrsMatrixImpl::packCrsMatrixRow (const ColumnMap &col_map, const Kokkos::View< char *, BufferDeviceType > &exports, const typename PackTraits< typename ColumnMap::local_ordinal_type >::input_array_type &lids_in, const typename PackTraits< int >::input_array_type &pids_in, const typename PackTraits< ST >::input_array_type &vals_in, const size_t offset, const size_t num_ent, const size_t num_bytes_per_value, const bool pack_pids) |
Packs a single row of the CrsMatrix. | |
template<class LocalMatrix , class LocalMap , class BufferDeviceType > | |
void | Tpetra::Details::PackCrsMatrixImpl::do_pack (const LocalMatrix &local_matrix, const LocalMap &local_map, const Kokkos::View< char *, BufferDeviceType > &exports, const typename PackTraits< size_t >::input_array_type &num_packets_per_lid, const typename PackTraits< typename LocalMap::local_ordinal_type >::input_array_type &export_lids, const typename PackTraits< int >::input_array_type &source_pids, const Kokkos::View< const size_t *, BufferDeviceType > &offsets, const size_t num_bytes_per_value, const bool pack_pids) |
Perform the pack operation for the matrix. | |
template<typename ST , typename LO , typename GO , typename NT , typename BufferDeviceType > | |
void | Tpetra::Details::PackCrsMatrixImpl::packCrsMatrix (const CrsMatrix< ST, LO, GO, NT > &sourceMatrix, Kokkos::DualView< char *, BufferDeviceType > &exports, const Kokkos::View< size_t *, BufferDeviceType > &num_packets_per_lid, const Kokkos::View< const LO *, BufferDeviceType > &export_lids, const Kokkos::View< const int *, typename NT::device_type > &export_pids, size_t &constant_num_packets, const bool pack_pids) |
Pack specified entries of the given local sparse matrix for communication. | |
template<typename ST , typename LO , typename GO , typename NT > | |
void | Tpetra::Details::packCrsMatrix (const CrsMatrix< ST, LO, GO, NT > &sourceMatrix, Teuchos::Array< char > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, const Teuchos::ArrayView< const LO > &exportLIDs, size_t &constantNumPackets) |
Pack specified entries of the given local sparse matrix for communication. | |
template<typename ST , typename LO , typename GO , typename NT > | |
void | Tpetra::Details::packCrsMatrixNew (const CrsMatrix< ST, LO, GO, NT > &sourceMatrix, Kokkos::DualView< char *, typename DistObject< char, LO, GO, NT >::buffer_device_type > &exports, const Kokkos::DualView< size_t *, typename DistObject< char, LO, GO, NT >::buffer_device_type > &numPacketsPerLID, const Kokkos::DualView< const LO *, typename DistObject< char, LO, GO, NT >::buffer_device_type > &exportLIDs, size_t &constantNumPackets) |
Pack specified entries of the given local sparse matrix for communication, for "new" DistObject interface. | |
template<typename ST , typename LO , typename GO , typename NT > | |
void | Tpetra::Details::packCrsMatrixWithOwningPIDs (const CrsMatrix< ST, LO, GO, NT > &sourceMatrix, Kokkos::DualView< char *, typename DistObject< char, LO, GO, NT >::buffer_device_type > &exports_dv, const Teuchos::ArrayView< size_t > &numPacketsPerLID, const Teuchos::ArrayView< const LO > &exportLIDs, const Teuchos::ArrayView< const int > &sourcePIDs, size_t &constantNumPackets) |
Pack specified entries of the given local sparse matrix for communication. | |
Functions for packing the entries of a Tpetra::CrsMatrix for communication, in the case where it is valid to go to the KokkosSparse::CrsMatrix (local sparse matrix data structure) directly.
Data (bytes) describing the row of the CRS matrix are "packed" (concatenated) in to a (view of) char* object in the following order:
The functions in this file are companions to Tpetra_Details_unpackCrsMatrixAndCombine.hpp, i.e., Tpetra_Details_unpackCrsMatrixAndCombine.hpp implements the reverse of the packing order described above to ensure proper unpacking.
Definition in file Tpetra_Details_packCrsMatrix_def.hpp.
CountsViewType::non_const_value_type Tpetra::Details::PackCrsMatrixImpl::computeNumPacketsAndOffsets | ( | const OutputOffsetsViewType & | outputOffsets, |
const CountsViewType & | counts, | ||
const InputOffsetsViewType & | rowOffsets, | ||
const InputLocalRowIndicesViewType & | lclRowInds, | ||
const InputLocalRowPidsViewType & | lclRowPids, | ||
const typename CountsViewType::non_const_value_type | sizeOfLclCount, | ||
const typename CountsViewType::non_const_value_type | sizeOfGblColInd, | ||
const typename CountsViewType::non_const_value_type | sizeOfPid, | ||
const typename CountsViewType::non_const_value_type | sizeOfValue | ||
) |
Compute the number of packets and offsets for the pack procedure.
OutputOffsetsViewType | the type of the output offsets view |
CountsViewType | the type of the counts view |
InputOffsetsViewType | the type of the input offsets view |
InputLocalRowIndicesViewType | the type of the local row indices view |
InputLocalRowPidsViewType | the type of the local process IDs view |
This is the high level interface to the NumPacketsAndOffsetsFunctor functor
Definition at line 277 of file Tpetra_Details_packCrsMatrix_def.hpp.
KOKKOS_FUNCTION Kokkos::pair< int, size_t > Tpetra::Details::PackCrsMatrixImpl::packCrsMatrixRow | ( | const ColumnMap & | col_map, |
const Kokkos::View< char *, BufferDeviceType > & | exports, | ||
const typename PackTraits< typename ColumnMap::local_ordinal_type >::input_array_type & | lids_in, | ||
const typename PackTraits< int >::input_array_type & | pids_in, | ||
const typename PackTraits< ST >::input_array_type & | vals_in, | ||
const size_t | offset, | ||
const size_t | num_ent, | ||
const size_t | num_bytes_per_value, | ||
const bool | pack_pids | ||
) |
Packs a single row of the CrsMatrix.
ST | The type of the numerical entries of the matrix. (You can use real-valued or complex-valued types here, unlike in Epetra, where the scalar type is always double .) |
ColumnMap | the type of the local column map |
Data (bytes) describing the row of the CRS matrix are "packed" (concatenated) in to a single (view of) char* in the following order:
Definition at line 404 of file Tpetra_Details_packCrsMatrix_def.hpp.
void Tpetra::Details::PackCrsMatrixImpl::do_pack | ( | const LocalMatrix & | local_matrix, |
const LocalMap & | local_map, | ||
const Kokkos::View< char *, BufferDeviceType > & | exports, | ||
const typename PackTraits< size_t >::input_array_type & | num_packets_per_lid, | ||
const typename PackTraits< typename LocalMap::local_ordinal_type >::input_array_type & | export_lids, | ||
const typename PackTraits< int >::input_array_type & | source_pids, | ||
const Kokkos::View< const size_t *, BufferDeviceType > & | offsets, | ||
const size_t | num_bytes_per_value, | ||
const bool | pack_pids | ||
) |
Perform the pack operation for the matrix.
LocalMatrix | the specialization of the KokkosSparse::CrsMatrix local matrix |
LocalMap | the type of the local column map |
This is a higher level interface to the PackCrsMatrixFunctor
Definition at line 635 of file Tpetra_Details_packCrsMatrix_def.hpp.
void Tpetra::Details::PackCrsMatrixImpl::packCrsMatrix | ( | const CrsMatrix< ST, LO, GO, NT > & | sourceMatrix, |
Kokkos::DualView< char *, BufferDeviceType > & | exports, | ||
const Kokkos::View< size_t *, BufferDeviceType > & | num_packets_per_lid, | ||
const Kokkos::View< const LO *, BufferDeviceType > & | export_lids, | ||
const Kokkos::View< const int *, typename NT::device_type > & | export_pids, | ||
size_t & | constant_num_packets, | ||
const bool | pack_pids | ||
) |
Pack specified entries of the given local sparse matrix for communication.
ST | The type of the numerical entries of the matrix. (You can use real-valued or complex-valued types here, unlike in Epetra, where the scalar type is always double .) |
LO | The type of local indices. See the documentation of Map for requirements. |
GO | The type of global indices. See the documentation of Map for requirements. |
NT | The Kokkos Node type. See the documentation of Map for requirements. |
sourceMatrix | [in] the CrsMatrix source |
exports | [in/out] Output pack buffer; resized if needed. |
num_packets_per_lid | [out] Entry k gives the number of bytes packed for row export_lids[k] of the local matrix. |
export_lids | [in] Local indices of the rows to pack. |
export_pids | [in] Process ranks for the column indices in each packed row. |
constant_num_packets | [out] Setting this to zero tells the caller to expect a possibly /// different ("nonconstant") number of packets per local index (i.e., a possibly different number of entries per row). |
Definition at line 725 of file Tpetra_Details_packCrsMatrix_def.hpp.