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...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo Cluster Team
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-04-02 20:11 UTC by Paul Preney
Modified: 2022-06-10 14:35 UTC (History)
5 users (show)

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


Attachments

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 ( https://www.open-mpi.org/projects/hwloc/doc/v2.7.1/a00373.php#faq_rocm_build ), 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 @@
 LICENSE="BSD"
 SLOT="0/15"
 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 @@
                >=x11-libs/libpciaccess-0.13.1-r1[${MULTILIB_USEDEP}]
        )
        udev? ( virtual/libudev:= )
+       rocm? ( dev-util/rocm-smi )
        xml? ( >=dev-libs/libxml2-2.9.1-r4[${MULTILIB_USEDEP}] )
        video_cards_nvidia? (
                x11-drivers/nvidia-drivers[static-libs]
@@ -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[@]}"