Empacotamento e Desempacotamento de Dados
Exemplo: transmitir float* a_ptr, b_ptr ; int* n_ptr;
char buffer[100]; /* Store data in buffer */
int position; if (my_rank == 0){
printf("Enter a, b, and n\n");
scanf("%f %f %d", a_ptr, b_ptr, n_ptr);
MPI_Pack(a_ptr, 1, MPI_FLOAT, buffer, 100,
&position, MPI_COMM_WORLD);
/* Position has been incremented: it now refer- */
/* ences the first free location in buffer. */
MPI_Pack(b_ptr, 1, MPI_FLOAT, buffer, 100,
&position, MPI_COMM_WORLD);
/* Position has been incremented again. */