Commit 4cda08c8 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Added Scalar, Vector and Light CSR kernels.

parent c1b8c44f
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ namespace TNL {

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ = CSRScalarKernel,
          typename Kernel = CSRScalarKernel< Index, Device >,
          typename IndexAllocator = typename Allocators::Default< Device >::template Allocator< Index > >
class CSR
{
@@ -30,14 +30,14 @@ class CSR

      using DeviceType = Device;
      using IndexType = std::remove_const_t< Index >;
      using KernelType = Kernel;
      using OffsetsHolder = Containers::Vector< Index, DeviceType, IndexType, IndexAllocator >;
      using SegmentsSizes = OffsetsHolder;
      template< typename Device_, typename Index_ >
      using ViewTemplate = CSRView< Device_, Index_, KernelType_ >;
      using ViewType = CSRView< Device, Index, KernelType_ >;
      using ConstViewType = CSRView< Device, std::add_const_t< IndexType >, KernelType_ >;
      using ViewTemplate = CSRView< Device_, Index_, KernelType >;
      using ViewType = CSRView< Device, Index, KernelType >;
      using ConstViewType = CSRView< Device, std::add_const_t< IndexType >, KernelType >;
      using SegmentViewType = SegmentView< IndexType, RowMajorOrder >;
      CSRKernelTypes KernelType = KernelType_;

      CSR();

@@ -116,8 +116,8 @@ class CSR

      CSR& operator=( const CSR& rhsSegments ) = default;

      template< typename Device_, typename Index_, CSRKernelTypes KernelType__, typename IndexAllocator_ >
      CSR& operator=( const CSR< Device_, Index_, KernelType__, IndexAllocator_ >& source );
      template< typename Device_, typename Index_, typename Kernel_, typename IndexAllocator_ >
      CSR& operator=( const CSR< Device_, Index_, Kernel_, IndexAllocator_ >& source );

      void save( File& file ) const;

@@ -126,22 +126,24 @@ class CSR
   protected:

      OffsetsHolder offsets;

      KernelType kernel;
};

template< typename Device,
          typename Index,
          typename IndexAllocator = typename Allocators::Default< Device >::template Allocator< Index > >
using CSRScalar = CSR< Device, Index, CSRScalarKernel, IndexAllocator >;
using CSRScalar = CSR< Device, Index, CSRScalarKernel< Index, Device >, IndexAllocator >;

template< typename Device,
          typename Index,
          typename IndexAllocator = typename Allocators::Default< Device >::template Allocator< Index > >
using CSRVector = CSR< Device, Index, CSRVectorKernel, IndexAllocator >;
using CSRVector = CSR< Device, Index, CSRVectorKernel< Index, Device >, IndexAllocator >;

template< typename Device,
          typename Index,
          typename IndexAllocator = typename Allocators::Default< Device >::template Allocator< Index > >
using CSRLight = CSR< Device, Index, CSRLightKernel, IndexAllocator >;
using CSRLight = CSR< Device, Index, CSRLightKernel< Index, Device >, IndexAllocator >;

template< typename Device,
          typename Index,
+53 −52
Original line number Diff line number Diff line
@@ -22,18 +22,18 @@ namespace TNL {

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
CSR()
{
}

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
CSR( const SegmentsSizes& segmentsSizes )
{
   this->setSegmentsSizes( segmentsSizes );
@@ -41,18 +41,18 @@ CSR( const SegmentsSizes& segmentsSizes )

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
CSR( const CSR& csr ) : offsets( csr.offsets )
{
}

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
CSR( const CSR&& csr ) : offsets( std::move( csr.offsets ) )
{

@@ -60,10 +60,10 @@ CSR( const CSR&& csr ) : offsets( std::move( csr.offsets ) )

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
String
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
getSerializationType()
{
   return "CSR< [any_device], " + TNL::getSerializationType< IndexType >() + " >";
@@ -71,10 +71,10 @@ getSerializationType()

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
String
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
getSegmentsType()
{
   return ViewType::getSegmentsType();
@@ -82,22 +82,23 @@ getSegmentsType()

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
   template< typename SizesHolder >
void
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
setSegmentsSizes( const SizesHolder& sizes )
{
   details::CSR< Device, Index >::setSegmentsSizes( sizes, this->offsets );
   this->kernel.init( this->offsets );
}

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
void
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
reset()
{
   this->offsets.setSize( 1 );
@@ -107,31 +108,31 @@ reset()

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
typename CSR< Device, Index, KernelType_, IndexAllocator >::ViewType
CSR< Device, Index, KernelType_, IndexAllocator >::
typename CSR< Device, Index, Kernel, IndexAllocator >::ViewType
CSR< Device, Index, Kernel, IndexAllocator >::
getView()
{
   return ViewType( this->offsets.getView() );
   return ViewType( this->offsets.getView(), this->kernel.getView() );
}

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
auto
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
getConstView() const -> const ConstViewType
{
   return ConstViewType( this->offsets.getConstView() );
   return ConstViewType( this->offsets.getConstView(), this->kernel.getConstView() );
}

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
__cuda_callable__ auto CSR< Device, Index, KernelType_, IndexAllocator >::
__cuda_callable__ auto CSR< Device, Index, Kernel, IndexAllocator >::
getSegmentsCount() const -> IndexType
{
   return this->offsets.getSize() - 1;
@@ -139,9 +140,9 @@ getSegmentsCount() const -> IndexType

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
__cuda_callable__ auto CSR< Device, Index, KernelType_, IndexAllocator >::
__cuda_callable__ auto CSR< Device, Index, Kernel, IndexAllocator >::
getSegmentSize( const IndexType segmentIdx ) const -> IndexType
{
   return details::CSR< Device, Index >::getSegmentSize( this->offsets, segmentIdx );
@@ -149,9 +150,9 @@ getSegmentSize( const IndexType segmentIdx ) const -> IndexType

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
__cuda_callable__ auto CSR< Device, Index, KernelType_, IndexAllocator >::
__cuda_callable__ auto CSR< Device, Index, Kernel, IndexAllocator >::
getSize() const -> IndexType
{
   return this->getStorageSize();
@@ -159,9 +160,9 @@ getSize() const -> IndexType

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
__cuda_callable__ auto CSR< Device, Index, KernelType_, IndexAllocator >::
__cuda_callable__ auto CSR< Device, Index, Kernel, IndexAllocator >::
getStorageSize() const -> IndexType
{
   return details::CSR< Device, Index >::getStorageSize( this->offsets );
@@ -169,9 +170,9 @@ getStorageSize() const -> IndexType

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
__cuda_callable__ auto CSR< Device, Index, KernelType_, IndexAllocator >::
__cuda_callable__ auto CSR< Device, Index, Kernel, IndexAllocator >::
getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexType
{
   if( ! std::is_same< DeviceType, Devices::Host >::value )
@@ -187,11 +188,11 @@ getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexTyp

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
__cuda_callable__
auto
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
{
   return SegmentViewType( offsets[ segmentIdx ], offsets[ segmentIdx + 1 ] - offsets[ segmentIdx ] );
@@ -199,11 +200,11 @@ getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
   template< typename Function, typename... Args >
void
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
forSegments( IndexType first, IndexType last, Function& f, Args... args ) const
{
   this->getConstView().forSegments( first, last, f, args... );
@@ -211,11 +212,11 @@ forSegments( IndexType first, IndexType last, Function& f, Args... args ) const

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator>
   template< typename Function, typename... Args >
void
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
forAll( Function& f, Args... args ) const
{
   this->forSegments( 0, this->getSegmentsCount(), f, args... );
@@ -223,11 +224,11 @@ forAll( Function& f, Args... args ) const

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
void
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
segmentsReduction( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero, Args... args ) const
{
   this->getConstView().segmentsReduction( first, last, fetch, reduction, keeper, zero, args... );
@@ -235,11 +236,11 @@ segmentsReduction( IndexType first, IndexType last, Fetch& fetch, const Reductio

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
void
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
allReduction( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero, Args... args ) const
{
   this->segmentsReduction( 0, this->getSegmentsCount(), fetch, reduction, keeper, zero, args... );
@@ -247,12 +248,12 @@ allReduction( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, co

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
   template< typename Device_, typename Index_, CSRKernelTypes KernelType__, typename IndexAllocator_ >
CSR< Device, Index, KernelType_, IndexAllocator >&
CSR< Device, Index, KernelType_, IndexAllocator >::
operator=( const CSR< Device_, Index_, KernelType__, IndexAllocator_ >& source )
   template< typename Device_, typename Index_, typename Kernel_, typename IndexAllocator_ >
CSR< Device, Index, Kernel, IndexAllocator >&
CSR< Device, Index, Kernel, IndexAllocator >::
operator=( const CSR< Device_, Index_, Kernel_, IndexAllocator_ >& source )
{
   this->offsets = source.offsets;
   return *this;
@@ -260,10 +261,10 @@ operator=( const CSR< Device_, Index_, KernelType__, IndexAllocator_ >& source )

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
void
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
save( File& file ) const
{
   file << this->offsets;
@@ -271,10 +272,10 @@ save( File& file ) const

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_,
          typename Kernel,
          typename IndexAllocator >
void
CSR< Device, Index, KernelType_, IndexAllocator >::
CSR< Device, Index, Kernel, IndexAllocator >::
load( File& file )
{
   file >> this->offsets;
+427 −0

File added.

Preview size limit exceeded, changes collapsed.

+13 −11
Original line number Diff line number Diff line
@@ -14,39 +14,39 @@

#include <TNL/Containers/Vector.h>
#include <TNL/Algorithms/Segments/SegmentView.h>
#include <TNL/Algorithms/Segments/CSRKernels.h>

namespace TNL {
   namespace Algorithms {
      namespace Segments {

enum CSRKernelTypes { CSRScalarKernel, CSRVectorKernel, CSRLightKernel };

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ = CSRScalarKernel >
          typename Kernel = CSRScalarKernel< Index, Device > >
class CSRView
{
   public:

      using DeviceType = Device;
      using IndexType = std::remove_const_t< Index >;
      using KernelType = Kernel;
      using OffsetsView = typename Containers::VectorView< Index, DeviceType, IndexType >;
      using ConstOffsetsView = typename Containers::Vector< Index, DeviceType, IndexType >::ConstViewType;
      using KernelView = typename Kernel::ViewType;
      using ViewType = CSRView;
      template< typename Device_, typename Index_ >
      using ViewTemplate = CSRView< Device_, Index_ >;
      using ConstViewType = CSRView< Device, std::add_const_t< Index > >;
      using ViewTemplate = CSRView< Device_, Index_, Kernel >;
      using ConstViewType = CSRView< Device, std::add_const_t< Index >, Kernel >;
      using SegmentViewType = SegmentView< IndexType, RowMajorOrder >;
      CSRKernelTypes KernelType = KernelType_;

      __cuda_callable__
      CSRView();

      __cuda_callable__
      CSRView( const OffsetsView& offsets );
      CSRView( const OffsetsView& offsets, const KernelView& kernel );

      __cuda_callable__
      CSRView( const OffsetsView&& offsets );
      CSRView( const OffsetsView&& offsets, const KernelView&& kernel );

      __cuda_callable__
      CSRView( const CSRView& csr_view );
@@ -125,19 +125,21 @@ class CSRView
   protected:

      OffsetsView offsets;

      KernelView kernel;
};

template< typename Device,
          typename Index >
using CSRViewScalar = CSRView< Device, Index, CSRScalarKernel >;
using CSRViewScalar = CSRView< Device, Index, CSRScalarKernel< Index, Device > >;

template< typename Device,
          typename Index >
using CSRViewVector = CSRView< Device, Index, CSRVectorKernel >;
using CSRViewVector = CSRView< Device, Index, CSRVectorKernel< Index, Device > >;

template< typename Device,
          typename Index >
using CSRViewLight = CSRView< Device, Index, CSRLightKernel >;
using CSRViewLight = CSRView< Device, Index, CSRLightKernel< Index, Device > >;

template< typename Device,
          typename Index >
+61 −57
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@
#include <TNL/Algorithms/ParallelFor.h>
#include <TNL/Algorithms/Segments/CSRView.h>
#include <TNL/Algorithms/Segments/details/CSR.h>
#include <TNL/Algorithms/Segments/details/CSRKernels.h>
#include <TNL/Algorithms/Segments/details/LambdaAdapter.h>

namespace TNL {
@@ -24,68 +23,72 @@ namespace TNL {

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
__cuda_callable__
CSRView< Device, Index, KernelType_ >::
CSRView< Device, Index, Kernel >::
CSRView()
{
}

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
__cuda_callable__
CSRView< Device, Index, KernelType_ >::
CSRView( const OffsetsView& offsets_view )
   : offsets( offsets_view )
CSRView< Device, Index, Kernel >::
CSRView( const OffsetsView& offsets_view,
         const KernelView& kernel_view )
   : offsets( offsets_view ), kernel( kernel_view )
{
}

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
__cuda_callable__
CSRView< Device, Index, KernelType_ >::
CSRView( const OffsetsView&& offsets_view )
   : offsets( offsets_view )
CSRView< Device, Index, Kernel >::
CSRView( const OffsetsView&& offsets_view,
         const KernelView&& kernel_view )
   : offsets( std::move( offsets_view ) ), kernel( std::move( kernel_view ) )
{
}

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
__cuda_callable__
CSRView< Device, Index, KernelType_ >::
CSRView< Device, Index, Kernel >::
CSRView( const CSRView& csr_view )
   : offsets( csr_view.offsets )
   : offsets( csr_view.offsets ), kernel( csr_view.kernel )
{
}

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
__cuda_callable__
CSRView< Device, Index, KernelType_ >::
CSRView< Device, Index, Kernel >::
CSRView( const CSRView&& csr_view )
   : offsets( std::move( csr_view.offsets ) )
   : offsets( std::move( csr_view.offsets ) ), kernel( std::move( csr_view.kernel ) )
{
}

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
String
CSRView< Device, Index, KernelType_ >::
CSRView< Device, Index, Kernel >::
getSerializationType()
{
   return "CSR< [any_device], " + TNL::getSerializationType< IndexType >() + " >";
   return "CSR< [any_device], " +
      TNL::getSerializationType< IndexType >() +
      TNL::getSerializationType< KernelType >() + " >";
}

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
String
CSRView< Device, Index, KernelType_ >::
CSRView< Device, Index, Kernel >::
getSegmentsType()
{
   return "CSR";
@@ -93,10 +96,10 @@ getSegmentsType()

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
__cuda_callable__
typename CSRView< Device, Index, KernelType_ >::ViewType
CSRView< Device, Index, KernelType_ >::
typename CSRView< Device, Index, Kernel >::ViewType
CSRView< Device, Index, Kernel >::
getView()
{
   return ViewType( this->offsets );
@@ -104,19 +107,19 @@ getView()

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
__cuda_callable__
auto
CSRView< Device, Index, KernelType_ >::
CSRView< Device, Index, Kernel >::
getConstView() const -> const ConstViewType
{
   return ConstViewType( this->offsets.getConstView() );
   return ConstViewType( this->offsets.getConstView(), this->kernel.getConstView() );
}

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
__cuda_callable__ auto CSRView< Device, Index, KernelType_ >::
          typename Kernel >
__cuda_callable__ auto CSRView< Device, Index, Kernel >::
getSegmentsCount() const -> IndexType
{
   return this->offsets.getSize() - 1;
@@ -124,8 +127,8 @@ getSegmentsCount() const -> IndexType

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
__cuda_callable__ auto CSRView< Device, Index, KernelType_ >::
          typename Kernel >
__cuda_callable__ auto CSRView< Device, Index, Kernel >::
getSegmentSize( const IndexType segmentIdx ) const -> IndexType
{
   return details::CSR< Device, Index >::getSegmentSize( this->offsets, segmentIdx );
@@ -133,8 +136,8 @@ getSegmentSize( const IndexType segmentIdx ) const -> IndexType

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
__cuda_callable__ auto CSRView< Device, Index, KernelType_ >::
          typename Kernel >
__cuda_callable__ auto CSRView< Device, Index, Kernel >::
getSize() const -> IndexType
{
   return this->getStorageSize();
@@ -142,8 +145,8 @@ getSize() const -> IndexType

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
__cuda_callable__ auto CSRView< Device, Index, KernelType_ >::
          typename Kernel >
__cuda_callable__ auto CSRView< Device, Index, Kernel >::
getStorageSize() const -> IndexType
{
   return details::CSR< Device, Index >::getStorageSize( this->offsets );
@@ -151,8 +154,8 @@ getStorageSize() const -> IndexType

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
__cuda_callable__ auto CSRView< Device, Index, KernelType_ >::
          typename Kernel >
__cuda_callable__ auto CSRView< Device, Index, Kernel >::
getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexType
{
   if( ! std::is_same< DeviceType, Devices::Host >::value )
@@ -168,10 +171,10 @@ getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexTyp

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
__cuda_callable__
auto
CSRView< Device, Index, KernelType_ >::
CSRView< Device, Index, Kernel >::
getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
{
   return SegmentViewType( offsets[ segmentIdx ], offsets[ segmentIdx + 1 ] - offsets[ segmentIdx ], 1 );
@@ -179,10 +182,10 @@ getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
   template< typename Function, typename... Args >
void
CSRView< Device, Index, KernelType_ >::
CSRView< Device, Index, Kernel >::
forSegments( IndexType first, IndexType last, Function& f, Args... args ) const
{
   const auto offsetsView = this->offsets;
@@ -199,10 +202,10 @@ forSegments( IndexType first, IndexType last, Function& f, Args... args ) const

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
   template< typename Function, typename... Args >
void
CSRView< Device, Index, KernelType_ >::
CSRView< Device, Index, Kernel >::
forAll( Function& f, Args... args ) const
{
   this->forSegments( 0, this->getSegmentsCount(), f, args... );
@@ -210,13 +213,14 @@ forAll( Function& f, Args... args ) const

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
void
CSRView< Device, Index, KernelType_ >::
CSRView< Device, Index, Kernel >::
segmentsReduction( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero, Args... args ) const
{
   using RealType = typename details::FetchLambdaAdapter< Index, Fetch >::ReturnType;
   kernel.rowsReduction( this->offsets.getConstView(), first, last, fetch, reduction, keeper, zero, args... );
   /*using RealType = typename details::FetchLambdaAdapter< Index, Fetch >::ReturnType;
   const auto offsetsView = this->offsets.getConstView();
   if( KernelType == CSRScalarKernel || std::is_same< DeviceType, TNL::Devices::Host >::value )
   {
@@ -238,15 +242,15 @@ segmentsReduction( IndexType first, IndexType last, Fetch& fetch, const Reductio
   {
      const IndexType elementsInSegment = ceil( this->getSize() / this->getSegmentsCount() );
      details::RowsReductionLightKernelCaller( elementsInSegment, offsetsView, first, last, fetch, reduction, keeper, zero, args... );
   }
   }*/
}

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
void
CSRView< Device, Index, KernelType_ >::
CSRView< Device, Index, Kernel >::
allReduction( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero, Args... args ) const
{
   this->segmentsReduction( 0, this->getSegmentsCount(), fetch, reduction, keeper, zero, args... );
@@ -254,9 +258,9 @@ allReduction( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, co

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
CSRView< Device, Index, KernelType_ >&
CSRView< Device, Index, KernelType_ >::
          typename Kernel >
CSRView< Device, Index, Kernel >&
CSRView< Device, Index, Kernel >::
operator=( const CSRView& view )
{
   this->offsets.bind( view.offsets );
@@ -265,9 +269,9 @@ operator=( const CSRView& view )

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
void
CSRView< Device, Index, KernelType_ >::
CSRView< Device, Index, Kernel >::
save( File& file ) const
{
   file << this->offsets;
@@ -275,9 +279,9 @@ save( File& file ) const

template< typename Device,
          typename Index,
          CSRKernelTypes KernelType_ >
          typename Kernel >
void
CSRView< Device, Index, KernelType_ >::
CSRView< Device, Index, Kernel >::
load( File& file )
{
   file >> this->offsets;
Loading