Boost logo

Boost Users :

Subject: Re: [Boost-users] does Boost.MultiArray work with Boost.MPI?
From: John Phillips (phillips_at_[hidden])
Date: 2008-10-24 14:56:58


Tom Smith wrote:
> Dear All,
>
> I am trying to write some parallel code using Boost.MPI? I also want to
> use the class Boost.MultiArray.
>
> My question is: does Boost.MultiArray support parallel computation? If
> not, which class should I use instead for multi-d array operations.
> Thanks a lot!
>
> best wishes
>
> Tom
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users

   Tom,

   The answer appears to be no. For a custom class to be usable with the
boost.MPI communication functions, it needs to have serialization
operations defined (as in the serialization library). I looked in the
MultiArray, Serialization, and MPI libraries, and I don't see such a
definition in any of them. (It's always possible I missed it, and if the
authors write back to tell you it is there, they are obviously right.)

   From this position, there are a few choices.

1 -- You could work with the authors to produce serialization operations
for the multi-array library. This would be great, because it could get
added to the trunk, tested and become a standard part of the MultiArray
library that everyone else could also benefit from. If you are already
familiar with both serialization and MultiArray, this might not even be
very hard.

2 -- You could use the base MPI functions for a custom data structure.
You still have complete access to the base MPI calls when working with
boost.MPI. They include functions for serializing custom data
structures. The functions aren't pretty by the standards of current C++
design, but they are there and functional. This would be a solution for
your code, but less portable and less readable than option 1.

3 -- You could fall back to some other data structure for the data
points. You could, for example, map your array to a vector and store it
that way. Vectors already have provided serialization, so MPI
communication is easy. The problem in that case is that the data
structure may not be a good reflection of the concept it is supposed to
model. This would complicate algorithms, and could cause problems with
performance if it breaks things like data locality. Replacing the
MultiArray with other data structures may also be possible, but it is
probably not a good idea if it breaks much of your other reasoning.

   Sorry you are stuck with choices. Personally, I'd vote for option 1,
but you should do what's best for your project.

                        John


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net