hello-world.c 328 B

12345678910111213
  1. #include <stdio.h>
  2. #include <mpi.h>
  3. int main (int argc, char** args) {
  4. int size;
  5. int myrank;
  6. MPI_Init(&argc, &args);
  7. MPI_Comm_size(MPI_COMM_WORLD, &size);
  8. MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
  9. printf("Hello world, I have rank %d out of %d.\n",
  10. myrank, size);
  11. MPI_Finalize();
  12. return 0;
  13. }