Open MPI logo

Hardware Locality Users' Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Users mailing list

Subject: Re: [hwloc-users] How to get the coreid of a process on which it is currently mapped?
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2013-02-06 13:07:24


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.
> --
> Kranthi
> _______________________________________________
> hwloc-users mailing list
> hwloc-users_at_[hidden]