-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
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.