Skip to content

Commit cffffdd

Browse files
zerothijsquyres
authored andcommitted
doc: fixing last problems of MPI_Pack
Signed-off-by: Nick Papior <nickpapior@gmail.com>
1 parent 252f3be commit cffffdd

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

docs/man-openmpi/man3/MPI_Pack.3.rst

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -92,25 +92,22 @@ subsequently used for sending the packed message.
9292

9393
.. code-block:: c
9494
95-
int position, i, j, a[2];
96-
char buff[1000];
97-
98-
....
99-
100-
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
101-
if (myrank == 0)
102-
{
103-
/ * SENDER CODE */
104-
105-
position = 0;
106-
MPI_Pack(&i, 1, MPI_INT, buff, 1000, &position, MPI_COMM_WORLD);
107-
MPI_Pack(&j, 1, MPI_INT, buff, 1000, &position, MPI_COMM_WORLD);
108-
MPI_Send( buff, position, MPI_PACKED, 1, 0, MPI_COMM_WORLD);
109-
}
110-
else /* RECEIVER CODE */
111-
MPI_Recv( a, 2, MPI_INT, 0, 0, MPI_COMM_WORLD)
112-
113-
}
95+
int myrank, position, i, j, a[2];
96+
char buff[1000];
97+
98+
// ...
99+
100+
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
101+
if (myrank == 0) {
102+
/* SENDER CODE */
103+
position = 0;
104+
MPI_Pack(&i, 1, MPI_INT, buff, 1000, &position, MPI_COMM_WORLD);
105+
MPI_Pack(&j, 1, MPI_INT, buff, 1000, &position, MPI_COMM_WORLD);
106+
MPI_Send(buff, position, MPI_PACKED, 1, 0, MPI_COMM_WORLD);
107+
} else {
108+
/* RECEIVER CODE */
109+
MPI_Recv(a, 2, MPI_INT, 0, 0, MPI_COMM_WORLD);
110+
}
114111
115112
116113
ERRORS

0 commit comments

Comments
 (0)