I assume you're talking about MPI ranks, right? In the general case, you
can't. hwloc knows about processes, not about ranks. And there's no
standard way to convert between them.
That said, Open MPI defines the OMPI_COMM_WORLD_RANK environment
variable that contains what you want. If you use hwloc 1.6 or later,
hwloc-ps has a new --pid-cmd option that will help.
Create a script containing:
cat /proc/$1/environ 2>/dev/null | xargs --null --max-args=1 echo | grep
Then call hwloc-ps like this to get the PID, binding, command and rank
of each process:
$ utils/hwloc-ps --pid-cmd myscript
29093 L1dCache:0 myprogram OMPI_COMM_WORLD_RANK=0
29094 L1dCache:2 myprogram OMPI_COMM_WORLD_RANK=1
29095 L1dCache:1 myprogram OMPI_COMM_WORLD_RANK=2
29096 L1dCache:3 myprogram OMPI_COMM_WORLD_RANK=3
Does that help?
Le 06/02/2013 17:41, Kranthi Kumar a écrit :
> Hello Sir,
> How do we know the processor on which a particular process is running
> using hwloc?
> The only information we have is the rank of the process.
> hwloc-users mailing list