I need to send reference to a subarray of 2d of Boost.MultiArray with Boost.MPI. Now I have the following code:
matrix_type::array_view<2>::type
current_process_batch = matrix[boost::indices[range(bias, finish_line)][range(0, width)]];
world.send(rank, BEGIN_TAG, current_process_batch);
But also I have following error trying to execute it:
/usr/local/include/boost/serialization/access.hpp:116:11: error: no member named 'serialize' in 'boost::detail::multi_array::multi_array_view<double, 2>'
t.serialize(ar, file_version);
Can anyone help me to send it to another process?
You need to implement serialization.
Here's a general
multi_array<T. Dims>serializer:See it Live On Coliru
Prints
UPDATE: VIEWS
Mmm. Already accepted? Noticing late that I didn't actually read your question that well. You wanted to serialize a view. You can't, really. You can't "deserialize a view".
The most you can do is deserialize INTO a view.
Here's some more machinery:
adds support for
detail::multi_array::multi_array_view<...>in the sense that it can deserialize INTO an existing view of matching shape onlyadds support for
detail::multi_array::const_multi_array_view<...>only for serializing. Said view can be deserialized into a non-const view only, for obvious reasons.extends the demo with a sub-view that patches the initial array after serializing, so we can verify that reading the patch into an equivalent view of the restored array has the same effect as on the original (after checking that the patch created the expected mismatch
20 != 999).Live On Coliru