I don't know C++ but I assume it will work the same as in C. This
should be fairly simple, though I cannot speak for the overhead.
Create a contiguous datatype of 6 floats. Then resize it
(MPI_Type_create_resized) to have lb = 0 and an extent equal to the size
of the structure. Then, when you bcast, pass the address in like:
&simparticle[0].pos
and send 1000 elements.
This should work.
Dave.
Leslie Nkansa Osei-Bonsu wrote:
> Hi,
>
> I am working on a particle simulation using C++ and MPI
> I have a class particle as in the following,
>
> class Particle{
> float mass;
> float charge;
> float pos[3];
> float vel[3];
> int id;
> //plus more data members
> }
> in the form of array say-: Particle simparticle[1000];
>
> After each iteration, I want to broadcast the pos[3] and vel[3]
> values but I dont want to BCast in bit and pieces, I wanted to
> use a derived datatype that would automatically send the values
> as once communication block.
>
> Can it be done in MPI without serious overhead? If so any ideas
> on how to construct the relevant data types? I constructed a
> datatype using the full typemap but I am stuck on how to proceed
> from there.
>
>
> Thank In advance for you help
>
> Leslie
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>
--
Dr. David Cronk, Ph.D. phone: (865) 974-3735
Research Leader fax: (865) 974-8296
Innovative Computing Lab http://www.cs.utk.edu/~cronk
University of Tennessee, Knoxville
|