Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting strided ranges #116

Open
fuchsto opened this issue Nov 17, 2016 · 0 comments
Open

Supporting strided ranges #116

fuchsto opened this issue Nov 17, 2016 · 0 comments

Comments

@fuchsto
Copy link
Member

fuchsto commented Nov 17, 2016

From issue #3:

Consider the following use cases:

// assuming row-major storage
dash::Matrix<double, 2> matrix(...);

auto lcol = matrix.local.col(0);
auto lrow = matrix.local.row(0);
auto n_lcol = std::distance(lcol.begin(), lcol.end());
auto n_lrow = std::distance(lcol.begin(), lrow.end());

std::vector<double> copy_lrow(n_lrow);
std::vector<double> copy_lcol(n_lcol);

// works:
dash::copy(lrow.begin(), lrow.end(), copy_lrow.data());
// fails:
dash::copy(lcol.begin(), lcol.end(), copy_lcol.data());

Slicing columns from a matrix with row-major storage order is fine, but copying this slice is not.
This is a missing feature: DASH does not support strided copying yet.

[ 0 1 2 3 ]  <- row contiguous in memory   | 8 | 4 | 0 |  <- column is strided, requires packing
[ 4 5 6 7 ]                                | 9 | 5 | 1 |     into temporary buffer [ 0 4 8 ] or
[ 8 9 0 1 ]        -- rot 90° -->          | 0 | 6 | 2 |     single copy operations for every
                                           | 1 | 7 | 3 |     value

This affects the specification of at least the following interfaces:

  • Implementations of dash::copy should support strided input ranges, the interface must not change
  • dash::local_range should be extended by dash::local_ranges which resolves a list of local ranges in
    a global input range
  • dash::local_range should return the first local range in a global input range
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants