Hello,
I am trying to do a matrix vector multiplication using MPI. The matrix is a diagonal one, so I store the diagonal elements in a vector. then I distribute the element of two vectors among processors and do the multiplication. at the end I gather the local result. the problem is that the size of vector is changing and it gives me some strange results.
Surely, we've been here before? &local_res is a pointer to the vector itself, NOT to its data buffer. You need local_res.data()
Similarly with &res - should be res.data()
Thanks for your answer. Yes, you explained this before in one thread, I went for that first but I had a mistake, I wrote &res instead of res.data() but for the other arguments I had used .data(). That's why in the first try I didn't get the right answer.