Skip to content

Strange behavior of dash::transform with local input range #386

Open
@devreal

Description

@devreal

Right now, dash::transform can be called with a local input range. The user is responsible for blocking the output range, i.e., he has to call dash::transform for every target unit individually. For an example, see https://github.com/dash-project/dash/blob/development/dash/test/algorithm/TransformTest.cc#L81.

This is really not intuitive. I propose changing this to require len(local_input_range) == len(global_output_range) and do the blocking to units in dash::transform using non-blocking accumulate calls.

The use case (global element-wise reduction into a global container) is as follows (contributed by @bertwesarg):

std::vector<double> local_v(100);    
std::fill(local_v.begin(), local_v.end(), (double)dash::myid());    
dash::Array<double> global_v(local_v.size());    
std::fill(global_v.lbegin(), global_v.lend(), 0.0);    
dash::transform<double>(        
  local_v.begin(), local_v.end(),        
  global_v.begin(),        
  global_v.begin(),        
  dash::plus<double>()    
);

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions