<div dir="ltr"><div dir="ltr"><div>PMI_RANK and PMI_SIZE look to me like what you want and one of my Intel colleagues had the same answer in response to a similar question regarding Intel MPI, which also uses Hydra (<a href="https://software.intel.com/en-us/forums/intel-clusters-and-hpc-technology/topic/703734">https://software.intel.com/en-us/forums/intel-clusters-and-hpc-technology/topic/703734</a>).</div><div><br></div><div>I'm sure you know that all of this is non-standard and relying on it is inherently non-portable.</div><div><br></div><div>Jeff</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Feb 3, 2019 at 1:40 PM Brice Goglin via discuss <<a href="mailto:discuss@mpich.org">discuss@mpich.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello<br>
<br>
Is there a way to find out the rank of a process (in COMM_WORLD) by<br>
looking at its environment? We use this feature in OpenMPI and srun for<br>
displaying the placement of ranks in hwloc tools. By default, we display<br>
the PID, but displaying the commworld rank is more useful. Looking in<br>
/proc/<pid>/environ is an easy way to find environment variables, but I<br>
could not find a clear solution for MPICH.<br>
<br>
I tried on several machines with different mpich installations. In one<br>
case, I found a MPI_LOCALRANKID (which isn't exactly what I want but<br>
could be sufficient). There's also PMI_RANK, which may be identical to<br>
the commworld rank?<br>
<br>
Thanks for the help<br>
<br>
Brice<br>
<br>
<br>
<br>
_______________________________________________<br>
discuss mailing list <a href="mailto:discuss@mpich.org" target="_blank">discuss@mpich.org</a><br>
To manage subscription options or unsubscribe:<br>
<a href="https://lists.mpich.org/mailman/listinfo/discuss" rel="noreferrer" target="_blank">https://lists.mpich.org/mailman/listinfo/discuss</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Jeff Hammond<br><a href="mailto:jeff.science@gmail.com" target="_blank">jeff.science@gmail.com</a><br><a href="http://jeffhammond.github.io/" target="_blank">http://jeffhammond.github.io/</a></div></div></div>