I've discovered an MPI communicator called MPI_COMM_SELF. The problem is, I don't know, when is it useful. It appears to me, that just every process "thinks" about itself as root.
Could you explain me how does MPI_COMM_SELF
exactly work and in which situations is it useful?
I've found this slide-show, but the communicator is only briefly mentioned there.
I've tried this "Hello, world" example and all processes returned 0 as their PID.
#include <mpi.h>
#include <stdio.h>
int main() {
MPI_Init(NULL, NULL);
int world_rank;
MPI_Comm_rank(MPI_COMM_SELF, &world_rank);
printf("Hello, my PID is %d!\n",
world_rank);
MPI_Finalize();
return 0;
}