summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorRomain GARBAGE <romain.garbage@inria.fr>2026-02-13 16:22:22 +0100
committerAndreas Enge <andreas@enge.fr>2026-03-16 10:16:40 +0100
commitf380c63da454e4e21e88db1e65a18bfb65f8c919 (patch)
tree7ce07cec0eaad18876d72ddaca6b4b8c82622229 /gnu
parentcf5b8dce21799ca3020a4b8e9fffb6a7dc75b985 (diff)
gnu: hwloc-2: Fix OpenCL linking error for dependents.
* gnu/packages/mpi.scm (hwloc-2)[origin]: Add patch adding a configure flag for OpenCL. [native-inputs]: Add dependencies required to generate configure. Remove opencl-ic-loader... [inputs]: ...and move it here. [arguments]: Use new configure flag. Force configure script generation. Merges guix/guix!6032 Change-Id: Idd31c6b6efbab9c87f83c5af750a0994518be69a Signed-off-by: Cayetano Santos <csantosb@inventati.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/mpi.scm18
-rw-r--r--gnu/packages/patches/hwloc-add-with-opencl.patch90
2 files changed, 106 insertions, 2 deletions
diff --git a/gnu/packages/mpi.scm b/gnu/packages/mpi.scm
index a9411f922e0..4aaf2d5ed76 100644
--- a/gnu/packages/mpi.scm
+++ b/gnu/packages/mpi.scm
@@ -38,6 +38,7 @@
#:use-module (guix build-system gnu)
#:use-module (guix build-system pyproject)
#:use-module (gnu packages)
+ #:use-module (gnu packages autotools)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages bison)
@@ -171,20 +172,33 @@ bind processes, and much more.")
"/hwloc-" version ".tar.bz2"))
(sha256
(base32
- "1aqdznqp7f18yg95vbr5n6ccxxdiywacygvn3wbhzn7bnspkdsaj"))))
+ "1aqdznqp7f18yg95vbr5n6ccxxdiywacygvn3wbhzn7bnspkdsaj"))
+ ;; XXX: Remove after updating package from 2.13.0.
+ (patches (search-patches "hwloc-add-with-opencl.patch"))))
(native-inputs (modify-inputs (package-native-inputs hwloc-1)
+ (append autoconf)
+ (append automake)
+ (append libtool)
(append opencl-headers)
- (append opencl-icd-loader)
(append bash))) ;for completion tests
(inputs (modify-inputs (package-inputs hwloc-1)
(append level-zero)
(append libxml2)
+ (append opencl-icd-loader)
(delete "numactl"))) ;libnuma is no longer needed.
(arguments
(substitute-keyword-arguments (package-arguments hwloc-1)
+ ((#:configure-flags flags '())
+ #~(cons* (string-append "--with-opencl="
+ #$(this-package-input "opencl-icd-loader"))
+ #$flags))
((#:phases phases)
#~(modify-phases #$phases
+ (add-after 'unpack 'delete-configure
+ (lambda _
+ ;; Remove configure file to generate it with patch.
+ (delete-file "configure")))
(replace 'skip-linux-libnuma-test
(lambda _
;; Arrange to skip 'tests/hwloc/linux-libnuma', which fails on
diff --git a/gnu/packages/patches/hwloc-add-with-opencl.patch b/gnu/packages/patches/hwloc-add-with-opencl.patch
new file mode 100644
index 00000000000..03a16d34d0e
--- /dev/null
+++ b/gnu/packages/patches/hwloc-add-with-opencl.patch
@@ -0,0 +1,90 @@
+From f30cc463a948260088b496c3609dd91c83c0ce1b Mon Sep 17 00:00:00 2001
+From: Brice Goglin <Brice.Goglin@inria.fr>
+Date: Mon, 16 Feb 2026 15:00:53 +0100
+Subject: [PATCH] configure: add --with-opencl=<dir>
+
+For non-ROCm non-CUDA installs.
+
+Thanks to Romain Garbage for the suggestion.
+
+Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
+(cherry picked from commit 462eff5a4541dfcb3db15034490c796c4f1d8ec6)
+---
+ config/hwloc.m4 | 18 +++++++++++++++---
+ config/hwloc_internal.m4 | 13 ++++++++++++-
+ 2 files changed, 27 insertions(+), 4 deletions(-)
+
+diff --git a/config/hwloc.m4 b/config/hwloc.m4
+index e0057e8e5..4a26a7ec0 100644
+--- a/config/hwloc.m4
++++ b/config/hwloc.m4
+@@ -1,7 +1,7 @@
+ dnl -*- Autoconf -*-
+ dnl
+ dnl SPDX-License-Identifier: BSD-3-Clause
+-dnl Copyright © 2009-2025 Inria. All rights reserved.
++dnl Copyright © 2009-2026 Inria. All rights reserved.
+ dnl Copyright © 2009-2012, 2015-2017, 2020, 2023, 2025 Université Bordeaux
+ dnl Copyright © 2004-2005 The Trustees of Indiana University and Indiana
+ dnl University Research and Technology
+@@ -1365,6 +1365,18 @@ return rsmi_init(0);
+ echo "**** OpenCL configuration"
+
+ hwloc_opencl_happy=yes
++
++ if test "x$with_opencl" != x -a "x$with_opencl" != xyes; then
++ opencl_dir=$with_opencl
++ AC_MSG_NOTICE([using custom OpenCL install path $opencl_dir ...])
++ else
++ AC_MSG_NOTICE([assuming OpenCL is installed in standard directories ...])
++ fi
++ if test "x$opencl_dir" != x; then
++ HWLOC_OPENCL_CPPFLAGS="-I$opencl_dir/include/"
++ HWLOC_OPENCL_LDFLAGS="-L$opencl_dir/lib/"
++ fi
++
+ case ${target} in
+ *-*-darwin*)
+ # On Darwin, only use the OpenCL framework
+@@ -1387,8 +1399,8 @@ return clGetDeviceIDs(0, 0, 0, NULL, NULL);
+ ;;
+ *)
+ # On Others, look for OpenCL at normal locations
+- HWLOC_OPENCL_CPPFLAGS="$HWLOC_CUDA_COMMON_CPPFLAGS"
+- HWLOC_OPENCL_LDFLAGS="$HWLOC_CUDA_COMMON_LDFLAGS"
++ HWLOC_OPENCL_CPPFLAGS="$HWLOC_OPENCL_CPPFLAGS $HWLOC_CUDA_COMMON_CPPFLAGS"
++ HWLOC_OPENCL_LDFLAGS="$HWLOC_OPENCL_LDFLAGS $HWLOC_CUDA_COMMON_LDFLAGS"
+ if test "x$rocm_dir" != x; then
+ if test -d "$rocm_dir/include/CL"; then
+ HWLOC_OPENCL_CPPFLAGS="$HWLOC_OPENCL_CPPFLAGS -I$rocm_dir/include/"
+diff --git a/config/hwloc_internal.m4 b/config/hwloc_internal.m4
+index da6505e91..1135a245f 100644
+--- a/config/hwloc_internal.m4
++++ b/config/hwloc_internal.m4
+@@ -1,7 +1,7 @@
+ dnl -*- Autoconf -*-
+ dnl
+ dnl SPDX-License-Identifier: BSD-3-Clause
+-dnl Copyright © 2010-2025 Inria. All rights reserved.
++dnl Copyright © 2010-2026 Inria. All rights reserved.
+ dnl Copyright © 2009, 2011 Université Bordeaux
+ dnl Copyright © 2004-2005 The Trustees of Indiana University and Indiana
+ dnl University Research and Technology
+@@ -147,6 +147,17 @@ AC_DEFUN([HWLOC_DEFINE_ARGS],[
+ [AC_MSG_ERROR([--with-amdgpu=<dir> missing the installation directory])])]
+ )
+
++ # OpenCL
++ AC_ARG_ENABLE([opencl],
++ AS_HELP_STRING([--disable-opencl],
++ [Disable the OpenCL device discovery]))
++ AC_ARG_WITH([opencl],
++ AS_HELP_STRING([--with-opencl=<dir>],
++ [Specify the OpenCL installation directory]),
++ [AS_IF([test "x$withval" = xyes -o "x$withval" = x],
++ [AC_MSG_ERROR([--with-opencl=<dir> missing the installation directory])])]
++ )
++
+ # LevelZero
+ AC_ARG_ENABLE([levelzero],
+ AS_HELP_STRING([--disable-levelzero],