Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 836663 - sys-apps/hwloc should also have rocm USE flag...
Summary: sys-apps/hwloc should also have rocm USE flag...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo Cluster Team
Keywords: PullRequest
Depends on:
Reported: 2022-04-02 20:11 UTC by Paul Preney
Modified: 2024-04-25 08:49 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Paul Preney 2022-04-02 20:11:21 UTC
sys-apps/hwloc: Adding ROCm support requires --with-rocm=ROCmPATH (and optionally --enable-rsmi to cause the emerge to fail if ROCmPATH is not present) and available ebuilds do not provide for this.

Reproducible: Always

Steps to Reproduce:
1. emerge dev-util/rocm-smi (if not already installed)
2. emerge sys-apps/hwloc
3. lstopo fails to show ROCm GPUs (for example, assuming one has such hardware)

Expected Results:  
AMD ROCm hardware would be seen by hwloc's tools.

In hwloc's FAQ ( ), adding ROCm support requires --with-rocm=ROCmPATH when configuring which the sys-apps/hwloc ebuilds do not pass. Additionally, to trigger a build failure --with-rsmi should also be passed if RSMI cannot be found.

NVIDIA CUDA support is present in the sys-apps/hwloc ebuilds with the cuda USE flag. It appears adding a "rocm" use flag is in order, i.e.,

1. Add "rocm" to IUSE.
2. Add "rocm? ( dev-util/rocm-smi )" to RDEPEND.
3. Add "$(use_enable rocm rsmi)" to myconf in multilib_src_configure().
4. Add "$(use_with rocm rocm "${ESYSROOT}/usr")" to myconf in  multilib_src_configure().

I did the above changes to sys-apps/hwloc-2.7.1-r1.ebuild placed a local overlay and was able to successfully re-emerge the package and commands such as "lstopo-no-graphics --whole-io topo.xml" now report the ROCm hardware.

With ROCm packages in the main Gentoo overlay, might a "rocm" use flag per the above be added to the sys-apps/hwloc package to enable such hardware to be reported? For example, the above changes are a straight-forward patch to the ebuild:

--- /var/db/repos/gentoo/sys-apps/hwloc/hwloc-2.7.1-r1.ebuild   2022-03-26 21:39:59.000000000 -0400
+++ hwloc-2.7.1-r1.ebuild       2022-04-02 15:47:50.581682631 -0400
@@ -13,7 +13,7 @@
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"
-IUSE="cairo +cpuid cuda debug nvml +pci static-libs svg udev xml X video_cards_nvidia"
+IUSE="cairo +cpuid cuda debug nvml +pci static-libs svg udev xml rocm X video_cards_nvidia"
 # opencl: opencl support dropped with x11-drivers/ati-drivers being removed (bug #582406).
 #         anyone with hardware is welcome to step up and help test to get it re-added.
@@ -27,6 +27,7 @@
        udev? ( virtual/libudev:= )
+       rocm? ( dev-util/rocm-smi )
        xml? ( >=dev-libs/libxml2-2.9.1-r4[${MULTILIB_USEDEP}] )
        video_cards_nvidia? (
@@ -86,6 +87,9 @@
                $(use_enable static-libs static)
                $(use_enable xml libxml2)
                $(use_with X x)
+               $(use_enable rocm rsmi)
+               $(use_with rocm rocm "${ESYSROOT}/usr")
+               #$(use_enable rocm opencl)
        ECONF_SOURCE="${S}" econf "${myconf[@]}"
Comment 1 Larry the Git Cow gentoo-dev 2024-04-25 08:49:00 UTC
The bug has been closed via the following commit(s):

commit 21867382426ea87eccf3c49ece762b4e83589edd
Author:     Andrew Ammerlaan <>
AuthorDate: 2024-04-25 08:45:15 +0000
Commit:     Andrew Ammerlaan <>
CommitDate: 2024-04-25 08:48:24 +0000

    sys-apps/hwloc: remove automagic behaviour of rocm/l0
    - fixed the icon file
    - add doc flag to install doxygen documentation
    Co-authored-by: Alessandro Barbieri <>
    Signed-off-by: Andrew Ammerlaan <>

 profiles/arch/amd64/package.use.mask                        |  4 ++++
 profiles/arch/base/package.use.mask                         |  4 ++++
 profiles/features/musl/package.use.mask                     |  4 ++++
 .../hwloc/{hwloc-2.9.3.ebuild => hwloc-2.9.3-r1.ebuild}     | 13 +++++++++++--
 sys-apps/hwloc/metadata.xml                                 |  2 ++
 5 files changed, 25 insertions(+), 2 deletions(-)