I do not believe that there is any MPI library routine that will return the pid of the o / s process that starts the MPI process. To be absolutely accurate, I don’t think that the MPI standard requires one thing: one mapping between MPI processes and o / s processes, as well as no other cardinality of display, although I don’t think I have ever used MPI where there was neither one: one mapping between different representations of processes.
All that aside, why not just use getpidit if you're on a Linux machine? Each MPI process must receive its own pid. I think there is a Windows system call that does the same thing, but I know little about Windows.
source
share