t1nman

mpi_simple

May 25th, 2012
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <mpi.h>
  3.  
  4. int main (int argc, char* argv[])
  5. {
  6.     int rank, size;
  7.  
  8.     MPI_Init (&argc, &argv);
  9.     MPI_Comm_rank (MPI_COMM_WORLD, &rank);
  10.     MPI_Comm_size (MPI_COMM_WORLD, &size);
  11.  
  12.     printf( "I'm process %d\n", rank );
  13.     if (rank == 0)
  14.     printf("Number of processes %d\n", size);
  15.        
  16.     MPI_Finalize();
  17.                
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment