Syntax:
(Ermitteln der Puffergröße für eine gepufferte Sendeoperation)
#include "mpi.h"
#define MAX1 32
#define MAX2 16
int intsize, charsize;
...
MPI_Datatype datatype1, datatype2;
MPI_Comm comm;
MPI_Status stat;
...
MPI_Comm_rank(comm, &myid);
if (myid==0) {
...
MPI_Pack_size(MAX1, datatype1, comm, &size1);
MPI_Pack_size(MAX2, datatype2, comm, &size2);
bufsize = size1 + size2 + (2 * MPI_BSEND_OVERHEAD);
buf=(void *)malloc(bufsize*sizeof(void));
MPI_Buffer_attach(buf, bufsize);
MPI_Bsend(msg1, MAX1, datatype1, 1, 0, comm);
MPI_Bsend(msg2, MAX2, datatype2, 1, 1, comm);
}
...