|
Template Numerical Library version\ main:7388705
|
ChunkedEllpackBase serves as a base class for TNL::Algorithms::Segments::ChunkedEllpack and TNL::Algorithms::Segments::ChunkedEllpackView. More...
#include <TNL/Algorithms/Segments/ChunkedEllpackBase.h>
Public Types | |
| using | ConstOffsetsView = typename OffsetsView::ConstViewType |
| The type for representing the constant vector view with segment offsets. | |
| using | ConstSliceInfoContainerView = typename SliceInfoContainerView::ConstViewType |
| 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 segment offsets. | |
| using | SegmentViewType = ChunkedEllpackSegmentView< IndexType, Organization > |
| Accessor type for one particular segment. | |
| using | SliceInfoContainerView |
| using | SliceInfoType = detail::ChunkedEllpackSliceInfo< IndexType > |
| template<typename Device_, typename Index_> | |
| using | ViewTemplate = ChunkedEllpackBase< Device_, Index_, Organization > |
| Templated view type. | |
Public Member Functions | |
| __cuda_callable__ | ChunkedEllpackBase ()=default |
| Default constructor with no parameters to create empty segments view. | |
| __cuda_callable__ | ChunkedEllpackBase (ChunkedEllpackBase &&) noexcept=default |
| Move constructor. | |
| __cuda_callable__ | ChunkedEllpackBase (const ChunkedEllpackBase &)=default |
| Copy constructor. | |
| __cuda_callable__ | ChunkedEllpackBase (IndexType size, IndexType storageSize, IndexType numberOfSlices, IndexType chunksInSlice, IndexType desiredChunkSize, OffsetsView segmentToChunkMapping, OffsetsView segmentToSliceMapping, OffsetsView chunksToSegmentsMapping, OffsetsView segmentPointers, SliceInfoContainerView slices) |
| Constructor with all necessary data and views. | |
| template<typename Function> | |
| void | forAllElements (Function &&function) const |
| template<typename Condition, typename Function> | |
| void | forAllElementsIf (Condition condition, Function function) const |
| template<typename Function> | |
| void | forAllSegments (Function &&function) const |
| template<typename Array, typename Function> | |
| void | forElements (const Array &segmentIndexes, Function function) const |
| template<typename Array, typename Function> | |
| void | forElements (const Array &segmentIndexes, Index begin, Index end, Function function) const |
| template<typename Function> | |
| void | forElements (IndexType begin, IndexType end, Function &&function) const |
| template<typename Condition, typename Function> | |
| void | forElementsIf (IndexType begin, IndexType end, Condition condition, Function function) const |
| template<typename Function> | |
| void | forSegments (IndexType begin, IndexType end, Function &&function) const |
| __cuda_callable__ IndexType | getChunksInSlice () const |
| Returns the number of chunks in a slice. | |
| __cuda_callable__ OffsetsView | getChunksToSegmentsMappingView () |
| Returns a modifiable vector view with mapping of chunks to segments. | |
| __cuda_callable__ ConstOffsetsView | getChunksToSegmentsMappingView () const |
| Returns a constant vector view with mapping of chunks to segments. | |
| __cuda_callable__ IndexType | getDesiredChunkSize () const |
| Returns the desired chunk size. | |
| __cuda_callable__ IndexType | getElementCount () const |
| Returns the number of elements managed by all segments. | |
| __cuda_callable__ IndexType | getGlobalIndex (IndexType segmentIdx, IndexType localIdx) const |
| Computes the global index of an element managed by the segments. | |
| __cuda_callable__ IndexType | getNumberOfSlices () const |
| Returns the number of slices. | |
| __cuda_callable__ IndexType | getSegmentCount () const |
| Returns the number of segments. | |
| __cuda_callable__ OffsetsView | getSegmentPointersView () |
| Returns a modifiable vector view with segment pointers. | |
| __cuda_callable__ ConstOffsetsView | getSegmentPointersView () const |
| Returns a constant vector view with segment pointers. | |
| __cuda_callable__ IndexType | getSegmentsCount () const |
| Returns the number of segments. Deprecated, use getSegmentCount(). | |
| __cuda_callable__ IndexType | getSegmentSize (IndexType segmentIdx) const |
| Returns the size of a particular segment denoted by segmentIdx. | |
| __cuda_callable__ OffsetsView | getSegmentToChunkMappingView () |
| Returns a modifiable vector view with mapping of segments to chunks. | |
| __cuda_callable__ ConstOffsetsView | getSegmentToChunkMappingView () const |
| Returns a constant vector view with mapping of segments to chunks. | |
| __cuda_callable__ OffsetsView | getSegmentToSliceMappingView () |
| Returns a modifiable vector view with mapping of segments to slices. | |
| __cuda_callable__ ConstOffsetsView | getSegmentToSliceMappingView () const |
| Returns a constant vector view with mapping of segments to slices. | |
| __cuda_callable__ SegmentViewType | getSegmentView (IndexType segmentIdx) const |
| Returns a segment view (i.e., a segment accessor) for the specified segment index. | |
| __cuda_callable__ IndexType | getSize () const |
| Returns the number of elements managed by all segments. | |
| __cuda_callable__ SliceInfoContainerView | getSlicesView () |
| Returns a modifiable view with slice information. | |
| __cuda_callable__ ConstSliceInfoContainerView | getSlicesView () const |
| Returns a constant view with slice information. | |
| __cuda_callable__ IndexType | getStorageSize () const |
| Returns number of elements that needs to be allocated by a container connected to this segments. | |
| ChunkedEllpackBase & | operator= (ChunkedEllpackBase &&)=delete |
| Move-assignment operator. | |
| ChunkedEllpackBase & | operator= (const ChunkedEllpackBase &)=delete |
| Copy-assignment operator. | |
| void | printStructure (std::ostream &str) const |
| Prints the structure of the segments to the output stream. | |
Static Public Member Functions | |
| static constexpr ElementsOrganization | getOrganization () |
| Returns the data layout for the chunked ellpack 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 chunked ellpack format uses padding elements. | |
Protected Member Functions | |
| __cuda_callable__ void | bind (IndexType size, IndexType storageSize, IndexType numberOfSlices, IndexType chunksInSlice, IndexType desiredChunkSize, OffsetsView segmentToChunkMapping, OffsetsView segmentToSliceMapping, OffsetsView chunksToSegmentsMapping, OffsetsView segmentPointers, SliceInfoContainerView slices) |
| Re-initializes the internal attributes of the base class. | |
Protected Attributes | |
| IndexType | chunksInSlice = 256 |
| OffsetsView | chunksToSegmentsMapping |
| IndexType | desiredChunkSize = 16 |
| IndexType | numberOfSlices = 0 |
| OffsetsView | segmentPointers |
| Keeps index of the first segment index. | |
| OffsetsView | segmentToChunkMapping |
| For each segment, this keeps index of the first chunk within a slice. | |
| OffsetsView | segmentToSliceMapping |
| For each segment, this keeps index of the slice which contains the segment. | |
| IndexType | size = 0 |
| SliceInfoContainerView | slices |
| IndexType | storageSize = 0 |
ChunkedEllpackBase serves as a base class for TNL::Algorithms::Segments::ChunkedEllpack and TNL::Algorithms::Segments::ChunkedEllpackView.
| Device | is type of device where the segments will be operating. |
| Index | is type for indexing of the elements managed by the segments. |
| Organization | is the organization of the elements in the segments—either row-major or column-major order. |
| using TNL::Algorithms::Segments::ChunkedEllpackBase< Device, Index, Organization >::SliceInfoContainerView |
| using TNL::Algorithms::Segments::ChunkedEllpackBase< Device, Index, Organization >::ViewTemplate = ChunkedEllpackBase< Device_, Index_, Organization > |
Templated view type.
| Device_ | is alternative device type for the view. |
| Index_ | is alternative index type for the view. |
|
protected |
Re-initializes the internal attributes of the base class.
Note that this function is protected to ensure that the user cannot modify the base class of segments. For the same reason, in future code development we also need to make sure that all non-const functions in the base class return by value and not by reference.
| void TNL::Algorithms::Segments::ChunkedEllpackBase< Device, Index, Organization >::forAllElements | ( | Function && | function | ) | const |
| void TNL::Algorithms::Segments::ChunkedEllpackBase< Device, Index, Organization >::forAllElementsIf | ( | Condition | condition, |
| Function | function ) const |
| void TNL::Algorithms::Segments::ChunkedEllpackBase< Device, Index, Organization >::forAllSegments | ( | Function && | function | ) | const |
| void TNL::Algorithms::Segments::ChunkedEllpackBase< Device, Index, Organization >::forElements | ( | const Array & | segmentIndexes, |
| Function | function ) const |
| void TNL::Algorithms::Segments::ChunkedEllpackBase< Device, Index, Organization >::forElements | ( | const Array & | segmentIndexes, |
| Index | begin, | ||
| Index | end, | ||
| Function | function ) const |
| void TNL::Algorithms::Segments::ChunkedEllpackBase< Device, Index, Organization >::forElements | ( | IndexType | begin, |
| IndexType | end, | ||
| Function && | function ) const |
| void TNL::Algorithms::Segments::ChunkedEllpackBase< Device, Index, Organization >::forElementsIf | ( | IndexType | begin, |
| IndexType | end, | ||
| Condition | condition, | ||
| Function | function ) const |
| void TNL::Algorithms::Segments::ChunkedEllpackBase< Device, Index, Organization >::forSegments | ( | IndexType | begin, |
| IndexType | end, | ||
| Function && | function ) const |
|
nodiscard |
Computes the global index of an element managed by the segments.
The global index serves as a reference to the element within its container.
| segmentIdx | The index of the segment containing the element. |
| localIdx | The local index of the element within the segment. |
|
nodiscard |
Returns the number of segments. Deprecated, use getSegmentCount().
|
staticnodiscard |
Returns string with the segments type.
|
nodiscard |
Returns a segment view (i.e., a segment accessor) for the specified segment index.
| segmentIdx | The index of the requested segment. |
|
staticnodiscard |
Returns string with the serialization type.
|
nodiscard |
Returns the number of elements managed by all segments.