-
Notifications
You must be signed in to change notification settings - Fork 44
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
Different outputs from main and print_matrix #679
Comments
@fuchsto @rkowalewski @fuerlinger This is a question to you: what is the iteration order of a global iterator through a tiled matrix? My understanding is that it should still go row-wise, not tile-wise (the global pointer's iteration order is tile-wise, right?). Iterating over the matrix using global iterators has the same result as what template<class MatrixT>
void print_matrix_iter(const MatrixT& matrix)
{
typedef typename MatrixT::value_type value_t;
int c = 0;
cout << std::endl;
cout << "Matrix (iter):" << endl;
for (auto it = matrix.begin(); it != matrix.end(); ++it) {
std::cout << setw(5) << static_cast<value_t>(*it) << " ";
if (++c % matrix.extent(0) == 0) {
std::cout << std::endl;
}
}
}
|
There is no single answer IMHO. It makes sense that we iterate tile-wise as the default iteration order, because...what should be the default iteration order of a matrix? There is no real standard how to iterate over a ND-Matrix which is why I would expect the user to explicitly ask for a global row-wise iterator. Other maths projects (e.g. Eigen) also provide explicit iterators for such purposes 1. Unfortunately these concepts are not well supported in our library. My conclusion is that tile-wise iteration is a valid default. The user has to explicitly iterate row-wise which is possible using the subscript operators at least. However, we could be better with more advanced iterators. |
@rkowalewski Thanks for the clarification! I was wrongly assuming that global iterators follow the row-iteration order. We should definitely add this capability, maybe as a specialization of @Goon83 I'm afraid at this point you're left to iterating over the in nested for loops and doing element-wise accesses. That is not super efficient but gets the job done. I hope we can come up with versions of global iterators that allow us to use |
@devreal thanks for confirmation. BTW, does the DASH has an API to access a contiguous subset of a matrix. I did not find such API in https://codedocs.xyz/dash-project/dash/a01398.html Thanks. |
Hi All,
On the Mac (#673) with its default Makefile, I am testing the below simple example code to understand how DASH works. It gives me some confused results. I tried to print out matrix within main and print_matrix. sub function. The output from print_matrix looks wrong. Did I do something wrong with the code ?
Thanks.
Bin
The text was updated successfully, but these errors were encountered: