MPI_Rank return same process number for all process

Make sure that both mpicc and mpirun come from the same MPI implementation. When mpirun fails to provide the necessary universe information to the launched processes, with the most common reason for that being that the executable was build against a different MPI implementation (or even a different version of the same implementation), MPI_Init() falls back to the so-called singleton MPI initialisation and creates an MPI_COMM_WORLD that only contains the calling process. Thus the result is many MPI processes within their own separate MPI_COMM_WORLD instances.

Usually commands like mpicc --showme, which mpicc and which mpirun could help you find out if that is the case indeed.

Leave a Comment