fork download
  1. #include <mpi.h>
  2. #include <stdio.h>
  3.  
  4. int main(int argc, char** argv) {
  5. // Initialize MPI
  6. MPI_Init(&argc, &argv);
  7.  
  8. // Get the rank of the current process
  9. int rank;
  10. MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  11.  
  12. // Print a message showing the rank of each process
  13. printf("Hello from process %d\n", rank);
  14.  
  15. // Finalize MPI
  16. MPI_Finalize();
  17. return 0;
  18. }
  19.  
Success #stdin #stdout #stderr 0.24s 38968KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: unexpected symbol in "int main"
Execution halted