From 7fae1a695098526458eccc694d085cbd258252f0 Mon Sep 17 00:00:00 2001 From: Cayetano Santos Date: Fri, 8 Aug 2025 21:47:37 +0200 Subject: [PATCH] gnu: Add python-onetbb. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/oneapi.scm (python-onetbb): New variable. Change-Id: If03bd2a7934478908fc00b6c76ab5fb871647af6 Signed-off-by: Ludovic Courtès --- gnu/packages/oneapi.scm | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/gnu/packages/oneapi.scm b/gnu/packages/oneapi.scm index e525999dc03f1ac2daf47084b2ffbb5a5ebddfb4..a90eaf06324f980e9905e20b3e800e87c64bc0b7 100644 --- a/gnu/packages/oneapi.scm +++ b/gnu/packages/oneapi.scm @@ -18,6 +18,8 @@ (define-module (gnu packages oneapi) #:use-module (gnu packages) + #:use-module (gnu packages python) + #:use-module (gnu packages swig) #:use-module (guix build-system cmake) #:use-module (guix gexp) #:use-module (guix git-download) @@ -89,3 +91,46 @@ eliminate tedious threading implementation work. It provides parallel loop constructs, asynchronous tasks, synchronization primitives, atomic operations, and more.") (license license:asl2.0))) + +(define-public python-onetbb + (package + (inherit onetbb) + (name "python-onetbb") + (arguments + (list + #:configure-flags + #~(list "-DTBB4PY_BUILD=ON") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-python-install-directory + (lambda _ + (substitute* "python/setup.py" + (("extra_link_args=tbb_flag,") + (string-append + "extra_link_args=['-Wl,-rpath=" + #$(this-package-input "onetbb") "/lib" + "', '-Wl,-rpath=" #$output "/lib'] + tbb_flag,"))))) + (replace 'build + (lambda _ + (setenv "PYTHONHASHSEED" "0") + (invoke "make" "python_build"))) + ;; The 'build phase already installs the modules + (replace 'install + (lambda _ + (with-directory-excursion "python/rml" + (invoke "make" "install")))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "ctest" "-R" "python_test" "--output-on-failure"))))))) + (native-inputs (list swig python-minimal)) + (inputs (list onetbb)) + (synopsis "Python bindings for the oneTBB parallel library") + (description + "@acronym{OneTBB, OneAPI Threading Building Blocks} is a C++ runtime +library that abstracts the low-level threading details necessary for optimal +multi-core performance. It uses common C++ templates and coding style to +eliminate tedious threading implementation work. It provides parallel loop +constructs, asynchronous tasks, synchronization primitives, atomic operations, +and more. @code{python-onetbb} enables threading composability between two or +more thread-enabled Python libraries.")))