Loading src/TNL/Containers/Segments/CSR.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,7 @@ void CSR< Device, Index, IndexAllocator >:: forAll( Function& f, Args... args ) const { this->forSegments( 0, this->getSize(), f, args... ); this->forSegments( 0, this->getSegmentsCount(), f, args... ); } template< typename Device, Loading src/TNL/Containers/Segments/CSRView.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ auto CSRView< Device, Index >:: getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType { printf( "----> size %d \n", offsets[ segmentIdx + 1 ] ); printf( "----> segmentIdx %d offset %d size %d ptr %p \n", segmentIdx, offsets[ segmentIdx ], offsets.getSize(), offsets.getData() ); return SegmentViewType( offsets[ segmentIdx ], offsets[ segmentIdx + 1 ] - offsets[ segmentIdx ], 1 ); } Loading Loading @@ -186,7 +186,7 @@ void CSRView< Device, Index >:: forAll( Function& f, Args... args ) const { this->forSegments( 0, this->getSize(), f, args... ); this->forSegments( 0, this->getSegmentsCount(), f, args... ); } template< typename Device, Loading src/TNL/Containers/Segments/SegmentView.h +3 −7 Original line number Diff line number Diff line Loading @@ -29,16 +29,12 @@ class SegmentView< Index, false > SegmentView( const IndexType offset, const IndexType size, const IndexType step ) : segmentOffset( offset ), segmentSize( size ), step( step ) { printf( "--- size = %d \n", size ); }; : segmentOffset( offset ), segmentSize( size ), step( step ){}; __cuda_callable__ SegmentView( const SegmentView& view ) : segmentOffset( view.segmentOffset ), segmentSize( view.segmentSize ), step( view.step ) { }; : segmentOffset( view.segmentOffset ), segmentSize( view.segmentSize ), step( view.step ){}; __cuda_callable__ IndexType getSize() const { Loading src/UnitTests/Containers/Segments/SegmentsTest.hpp +6 −6 Original line number Diff line number Diff line Loading @@ -127,17 +127,17 @@ void test_AllReduction_MaximumInSegments() TNL::Containers::Vector< IndexType, DeviceType, IndexType > v( segments.getStorageSize() ); IndexType k( 1 ); /*IndexType k( 1 ); for( IndexType i = 0; i < segmentsCount; i++ ) for( IndexType j = 0; j < segmentSize; j++ ) v.setElement( segments.getGlobalIndex( i, j ), k++ ); /*auto view = v.getView(); auto init = [=] __cuda_callable__ ( const IndexType i, const IndexType j ) mutable -> bool { view[ j ] = j + 1; v.setElement( segments.getGlobalIndex( i, j ), k++ );*/ auto view = v.getView(); auto init = [=] __cuda_callable__ ( const IndexType segmentIdx, const IndexType localIdx, const IndexType globalIdx ) mutable -> bool { view[ globalIdx ] = segmentIdx * 5 + localIdx + 1; return true; }; segments.forAll( init ); std::cerr << v << std::endl;*/ std::cerr << v << std::endl; TNL::Containers::Vector< IndexType, DeviceType, IndexType >result( segmentsCount ); Loading Loading
src/TNL/Containers/Segments/CSR.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,7 @@ void CSR< Device, Index, IndexAllocator >:: forAll( Function& f, Args... args ) const { this->forSegments( 0, this->getSize(), f, args... ); this->forSegments( 0, this->getSegmentsCount(), f, args... ); } template< typename Device, Loading
src/TNL/Containers/Segments/CSRView.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ auto CSRView< Device, Index >:: getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType { printf( "----> size %d \n", offsets[ segmentIdx + 1 ] ); printf( "----> segmentIdx %d offset %d size %d ptr %p \n", segmentIdx, offsets[ segmentIdx ], offsets.getSize(), offsets.getData() ); return SegmentViewType( offsets[ segmentIdx ], offsets[ segmentIdx + 1 ] - offsets[ segmentIdx ], 1 ); } Loading Loading @@ -186,7 +186,7 @@ void CSRView< Device, Index >:: forAll( Function& f, Args... args ) const { this->forSegments( 0, this->getSize(), f, args... ); this->forSegments( 0, this->getSegmentsCount(), f, args... ); } template< typename Device, Loading
src/TNL/Containers/Segments/SegmentView.h +3 −7 Original line number Diff line number Diff line Loading @@ -29,16 +29,12 @@ class SegmentView< Index, false > SegmentView( const IndexType offset, const IndexType size, const IndexType step ) : segmentOffset( offset ), segmentSize( size ), step( step ) { printf( "--- size = %d \n", size ); }; : segmentOffset( offset ), segmentSize( size ), step( step ){}; __cuda_callable__ SegmentView( const SegmentView& view ) : segmentOffset( view.segmentOffset ), segmentSize( view.segmentSize ), step( view.step ) { }; : segmentOffset( view.segmentOffset ), segmentSize( view.segmentSize ), step( view.step ){}; __cuda_callable__ IndexType getSize() const { Loading
src/UnitTests/Containers/Segments/SegmentsTest.hpp +6 −6 Original line number Diff line number Diff line Loading @@ -127,17 +127,17 @@ void test_AllReduction_MaximumInSegments() TNL::Containers::Vector< IndexType, DeviceType, IndexType > v( segments.getStorageSize() ); IndexType k( 1 ); /*IndexType k( 1 ); for( IndexType i = 0; i < segmentsCount; i++ ) for( IndexType j = 0; j < segmentSize; j++ ) v.setElement( segments.getGlobalIndex( i, j ), k++ ); /*auto view = v.getView(); auto init = [=] __cuda_callable__ ( const IndexType i, const IndexType j ) mutable -> bool { view[ j ] = j + 1; v.setElement( segments.getGlobalIndex( i, j ), k++ );*/ auto view = v.getView(); auto init = [=] __cuda_callable__ ( const IndexType segmentIdx, const IndexType localIdx, const IndexType globalIdx ) mutable -> bool { view[ globalIdx ] = segmentIdx * 5 + localIdx + 1; return true; }; segments.forAll( init ); std::cerr << v << std::endl;*/ std::cerr << v << std::endl; TNL::Containers::Vector< IndexType, DeviceType, IndexType >result( segmentsCount ); Loading