High Performance Computing 1
MPI Messages
•
•MPI_Pack(n_ptr, 1, MPI_INT, buffer, 100, &position, MPI_COMM_WORLD);
• /* Now broadcast contents of buffer */
•MPI_Bcast(buffer, 100, MPI_PACKED, root, MPI_COMM_WORLD);
•}
•else
•{
•MPI_Bcast(buffer, 100, MPI_PACKED, root, MPI_COMM_WORLD);
• /* Now unpack the contents of buffer */
•position = 0;
•MPI_Unpack(buffer, 100, &position, a_ptr, 1, MPI_FLOAT, MPI_COMM_WORLD);
• /* Again position incremented by sizeof(float) bytes */
•MPI_Unpack(buffer, 100, &position, b_ptr, 1, MPI_FLOAT, MPI_COMM_WORLD);
•MPI_Unpack(buffer, 100, &position, n_ptr, 1, MPI_INT, MPI_COMM_WORLD);
•}
•}