daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdlib.h>
  2. #include<mpi.h>
  3. #include<stdio.h>
  4.  
  5. int main(int argc,char **argv)
  6. {
  7.     int numprocs;
  8.     int rank;
  9.     MPI_INIT((&argc,&argv);
  10.     MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
  11.     MPI_Comm_rank(MPI_COMM_WORLD,&rank);
  12.     if(rank==0)
  13.     {
  14.         int x =2;
  15.         MPI_Send(&x,1,MPI_INT,1,0,MPI_COMM_WORLD);
  16.     }
  17.     if(rank ==1)
  18.     {
  19.         MPI_Recv(&x,1,MPI_INT,0,0,MPI_COMM_WORLD,MPI_STATUS_IGNORE);
  20.         printf(("NOduk %i : x= %i \n"m\,rank,x);
  21.     }
  22.     MPI_Finalize();
  23.     return 0;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top