From: "Alain Coetmeur" <alain.coetmeur@icdc.caissedesdepots.fr>
Newsgroups: comp.parallel.mpi
Subject: Re: is it possible to send objects ?
Date: Thu, 15 Apr 1999 13:02:05 +0200
Organization: Informatique-CDC
Message-Id: <7f4h1o$dk72@puligny.idt.cdc.fr>
References: <924170828.773010@www3.netland.nl>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Xref: ukc comp.parallel.mpi:4929


chiwai a écrit dans le message <924170828.773010@www3.netland.nl>...
>
>Hi thanx for helping me out with the permission denied problem.. it is
>finally solved now.. I have an another question can I send objects to an
>another process as a derived datatype ?

(you mean in C++ ? )
>MPI_Send(object,.......) ?

if you create a correct MPI user Type you can ask MPI to transfer
a complex structure, but this il restrictued by two facts:

1- your MPI user type be used by the MPI system to read
plain data in various place of the structure, but it cannot transfer
internal data, identity, which constitute a c++ object.
anyway this can be very usefull for an already constructed C++
object that you will fill with the content of a remote one.
2- the MPI type define constant offset from the base pointers, and constant
sizes. thus you cannot transmit dynamicaly sized data or data
through pointers like we do in C++

for me the second point make MPI_Type unusefull.
I've prefered to use MPI_Pack, which
is slower (there are copies) but more versatile.

however you may design some complex C++ structures
so they can be transmited through MPI user type very efficiently.

the idea would be
to allocate all the C++ data into one new/malloc block,
either by making size static or by allocating various
objects and arrays at fixed offset in a given block.
if the sizing is dynamical you may have to
create a MPI_UserType for each size of object
and even for every object.
be carefull that at the receiving side the sizing must be
compatible.
in C++ the single block allocation can be acchieved
by allocationg a raw memory block (new char or malloc)
and using constructor and destructor manually
like manual allocator do.

there is definetly a place for an Standard Template Library aware
extension of MPI so that structures like valarray
and vectors are MPI_UserTyped easily.


>
>is that possible ?
>
>
>My boss has a object oriented program  and he wants to know if it is
>possible to embed the mpi functions to make it work faster.
>
>Thanx !
>
>

