fork download
  1. #include <mpi.h>
  2. #include <stdio.h>
  3.  
  4. int main(int argc, char **argv) {
  5.  
  6. int my_rank;
  7. int size;
  8. MPI_Init(&argc, &argv); /*START MPI */
  9.  
  10. /*DETERMINE RANK OF THIS PROCESSOR*/
  11. MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
  12.  
  13. /*DETERMINE TOTAL NUMBER OF PROCESSORS*/
  14. MPI_Comm_size(MPI_COMM_WORLD, &size);
  15.  
  16. printf("Hello world! I'm rank (processor number) %d of size %d\n", my_rank, size);
  17.  
  18. MPI_Finalize(); /* EXIT MPI */
  19.  
  20. return 0;
  21. }
  22.  
  23.  
Success #stdin #stdout #stderr 0.29s 39296KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: unexpected symbol in "int main"
Execution halted