|
Template Numerical Library version\ main:4904c12
|
EllpackBase serves as a base class for TNL::Algorithms::Segments::Ellpack and TNL::Algorithms::Segments::EllpackView. More...
#include <TNL/Algorithms/Segments/EllpackBase.h>
Public Types | |
| 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 | SegmentViewType = SegmentView< IndexType, Organization > |
| Accessor type for one particular segment. | |
Public Member Functions | |
| __cuda_callable__ | EllpackBase ()=default |
| Default constructor with no parameters to create empty segments view. | |
| __cuda_callable__ | EllpackBase (const EllpackBase &)=default |
| Copy constructor. | |
| __cuda_callable__ | EllpackBase (EllpackBase &&) noexcept=default |
| Move constructor. | |
| __cuda_callable__ | EllpackBase (IndexType segmentsCount, IndexType segmentSize, IndexType alignedSize) |
| Constructor that initializes segments based on their sizes. | |
| 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 | getAlignedSize () const |
| Returns the aligned number of segments. | |
| __cuda_callable__ IndexType | getElementCount () const |
| Returns the number of elements managed by all segments. | |
| __cuda_callable__ IndexType | getGlobalIndex (Index segmentIdx, Index localIdx) const |
| Computes the global index of an element managed by the segments. | |
| __cuda_callable__ IndexType | getSegmentCount () const |
| Returns the number of segments. | |
| __cuda_callable__ IndexType | getSegmentsCount () const |
| Returns the number of segments. Deprecated, use getSegmentCount(). | |
| __cuda_callable__ IndexType | getSegmentSize () const |
| Returns the number of elements managed by all 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 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__ IndexType | getStorageSize () const |
| Returns number of elements that needs to be allocated by a container connected to this segments. | |
| EllpackBase & | operator= (const EllpackBase &)=delete |
| Copy-assignment operator. | |
| EllpackBase & | operator= (EllpackBase &&)=delete |
| Move-assignment operator. | |
Static Public Member Functions | |
| static constexpr int | getAlignment () |
| Returns the alignment of the number of segments. | |
| static constexpr ElementsOrganization | getOrganization () |
| Returns the data layout. | |
| 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 Ellpack format uses padding elements. | |
Protected Member Functions | |
| __cuda_callable__ void | bind (IndexType segmentsCount, IndexType segmentSize, IndexType alignedSize) |
| Re-initializes the internal attributes of the base class. | |
Protected Attributes | |
| IndexType | alignedSize = 0 |
| IndexType | segmentsCount = 0 |
| IndexType | segmentSize = 0 |
EllpackBase serves as a base class for TNL::Algorithms::Segments::Ellpack and TNL::Algorithms::Segments::EllpackView.
| 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. |
| Alignment | is the alignment of the number of segments (to optimize data alignment, particularly on GPUs). |
|
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.
|
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. |
|
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.