Template Numerical Library version\ main:bb09b17
|
CSRView is provides a non-owning encapsulation of data stored in the CSR segments format. More...
#include <TNL/Algorithms/Segments/CSRView.h>
Public Types | |
using | ConstViewType = CSRView< Device, std::add_const_t< Index > > |
Type of constant segments view. | |
template<typename Device_ , typename Index_ > | |
using | ViewTemplate = CSRView< Device_, Index_ > |
Templated view type. | |
using | ViewType = CSRView |
Type of segments view. | |
Public Types inherited from TNL::Algorithms::Segments::CSRBase< Device, Index > | |
using | ConstOffsetsView = typename OffsetsView::ConstViewType |
The type for representing the constant vector view with row offsets used in the CSR format. | |
using | DeviceType = Device |
The device where the segments are operating. | |
using | IndexType = std::remove_const_t< Index > |
The type used for indexing of segments elements. | |
using | OffsetsView = Containers::VectorView< Index, DeviceType, IndexType > |
The type for representing the vector view with row offsets used in the CSR format. | |
using | SegmentViewType = SegmentView< IndexType, RowMajorOrder > |
Accessor type fro one particular segment. | |
Public Member Functions | |
__cuda_callable__ | CSRView ()=default |
Default constructor with no parameters to create empty segments view. | |
__cuda_callable__ | CSRView (const CSRView &)=default |
Copy constructor. | |
__cuda_callable__ | CSRView (CSRView &&) noexcept=default |
Move constructor. | |
__cuda_callable__ | CSRView (typename Base::OffsetsView offsets) |
Binds a new CSR view to an offsets vector. | |
__cuda_callable__ void | bind (CSRView view) |
Method for rebinding (reinitialization) to another view. | |
__cuda_callable__ ConstViewType | getConstView () const |
Returns a constant view for this instance of CSR segments which can by used for example in lambda functions running in GPU kernels. | |
__cuda_callable__ ViewType | getView () |
Returns a view for this instance of CSR segments which can by used for example in lambda functions running in GPU kernels. | |
void | load (File &file) |
Method for loading the segments from a file in a binary form. | |
CSRView & | operator= (const CSRView &)=delete |
Copy-assignment operator. | |
CSRView & | operator= (CSRView &&)=delete |
Move-assignment operator. | |
void | save (File &file) const |
Method for saving the segments to a file in a binary form. | |
Public Member Functions inherited from TNL::Algorithms::Segments::CSRBase< Device, Index > | |
__cuda_callable__ | CSRBase ()=default |
Default constructor with no parameters to create empty segments view. | |
__cuda_callable__ | CSRBase (const CSRBase &)=default |
Copy constructor. | |
__cuda_callable__ | CSRBase (const OffsetsView &offsets) |
Binds a new CSR view to an offsets vector. | |
__cuda_callable__ | CSRBase (CSRBase &&) noexcept=default |
Move constructor. | |
__cuda_callable__ | CSRBase (OffsetsView &&offsets) |
Binds a new CSR view to an offsets vector. | |
template<typename Function > | |
void | forAllElements (Function &&function) const |
Call TNL::Algorithms::Segments::CSR::forElements for all elements of the segments. | |
template<typename Function > | |
void | forAllSegments (Function &&function) const |
Call TNL::Algorithms::Segments::CSR::forSegments for all segments. | |
template<typename Function > | |
void | forElements (IndexType begin, IndexType end, Function &&function) const |
Iterate over all elements of given segments in parallel and call given lambda function. | |
template<typename Function > | |
void | forSegments (IndexType begin, IndexType end, Function &&function) const |
Iterate over all segments in parallel and call given lambda function. | |
__cuda_callable__ IndexType | getGlobalIndex (Index segmentIdx, Index localIdx) const |
Computes the global index of an element managed by the segments. | |
__cuda_callable__ OffsetsView | getOffsets () |
Returns a modifiable vector view with row offsets used in the CSR format. | |
__cuda_callable__ ConstOffsetsView | getOffsets () const |
Returns a constant vector view with row offsets used in the CSR format. | |
__cuda_callable__ IndexType | getSegmentsCount () const |
Returns the number of segments. | |
__cuda_callable__ IndexType | getSegmentSize (IndexType segmentIdx) const |
Returns the size of a particular segment denoted by segmentIdx. | |
__cuda_callable__ SegmentViewType | getSegmentView (IndexType segmentIdx) const |
Returns segment view (i.e. segment accessor) of segment with given index. | |
__cuda_callable__ IndexType | getSize () const |
Returns the number of elements managed by all segments. | |
__cuda_callable__ IndexType | getStorageSize () const |
Returns number of elements that needs to be allocated by a container connected to this segments. | |
CSRBase & | operator= (const CSRBase &)=delete |
Copy-assignment operator. | |
CSRBase & | operator= (CSRBase &&)=delete |
Move-assignment operator. | |
template<typename Function > | |
void | sequentialForAllSegments (Function &&function) const |
Call TNL::Algorithms::Segments::CSR::sequentialForSegments for all segments. | |
template<typename Function > | |
void | sequentialForSegments (IndexType begin, IndexType end, Function &&function) const |
Call TNL::Algorithms::Segments::CSR::forSegments sequentially for particular segments. | |
Additional Inherited Members | |
Static Public Member Functions inherited from TNL::Algorithms::Segments::CSRBase< Device, Index > | |
static constexpr ElementsOrganization | getOrganization () |
Returns the data layout for the CSR format (it is always row-major order). | |
static std::string | getSegmentsType () |
Returns string with the segments type. | |
static std::string | getSerializationType () |
Returns string with the serialization type. | |
static constexpr bool | havePadding () |
This function denotes that the CSR format does not use padding elements. | |
Protected Member Functions inherited from TNL::Algorithms::Segments::CSRBase< Device, Index > | |
__cuda_callable__ void | bind (OffsetsView offsets) |
Re-initializes the internal attributes of the base class. | |
Protected Attributes inherited from TNL::Algorithms::Segments::CSRBase< Device, Index > | |
OffsetsView | offsets |
Vector view with row offsets used in the CSR format. | |
CSRView is provides a non-owning encapsulation of data stored in the CSR segments format.
Device | is type of device where the segments will be operating. |
Index | is type for indexing of the elements managed by the segments. |
using TNL::Algorithms::Segments::CSRView< Device, Index >::ViewTemplate = CSRView< Device_, Index_ > |
Templated view type.
Device_ | is alternative device type for the view. |
Index_ | is alternative index type for the view. |
void TNL::Algorithms::Segments::CSRView< Device, Index >::load | ( | File & | file | ) |
Method for loading the segments from a file in a binary form.
file | is the source file. |
void TNL::Algorithms::Segments::CSRView< Device, Index >::save | ( | File & | file | ) | const |
Method for saving the segments to a file in a binary form.
file | is the target file. |