Skip to content

Commit

Permalink
sessions:undo ring_c.c changes
Browse files Browse the repository at this point in the history
Signed-off-by: Howard Pritchard <howardp@lanl.gov>
  • Loading branch information
hppritcha committed Jul 6, 2021
1 parent 5e9df52 commit 173116f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions examples/ring_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* Simple ring test program in C.
*/

#include <stdio.h>
#include "mpi.h"
#include <stdio.h>

int main(int argc, char *argv[])
{
Expand All @@ -34,8 +34,8 @@ int main(int argc, char *argv[])
if (0 == rank) {
message = 10;

printf("Process 0 sending %d to %d, tag %d (%d processes in ring)\n",
message, next, tag, size);
printf("Process 0 sending %d to %d, tag %d (%d processes in ring)\n", message, next, tag,
size);
MPI_Send(&message, 1, MPI_INT, next, tag, MPI_COMM_WORLD);
printf("Process 0 sent to %d\n", next);
}
Expand All @@ -49,8 +49,7 @@ int main(int argc, char *argv[])
and can quit normally. */

while (1) {
MPI_Recv(&message, 1, MPI_INT, prev, tag, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);
MPI_Recv(&message, 1, MPI_INT, prev, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE);

if (0 == rank) {
--message;
Expand All @@ -68,8 +67,7 @@ int main(int argc, char *argv[])
to be received before the program can exit */

if (0 == rank) {
MPI_Recv(&message, 1, MPI_INT, prev, tag, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);
MPI_Recv(&message, 1, MPI_INT, prev, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
}

/* All done */
Expand Down

0 comments on commit 173116f

Please sign in to comment.