Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count memory tiers with command line tool #661

Closed
antoine-morvan opened this issue Apr 3, 2024 · 4 comments
Closed

Count memory tiers with command line tool #661

antoine-morvan opened this issue Apr 3, 2024 · 4 comments

Comments

@antoine-morvan
Copy link

Hello,

I was playing with the recent introduction of memory tiers. I am still looking for the command that would give me the number of memory tiers available on the machine. Does any of the command line tool provide such feature ?

My current workaround is to count with something like this :

TIERCOUNT=$(lstopo -v | grep -i tier | rev | cut -d' ' -f1 | sort -u | wc -l) # or some awk / perl / etc.
[ $TIERCOUNT == 0 ] && TIERCOUNT=1 # since memory tiers are only shown when there are more than 1

Best.

@bgoglin
Copy link
Contributor

bgoglin commented Apr 3, 2024

Hello. There's currently no way, mostly because there's no API to query tiers (and there likely won't be before 3.0).
Given that Tiers are currently an object info attribute only, we could have another global attribute with that number. In 2.x in would be machine object info, retrievable from the command-line with:

$ hwloc-info root | sed -n -e 's/ info MemoryTiersNr = //p'

In 3.0 it would be a topology info:

$ hwloc-info --topology -v | sed -n -e 's/info MemoryTiersNr = //p'

I can easily add this for 2.11.

@bgoglin
Copy link
Contributor

bgoglin commented Apr 3, 2024

I think I'll add an option to get a single attribute to hwloc-info and make it work with that syntax for both 2.x and 3.0. Something like:

$ hwloc-info --attr "info MemoryTiersNr" topology

@antoine-morvan
Copy link
Author

To be honnest, I initially looked for a syntax like hwloc-calc --number-of tier machine:0 :)

@bgoglin
Copy link
Contributor

bgoglin commented Apr 3, 2024

That would require much more work since we'd need to emulate a fake "tier" object to count them, hwloc-calc doesn't know how to do that at all. And it would be quite annoying to implement for anything but machine:0.

bgoglin added a commit to bgoglin/hwloc that referenced this issue Apr 30, 2024
…x etc

Refs open-mpi#661

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
bgoglin added a commit that referenced this issue Apr 30, 2024
…x etc

Refs #661

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
(cherry picked from commit 665a51a)
bgoglin added a commit to bgoglin/hwloc that referenced this issue Apr 30, 2024
Closes open-mpi#661

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
@bgoglin bgoglin mentioned this issue Apr 30, 2024
bgoglin added a commit that referenced this issue Apr 30, 2024
`hwloc-info --get-attr "info MemoryTiersNr" topology`
Closes #661
bgoglin added a commit that referenced this issue Apr 30, 2024
Closes #661

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
(cherry picked from commit 0839821
                and commit 6d4df37)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants