Template Numerical Library version\ main:bb09b17
Loading...
Searching...
No Matches
TNL::Algorithms::Segments Namespace Reference

Namespace for the segments data structures. More...

Classes

class  BiEllpack
 
class  BiEllpackBase
 
class  BiEllpackSegmentView
 
class  BiEllpackView
 
class  ChunkedEllpack
 
class  ChunkedEllpackBase
 
class  ChunkedEllpackSegmentView
 
class  ChunkedEllpackSegmentView< Index, ColumnMajorOrder >
 
class  ChunkedEllpackSegmentView< Index, RowMajorOrder >
 
class  ChunkedEllpackView
 
class  CSR
 Data structure for CSR segments format. More...
 
class  CSRBase
 CSRBase serves as a base class for CSR and CSRView. More...
 
class  CSRView
 CSRView is provides a non-owning encapsulation of data stored in the CSR segments format. More...
 
struct  DefaultElementsOrganization
 
class  Ellpack
 
class  EllpackBase
 
class  EllpackView
 
struct  GrowingSegments
 
struct  GrowingSegmentsView
 
class  SegmentElement
 Simple structure representing one element of a segment. More...
 
class  SegmentView
 Data structure for accessing particular segment. More...
 
class  SegmentView< Index, ColumnMajorOrder >
 Data structure for accessing particular segment. More...
 
class  SegmentView< Index, RowMajorOrder >
 
class  SegmentViewIterator
 Iterator for iterating over elements of a segment. More...
 
class  SlicedEllpack
 
class  SlicedEllpackBase
 
class  SlicedEllpackView
 

Enumerations

enum  ElementsOrganization { ColumnMajorOrder = 0 , RowMajorOrder }
 

Functions

template<typename Device , typename Index , ElementsOrganization Organization, int WarpSize>
std::ostreamoperator<< (std::ostream &str, const BiEllpackBase< Device, Index, Organization, WarpSize > &segments)
 
template<typename Device , typename Index , ElementsOrganization Organization>
std::ostreamoperator<< (std::ostream &str, const ChunkedEllpackBase< Device, Index, Organization > &segments)
 
template<typename Device , typename Index >
std::ostreamoperator<< (std::ostream &str, const CSRBase< Device, Index > &segments)
 Insertion operator of CSR segments to output stream.
 
template<typename Device , typename Index , ElementsOrganization Organization, int Alignment>
std::ostreamoperator<< (std::ostream &str, const EllpackBase< Device, Index, Organization, Alignment > &ellpack)
 
template<typename Device , typename Index , ElementsOrganization Organization, int SliceSize>
std::ostreamoperator<< (std::ostream &str, const SlicedEllpackBase< Device, Index, Organization, SliceSize > &segments)
 
template<typename Segments >
std::ostreamprintSegments (std::ostream &str, const Segments &segments)
 Print segments sizes, i.e. the segments setup.
 
template<typename Segments , typename Fetch >
std::ostreamprintSegments (std::ostream &str, const Segments &segments, Fetch &&fetch)
 

Detailed Description

Namespace for the segments data structures.

Enumeration Type Documentation

◆ ElementsOrganization

Enumerator
ColumnMajorOrder 

Column-major order.

RowMajorOrder 

Row-major order.

Function Documentation

◆ operator<<()

template<typename Device , typename Index >
std::ostream & TNL::Algorithms::Segments::operator<< ( std::ostream & str,
const CSRBase< Device, Index > & segments )

Insertion operator of CSR segments to output stream.

Template Parameters
Deviceis the device type of the source segments.
Indexis the index type of the source segments.
IndexAllocatoris the index allocator of the source segments.
Parameters
stris the output stream.
segmentsare the source segments.
Returns
reference to the output stream.

◆ printSegments()

template<typename Segments >
std::ostream & TNL::Algorithms::Segments::printSegments ( std::ostream & str,
const Segments & segments )

Print segments sizes, i.e. the segments setup.

Template Parameters
Segmentsis type of segments.
Parameters
segmentsis an instance of segments.
stris output stream.
Returns
reference to the output stream.
Example
#include <iostream>
#include <TNL/Containers/Vector.h>
#include <TNL/Algorithms/Segments/CSR.h>
#include <TNL/Algorithms/Segments/Ellpack.h>
#include <TNL/Algorithms/Segments/ChunkedEllpack.h>
#include <TNL/Algorithms/Segments/BiEllpack.h>
#include <TNL/Devices/Host.h>
#include <TNL/Devices/Cuda.h>
template< typename Segments >
void
SegmentsExample()
{
/***
* Create segments with given segments sizes and print their setup.
*/
Segments segments{ 1, 2, 3, 4, 5 };
std::cout << "Segments sizes are: " << segments << std::endl << std::endl;
}
int
main( int argc, char* argv[] )
{
std::cout << "Example of CSR segments on host: " << std::endl;
SegmentsExample< TNL::Algorithms::Segments::CSR< TNL::Devices::Host, int > >();
std::cout << "Example of Ellpack segments on host: " << std::endl;
SegmentsExample< TNL::Algorithms::Segments::Ellpack< TNL::Devices::Host, int > >();
std::cout << "Example of ChunkedEllpack segments on host: " << std::endl;
SegmentsExample< TNL::Algorithms::Segments::ChunkedEllpack< TNL::Devices::Host, int > >();
std::cout << "Example of BiEllpack segments on host: " << std::endl;
SegmentsExample< TNL::Algorithms::Segments::BiEllpack< TNL::Devices::Host, int > >();
#ifdef __CUDACC__
std::cout << "Example of CSR segments on host: " << std::endl;
SegmentsExample< TNL::Algorithms::Segments::CSR< TNL::Devices::Cuda, int > >();
std::cout << "Example of Ellpack segments on host: " << std::endl;
SegmentsExample< TNL::Algorithms::Segments::Ellpack< TNL::Devices::Cuda, int > >();
std::cout << "Example of ChunkedEllpack segments on host: " << std::endl;
SegmentsExample< TNL::Algorithms::Segments::ChunkedEllpack< TNL::Devices::Cuda, int > >();
std::cout << "Example of BiEllpack segments on host: " << std::endl;
SegmentsExample< TNL::Algorithms::Segments::BiEllpack< TNL::Devices::Cuda, int > >();
#endif
return EXIT_SUCCESS;
}
T endl(T... args)
Output
Example of CSR segments on host:
Segments sizes are: [ 1, 2, 3, 4, 5, ]
Example of Ellpack segments on host:
Segments sizes are: [ 5, 5, 5, 5, 5, ]
Example of ChunkedEllpack segments on host:
Segments sizes are: [ 17, 34, 51, 67, 87, ]
Example of BiEllpack segments on host:
Segments sizes are: [ 2, 4, 4, 5, 5, ]
Example of CSR segments on host:
Segments sizes are: [ 1, 2, 3, 4, 5, ]
Example of Ellpack segments on host:
Segments sizes are: [ 5, 5, 5, 5, 5, ]
Example of ChunkedEllpack segments on host:
Segments sizes are: [ 17, 34, 51, 67, 87, ]
Example of BiEllpack segments on host:
Segments sizes are: [ 2, 4, 4, 5, 5, ]