|
|
using | ConstViewType = SlicedEllpackView< Device, std::add_const_t< Index >, Organization, SliceSize > |
| | Type of constant segments view.
|
|
using | IndexAllocatorType = IndexAllocator |
| | Type of allocator for indices.
|
|
using | OffsetsContainer = Containers::Vector< Index, Device, typename Base::IndexType, IndexAllocator > |
| | Type of container storing offsets of particular segments.
|
|
template<typename Device_ = Device, typename Index_ = Index, typename IndexAllocator_ = typename Allocators::Default< Device_ >::template Allocator< Index_ >, ElementsOrganization Organization_ = Organization, int SliceSize_ = SliceSize> |
| using | Self = SlicedEllpack< Device_, Index_, IndexAllocator_, Organization_, SliceSize_ > |
| template<typename Device_, typename Index_> |
| using | ViewTemplate = SlicedEllpackView< Device_, Index_, Organization, SliceSize > |
| | Templated view type.
|
|
using | ViewType = SlicedEllpackView< Device, Index, Organization, SliceSize > |
| | Type of segments view.
|
|
using | ConstOffsetsView |
| | The type for representing the constant vector view with segment offsets.
|
|
using | DeviceType |
| | The device where the segments are operating.
|
|
using | IndexType |
| | The type used for indexing of segments elements.
|
|
using | OffsetsView |
| | The type for representing the vector view with segment offsets.
|
|
using | SegmentViewType |
| | Accessor type for one particular segment.
|
|
|
| SlicedEllpack ()=default |
| | Constructor with no parameters to create empty segments.
|
| template<typename SizesContainer, std::enable_if_t< IsArrayType< SizesContainer >::value, bool > = true> |
| | SlicedEllpack (const SizesContainer &segmentsSizes) |
| | Constructor that initializes segments based on their sizes.
|
|
| SlicedEllpack (const SlicedEllpack &) |
| | Copy constructor (makes deep copy).
|
| template<typename ListIndex> |
| | SlicedEllpack (const std::initializer_list< ListIndex > &segmentsSizes) |
| | Constructor that initializes segments using an initializer list.
|
|
| SlicedEllpack (SlicedEllpack &&) noexcept=default |
| | Move constructor.
|
|
ConstViewType | getConstView () const |
| | Returns a constant view for this instance of segments which can by used for example in lambda functions running in GPU kernels.
|
|
ViewType | getView () |
| | Returns a view for this instance of 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.
|
|
SlicedEllpack & | operator= (const SlicedEllpack &segments) |
| | Copy-assignment operator (makes a deep copy).
|
| template<typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_> |
| SlicedEllpack & | operator= (const SlicedEllpack< Device_, Index_, IndexAllocator_, Organization_, SliceSize > &segments) |
| | Assignment operator for segments with different template parameters.
|
|
SlicedEllpack & | operator= (SlicedEllpack &&) noexcept(false) |
| | Move-assignment operator.
|
|
void | reset () |
| | Reset the segments to empty states (it means that there is no segment in the segments).
|
| void | save (File &file) const |
| | Method for saving the segments to a file in a binary form.
|
| template<typename SizesHolder = OffsetsContainer> |
| void | setSegmentsSizes (const SizesHolder &sizes) |
| | Set sizes of particular segments.
|
|
__cuda_callable__ | SlicedEllpackBase ()=default |
| | Default constructor with no parameters to create empty segments view.
|
|
void | forAllElements (Function &&function) const |
|
void | forAllElementsIf (Condition condition, Function function) const |
|
void | forAllSegments (Function &&function) const |
|
void | forElements (IndexType begin, IndexType end, Function &&function) const |
|
void | forElementsIf (IndexType begin, IndexType end, Condition condition, Function function) const |
|
void | forSegments (IndexType begin, IndexType end, Function &&function) const |
|
__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 (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__ OffsetsView | getSliceOffsetsView () |
| | Returns a modifiable vector view with the offsets of particular slices.
|
|
__cuda_callable__ OffsetsView | getSliceSegmentSizesView () |
| | Returns a modifiable vector view with the segment sizes in particular slices.
|
|
__cuda_callable__ IndexType | getStorageSize () const |
| | Returns number of elements that needs to be allocated by a container connected to this segments.
|
|
SlicedEllpackBase & | operator= (const SlicedEllpackBase &)=delete |
| | Copy-assignment operator.
|
template<typename Device, typename Index, typename IndexAllocator = typename Allocators::Default< Device >::template Allocator< Index >,
ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization(), int SliceSize = 32>
class TNL::Algorithms::Segments::SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >
Data structure for Sliced Ellpack segments.
Sliced Ellpack segments are inspired by the following papers:
[1] T. Oberhuber, A. Suzuki, J. Vacata, New Row-grouped CSR format for storing sparse matrices on GPU with implementation in CUDA, Acta Technica, 2011, vol. 56, no. 4, pp. 447-466
[2] [A. Monakov, A. Lokhmotov, A. Avetisyan, Automatically tuning sparse matrix-vector multiplication for GPU architectures. In International Conference on High-Performance Embedded Architectures and Compilers, pp. 111-125, 2010.](https://link.springer.com/chapter/10.1007/978-3-642-11515-8_10)
This format is a modification of TNL::Algorithms::Segments::Ellpack, where segments are divided into slices. Each slice contains segments of the same size, but segments in different slices can have varying sizes. As a result, this format is more flexible than Ellpack while remaining simpler than CSR. If working with segments that have slight variations in size, Sliced Ellpack can be a suitable choice.
See TNL::Algorithms::Segments for more details about segments.
- Template Parameters
-
| Device | The type of device on which the segments will operate. |
| Index | The type used for indexing elements managed by the segments. |
| IndexAllocator | The allocator used for managing index containers. |
| Organization | The organization of elements in the segments—either row-major or column-major order. |
| SliceSize | The size of each slice. |