dash-project/dash

Dash::copy from global to global seems error.

Opened this issue · 2 comments

Hi, we are using dash in a student project to implement matrix transpose in distributed memory, we want implement a block data copy from global to global by dash::copy. But there is a complied error.(try on development and bug-656-copy). If this is my code's own error, sorry about that.
Thanks

Error:

1.couldn't deduce template parameter 'ValueType' dash::copy(src_g_begin, src_g_end, des_g_begin); GlobOutputIt copy
2. mismatched types 'ValueType*' and 'dash::GlobIter<float, dash::BlockPattern<2 (dash::MemArrange)1, long int>, dash::GlobStaticMemdash::HostSpace, dash::GlobPtr<float, dash::GlobStaticMemdash::HostSpace >, dash::GlobRef >' dash::copy(src_g_begin, src_g_end, des_g_begin);

This is the function code like example bench.07.local-copy:

    for (index_t i = 0; i < blockDimy; i++) {
      for (index_t j = 0; j < blockDimx; j++) {

          index_t src_block_index = i * blockDimy + j;
          index_t des_block_index = j * blockDimx + i;
          auto source_block = data_temp.block(src_block_index);
          auto dest_block = data_out.block(des_block_index);
          size_t block_size = source_block.size();
          index_t copy_start_index = source_block.offset(0);
          index_t copy_end_index = copy_start_index + block_size;
          auto des_start_index = dest_block.offset(0);
          auto src_g_begin = data_temp.begin() + copy_start_index;
          auto src_g_end   = data_temp.begin() + copy_end_index;
          auto des_g_begin = data_out.begin() + des_start_index;

          dash::copy(src_g_begin, src_g_end, des_g_begin);
      }
    }

and the patterns are:

  dash::TeamSpec<2> ts;
  dash::SizeSpec<2> ss(testcase, testcase);
  dash::DistributionSpec<2> ds(dash::TILE(TILESIZE), dash::TILE(TILESIZE)); // TUNING
  ts.balance_extents();
  dash::Pattern<2> pattern(ss, ds, ts); 

  Array_t data_in(pattern);
  Array_t data_out(pattern);
  Array_t data_temp(pattern);

Hello. Thank you for reporting this. It seems that we do not (yet) support global to global copies. What you can do as a short-term workaround is to implement the global copy yourself. If both arrays have the same patterns and sizes it is even simpler as you can copy the local portions on all units.

We have to look into implementing global to global.

Global-to-global dash::copy is a feature that depends on the stale nviews feature-branch.
It already works as-is for one-dimensional ranges.
I will fork a feature branch named something like rviews or ranges for the one-dimensional part for you (@zhukevin04) to test.