Advertisement
Bernard0x01

Untitled

Apr 18th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. // Find out rank, size
  2. int world_rank;
  3. MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
  4. int world_size;
  5. MPI_Comm_size(MPI_COMM_WORLD, &world_size);
  6.  
  7. int number;
  8. if (world_rank == 0) {
  9.     number = -1;
  10.     MPI_Send(&number, 1, MPI_INT, 1, 0, MPI_COMM_WORLD);
  11. } else if (world_rank == 1) {
  12.     MPI_Recv(&number, 1, MPI_INT, 0, 0, MPI_COMM_WORLD,MPI_STATUS_IGNORE);
  13.     printf("Process 1 received number %d from process 0\n", number);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement