LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Brian W. Barrett (brbarret_at_[hidden])
Date: 2003-05-21 09:09:07


On Wed, 21 May 2003, Zubair Adamjee wrote:

> I was wondering if you could guide me as to whats the
> best way to pass an object of C++ class , using MPI. I
> mean there are routines that are useful to get derived
> datatypes but if one does not have an indepth
> knowledge of the class or the class has many data
> members which themselves are objects of other classes
> and so on, then is there a way of directly passing
> class objects.

The short answer is that you can't. There is no way to "serialize" a C++
datatype so that you can send it through MPI. And there is no way for MPI
to "know" the structure of a class or struct.

In most cases, the best you can do is to copy out the bits of information
you want into another structure and send that through MPI, unpacking it
and recreating the object on the receiving side.

Hope this helps,

brian

-- 
  Brian Barrett
  LAM/MPI developer and all around nice guy
  Have a LAM/MPI day: http://www.lam-mpi.org/