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

Adventures in copying a row out of a Matrix #454

Open
devreal opened this issue Oct 26, 2017 · 1 comment
Open

Adventures in copying a row out of a Matrix #454

devreal opened this issue Oct 26, 2017 · 1 comment

Comments

@devreal
Copy link
Member

devreal commented Oct 26, 2017

I've been trying to copy a row out of a matrix. The good news: it works. The bad news: it works in exactly one use-case and fails for all others.

What works

dash::Matrix<int, 2> mat(size*NX, size*NY);
// fill matrix...
// copy the first row into local buffer
int *buf = new int[mat.extent(1)];
dash::copy(mat[0].begin(), mat[0].end(), buf);

Each unit has the first global row in the buffer (copied from unit 0).

What does not work

Any other data distribution either yields wrong results or throws an exception, e.g.,

dash::Matrix<int, 2> mat(size*NX, size*NY, dash::BLOCKED, dash::BLOCKED);
// fill matrix...
// copy the first row into local buffer
int *buf = new int[mat.extent(1)];
dash::copy(mat[0].begin(), mat[0].end(), buf);

yields only elements from unit 0 (specifically its two first local rows instead of the first global row in a 2x2 distribution).

Alternatively, the copy appears to be empty:

dash::Matrix<int, 2> mat(size*NX, size*NY, dash::NONE, dash::BLOCKCYCLIC(2));
// fill matrix...
// copy the first row into local buffer
int *buf = new int[mat.extent(1)];
dash::copy(mat[0].begin(), mat[0].end(), buf);

results in the following error:

[    1 ERROR ] [ 32056 ] Copy.h                   :215  | dash::exception::OutOfRange                  | [ Unit 1 ] Range assertion 0 > 0 failed: Number of element to copy is 0 /home/joseph/opt/dash-0.3.0//include/dash/algorithm/Copy.h:215 
terminate called after throwing an instance of 'dash::exception::OutOfRange'

on all units but unit 0.

@fuchsto
Copy link
Member

fuchsto commented Jan 10, 2018

Whussa. I don't think it's a problem with dash::Matrix, this looks like an issue in the block pattern.
Using dash::SeqTilePattern should work, for example. I copy from/to matrix objects a lot, and so do other unit tests like those for SUMMA and algorithm/copy.

@devreal devreal modified the milestones: dash-0.3.0, dash-0.4.0 Sep 20, 2018
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

2 participants