Hi all,
the exception on MPI_PACKED in the type matching rules (3.3.1) suggests, that one side of the communication can pack/unpack the message, while the other side reads/writes natively.
I.e., is the following code valid MPI code?
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
int A[100], B[10], psize;
for (int i = 0; i < 100; i++)
A[i] = i;
MPI_Init(NULL, NULL);
MPI_Pack_size(1, MPI_INT, MPI_COMM_SELF, &psize);
void *parr = malloc(psize * 10);
int pos = 0;
for (int i = 0; i < 10; i++)
MPI_Pack(&(A[i * 10]), 1, MPI_INT, parr, psize * 10, &pos,
MPI_COMM_SELF);
// Send the packed data and receive a contiguous buffer
MPI_Sendrecv(parr, pos, MPI_PACKED, 0, 42, B, 10, MPI_INT, 0,
42, MPI_COMM_SELF, MPI_STATUS_IGNORE);
for (int i = 0; i < 10; i++)
printf("%i\n", B[i]);
MPI_Finalize();
}
Can the packed buffer include meta data? This would be reflected by a larger value in /pos/, right? Can this lead to unexpected message truncation?
Thanks
Joachim
--
Dipl.-Inf. Joachim Protze
IT Center
Group: High Performance Computing
Division: Computational Science and Engineering
RWTH Aachen University
Seffenter Weg 23
D 52074 Aachen (Germany)
Tel: +49 241 80- 24765
Fax: +49 241 80-624765
protze@itc.rwth-aachen.de
www.itc.rwth-aachen.de
_______________________________________________
mpiwg-p2p mailing list
mpiwg-p2p@lists.mpi-forum.org
https://lists.mpi-forum.org/mailman/listinfo/mpiwg-p2p