fork download
  1. #include<stdio.h>
  2.  
  3. #include<mpi.h>
  4.  
  5. void main (int argc, char **argv)
  6.  
  7. {
  8.  
  9. int myrank;
  10.  
  11. MPI_Status status;
  12.  
  13. double a[100]; MPI_Init(&argc, &argv); /* Initialize MPI */
  14.  
  15. MPI_Comm_rank(MPI_COMM_WORLD, &myrank); /* Get rank */
  16.  
  17. if( myrank == 0 ) /* Send a message */
  18.  
  19. MPI_Send( a, 100, MPI_DOUBLE, 1, 17, MPI_COMM_WORLD );
  20.  
  21. else if( myrank == 1 ) /* Receive a message */
  22.  
  23. MPI_Recv( a, 100, MPI_DOUBLE, 0, 17, MPI_COMM_WORLD, &status );
  24.  
  25. MPI_Finalize(); /* Terminate MPI */
  26.  
  27. }
Success #stdin #stdout #stderr 0.26s 38876KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: unexpected symbol in "void main"
Execution halted