fork download
  1. #include <mpi.h>
  2. #include <stdio.h>
  3. int main(int argc, char **argv) {
  4. int rank,size;
  5. MPI_Init(&argc, &argv);
  6. MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  7. MPI_Comm_size(MPI_COMM_WORLD, &size); printf("I'm %d of %d\n",rank,size);
  8. if(rank == 0) {
  9. printf("Primeiro a escrever!\n",rank);
  10. MPI_Barrier(MPI_COMM_WORLD);
  11. }else {
  12. MPI_Barrier(MPI_COMM_WORLD);
  13. printf("Agora posso escrever!\n", rank);
  14. }
  15. MPI_Finalize();
  16. return 0; }
Success #stdin #stdout #stderr 0.35s 38832KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: unexpected symbol in "int main"
Execution halted