diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/CSR_impl.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/CSR_impl.h index 827e2c31165831546acb39d7e2b7f509124a3377..8d15b49d9cf4fba4e2b16b13b7446f12465b8626 100644 --- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/CSR_impl.h +++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/CSR_impl.h @@ -1715,7 +1715,6 @@ void SpMVCSRAdaptive( const Real *inVector, return; Real result = 0.0; - bool compute( true ); const Index laneID = threadIdx.x & 31; // & is cheaper than % Block<Index> block = blocks[blockIdx]; const Index minID = rowPointers[block.index[0]/* minRow */]; diff --git a/src/TNL/Algorithms/Segments/CSRScalarKernel.hpp b/src/TNL/Algorithms/Segments/CSRScalarKernel.hpp index 75fda2e440d48e38e1f990fe187c9d3543c25839..15f69667971ff2e404196babc957d0feb597a623 100644 --- a/src/TNL/Algorithms/Segments/CSRScalarKernel.hpp +++ b/src/TNL/Algorithms/Segments/CSRScalarKernel.hpp @@ -94,7 +94,27 @@ segmentsReduction( const OffsetsView& offsets, aux = reduction( aux, details::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) ); keeper( segmentIdx, aux ); }; - Algorithms::ParallelFor< Device >::exec( first, last, l, args... ); + + if( std::is_same< DeviceType, TNL::Devices::Host >::value ) + { +#ifdef HAVE_OPENMP + #pragma omp parallel for firstprivate( l ) schedule( dynamic, 100 ), if( Devices::Host::isOMPEnabled() ) +#endif + for( Index segmentIdx = first; segmentIdx < last; segmentIdx ++ ) + l( segmentIdx, args... ); + /*{ + const IndexType begin = offsets[ segmentIdx ]; + const IndexType end = offsets[ segmentIdx + 1 ]; + Real aux( zero ); + IndexType localIdx( 0 ); + bool compute( true ); + for( IndexType globalIdx = begin; globalIdx < end && compute; globalIdx++ ) + aux = reduction( aux, details::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) ); + keeper( segmentIdx, aux ); + }*/ + } + else + Algorithms::ParallelFor< Device >::exec( first, last, l, args... ); } } // namespace Segments } // namespace Algorithms