Skip to content

Commit

Permalink
Fix issue 1976 for real (I hope)
Browse files Browse the repository at this point in the history
This is another atempt at fixing issue #1976
  • Loading branch information
crtrott committed Feb 4, 2019
1 parent 587d31e commit f782e0a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/src/Threads/Kokkos_Threads_Parallel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,15 @@ class ParallelFor< FunctorType

WorkRange range( self.m_policy , exec.pool_rank() , exec.pool_size() );

exec.set_work_range(0,range.end()-range.begin(),self.m_policy.chunk_size());
exec.set_work_range(range.begin()-self.m_policy.begin(),range.end()-self.m_policy.begin(),self.m_policy.chunk_size());
exec.reset_steal_target();
exec.barrier();

long work_index = exec.get_work_index();

while(work_index != -1) {
const Member begin = static_cast<Member>(work_index) * self.m_policy.chunk_size()+range.begin();
const Member begin = static_cast<Member>(work_index) * self.m_policy.chunk_size()+self.m_policy.begin();
const Member end = begin + self.m_policy.chunk_size() < self.m_policy.end()?begin+self.m_policy.chunk_size():self.m_policy.end();

ParallelFor::template exec_range< WorkTag >
( self.m_functor , begin , end );
work_index = exec.get_work_index();
Expand Down Expand Up @@ -470,14 +469,14 @@ class ParallelReduce< FunctorType
const ParallelReduce & self = * ((const ParallelReduce *) arg );
const WorkRange range( self.m_policy, exec.pool_rank(), exec.pool_size() );

exec.set_work_range(0,range.end()-range.begin(),self.m_policy.chunk_size());
exec.set_work_range(range.begin()-self.m_policy.begin(),range.end()-self.m_policy.begin(),self.m_policy.chunk_size());
exec.reset_steal_target();
exec.barrier();

long work_index = exec.get_work_index();
reference_type update = ValueInit::init( ReducerConditional::select(self.m_functor , self.m_reducer) , exec.reduce_memory() );
while(work_index != -1) {
const Member begin = static_cast<Member>(work_index) * self.m_policy.chunk_size() + range.begin();
const Member begin = static_cast<Member>(work_index) * self.m_policy.chunk_size() + self.m_policy.begin();
const Member end = begin + self.m_policy.chunk_size() < self.m_policy.end()?begin+self.m_policy.chunk_size():self.m_policy.end();
ParallelReduce::template exec_range< WorkTag >
( self.m_functor , begin , end
Expand Down

0 comments on commit f782e0a

Please sign in to comment.