-
Notifications
You must be signed in to change notification settings - Fork 17
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
datatype_builder for std::vector #16
Comments
Hi, unfortunately, that doesn't work atm. The I suggest for now you linearize your vector into a single vector, then using all2allv is rather straight forward: std::vector<std::vector<T>> my_data = .. ;
// create a size vector
std::vector<size_t> sizes(comm.size());
size_t total_size = 0;
for (int i = 0; i < comm.size(); ++i) {
sizes[i] = my_data.size();
total_size += my_data.size();
}
// linearize
std::vector<T> data_linear(total_size);
std::vector<T>::iterator it = data_linear.begin();
for (int i = 0; i < comm.size(); ++i) {
it = std::copy(my_data[i].begin(), my_data[i].end(), it):
}
// now do the all2all:
std::vector<size_t> recv_sizes = mxx::all2all(data_sizes, comm);
std::vector<T> data_recv = mxx::all2allv(data_linear, sizes, recv_sizes, comm); Then you'll have the received data in a single vector, but the Maybe I should just add a function that does all that to Thoughts? |
That seems like a reasonable approach. It might make sense to allow for automatic serialization if the object has a defined serialization function. I believe Boost.MPI does this. |
How can I construct a
datatype_builder
forstd::vector
? I'm trying to useall2all
with astd::vector<std::vector<int>>
.The text was updated successfully, but these errors were encountered: