fork download
  1. #include <iostream>
  2. #include <mpi.h>
  3.  
  4. int main(int argc, char** argv) {
  5. MPI_Init(&argc, &argv);
  6. int size;
  7. MPI_Comm_size(MPI_COMM_WORLD, &size);
  8. int rank;
  9. MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  10. char processor_name[MPI_MAX_PROCESSOR_NAME];
  11. int name_len;
  12. MPI_Get_processor_name(processor_name, &name_len);
  13. printf("Hello world from processor %s, rank %d, out of %d processors\n", processor_name, rank, size);
  14. MPI_Finalize();
  15. return 0;
  16. }
Success #stdin #stdout #stderr 0.29s 40912KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: unexpected symbol in "int main"
Execution halted