Open MPI logo

Hardware Locality Development Mailing List Archives

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

Subject: [hwloc-devel] How to get information about hwloc objects?
From: Jirka Hladky (jhladky_at_[hidden])
Date: 2010-07-04 17:34:23

Hi folks,

I need to get information about hwloc objects, particularly processor. I would
love to get

NUMANode number
Socket number
Core number

for given processor.

Currently, I'm parsing lstopo output but it's awkward:

GREPLINES=$(lstopo --physical --cpuset - | wc -l)
lstopo --physical --cpuset - | grep -B${GREPLINES} "PU p#1\b" | grep Core |
tail -1

With first grep I will get all lines before the line with processor I'm
interested in.

With second grep I will get information about Cores and finally I will pick up
the last line. (So it's first line with keyword Core before the line with

Is there a better way to do it? Something like

hwloc-info proc:1 ???

Or perhaps some c-api function to easily accomplish it?

Thanks a lot!