[Beowulf] Block send mpi

rene rene at renestorm.de
Tue Feb 15 02:37:23 PST 2005


Hi Mark,

please revise this one more time.
Maybe I understood it now.

 int packsize;
 MPI_Pack_size (bit, MPI_INT, newcomm, &packsize);
- Calculates the memory demand (packsize) in bytes  needed for count (bit) of 
MPI_INTs.

 int bufsize = packsize + (MPI_BSEND_OVERHEAD);
- Adds the overhead
 void *buf = new (void (*[bufsize]) );
- allocates the needed buffer in bytes.

MPI_Buffer_attach (buf, bufsize);
- attaches the buffer  
bsend->ierr =	MPI_Bsend (&testdata[0], bit, MPI_INT, node, 0,  newcomm);
- sends the data
MPI_Buffer_detach (&buf, &bufsize);
- Detaches it

Regards,
Rene

> > int packsize;
> > MPI_Pack_size (bit, MPI_INT, newcomm, &packsize);
>
> I would expect packsize to be counting bytes here.
>
> > int bufsize = packsize + (MPI_BSEND_OVERHEAD);
> > // 		  void *buf = new (void (*[packsize]) ());
> > int *buf = new (int ([packsize]));
>
> but here you have allocated an array of ints where the number
> of elements is packsize.  that means you have 4x too many bytes.
>
> >       bsend->ierr = MPI_Bsend (&testdata[0], bit, MPI_INT, node, 0, 
> > newcomm);
>
> bear in mind that &testdata[0] is legal but redundant -
> it means the same thing as bare 'testdata'.




-- 
Rene Storm
@Cluster

Linux Cluster Consultant
Hamburgerstr. 42e
D-22952 Luetjensee
mailto:Rene at ReneStorm.de
Voice-IP: Skype.com, Rene_Storm



More information about the Beowulf mailing list