~ruther/guix-local

7fae1a695098526458eccc694d085cbd258252f0 — Cayetano Santos 6 months ago 8894ed2
gnu: Add python-onetbb.

* gnu/packages/oneapi.scm (python-onetbb): New variable.

Change-Id: If03bd2a7934478908fc00b6c76ab5fb871647af6
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
1 files changed, 45 insertions(+), 0 deletions(-)

M gnu/packages/oneapi.scm
M gnu/packages/oneapi.scm => gnu/packages/oneapi.scm +45 -0
@@ 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.")))