~ruther/guix-local

8894ed2c30fc0f557e5e63b8adc91e5d218343ad — Cayetano Santos 6 months ago e2ead32
gnu: Add onetbb.

* gnu/packages/oneapi.scm (onetbb): New variable.
* gnu/packages/patches/onetbb-other-arches.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register them.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add new module.

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

M gnu/local.mk
A gnu/packages/oneapi.scm
A gnu/packages/patches/onetbb-other-arches.patch
M gnu/local.mk => gnu/local.mk +3 -0
@@ 72,6 72,7 @@
# Copyright © 2024 Ashvith Shetty <ashvithshetty10@gmail.com>
# Copyright © 2024 James Smith <jsubuntuxp@disroot.org>
# Copyright © 2025 Nigko Yerden <nigko.yerden@gmail.com>
# Copyright © 2025 Cayetano Santos <csantosb@inventati.org>
#
# This file is part of GNU Guix.
#


@@ 682,6 683,7 @@ GNU_SYSTEM_MODULES =				\
  %D%/packages/upnp.scm				\
  %D%/packages/usb-modeswitch.scm		\
  %D%/packages/uucp.scm				\
  %D%/packages/oneapi.scm			\
  %D%/packages/valgrind.scm			\
  %D%/packages/version-control.scm		\
  %D%/packages/video.scm			\


@@ 1947,6 1949,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/ocaml-4.09-multiple-definitions.patch	\
  %D%/packages/patches/omake-fix-non-determinism.patch	\
  %D%/packages/patches/oneko-remove-nonfree-characters.patch	\
  %D%/packages/patches/onetbb-other-arches.patch	\
  %D%/packages/patches/online-judge-tools.patch		\
  %D%/packages/patches/onnx-optimizer-system-library.patch	\
  %D%/packages/patches/onnx-1.13.1-use-system-googletest.patch	\

A gnu/packages/oneapi.scm => gnu/packages/oneapi.scm +91 -0
@@ 0,0 1,91 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2025 Cayetano Santos <csantosb@inventati.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages oneapi)
  #:use-module (gnu packages)
  #:use-module (guix build-system cmake)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils))

;;; Updates and replaces tbb in (gnu packages tbb)
(define-public onetbb
  (package
    (name "onetbb")
    (version "2022.2.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://github.com/uxlfoundation/oneTBB/")
              (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "04hjgc0yg0kdwr5qssl4y7hqv4wgcrlmblvbiaxqlyxrd400y901"))
       (patches (search-patches "onetbb-other-arches.patch"))))
    (build-system cmake-build-system)
    (arguments
     (list
      #:configure-flags
      #~(list #$@(if (or (target-riscv64?)
                         (target-ppc32?))
                     '(list "-DTBB_TEST_LINK_FLAGS=-latomic")
                     '())
              #$@(if (or (target-arm32?)
                         (target-ppc32?))
                     '("-DTBB_TEST_COMPILE_FLAGS=-DTBB_TEST_LOW_WORKLOAD")
                     '())
              ;; Don't fail on warnings.
              "-DTBB_STRICT=OFF")
      #:phases
      #~(modify-phases %standard-phases
          #$@(cond
              ((target-arm32?)
               `((add-after 'unpack 'adjust-test-suite
                   (lambda _
                     (substitute* "test/CMakeLists.txt"
                       ;; Bus error, skipped on mips.
                       ((".*test_malloc_pools.*") ""))))))
              ((target-ppc32?)
               `((add-after 'unpack 'adjust-test-suite
                   (lambda _
                     (substitute* "test/CMakeLists.txt"
                       ;; These tests hang forever.
                       ((".*test_function_node.*") "")
                       ((".*test_multifunction_node.*") "")
                       ((".*test_async_node.*") ""))))))
              ((target-riscv64?)
               `((add-after 'unpack 'adjust-test-suite
                   (lambda _
                     (substitute* "test/CMakeLists.txt"
                       ;; This tests hangs forever.
                       ((".*test_task_group.*") ""))))))
              (else '())))))
    (home-page "https://uxlfoundation.github.io/oneTBB/")
    (synopsis "C++ library for parallel programming")
    (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.")
    (license license:asl2.0)))

A gnu/packages/patches/onetbb-other-arches.patch => gnu/packages/patches/onetbb-other-arches.patch +27 -0
@@ 0,0 1,27 @@
Declare a fallback architecture not yet considered by upstream project.

diff --git a/src/tbb/tools_api/ittnotify_config.h b/src/tbb/tools_api/ittnotify_config.h
index 001d42e0..2e68f738 100644
--- a/src/tbb/tools_api/ittnotify_config.h
+++ b/src/tbb/tools_api/ittnotify_config.h
@@ -180,6 +180,11 @@
 #  define ITT_ARCH_ARM64  6
 #endif /* ITT_ARCH_ARM64 */
 
+/* Fallback for other architectures */
+#ifndef ITT_ARCH_GENERIC
+#  define ITT_ARCH_GENERIC 99
+#endif /* ITT_ARCH_GENERIC */
+
 #ifndef ITT_ARCH_LOONGARCH64
 #  define ITT_ARCH_LOONGARCH64  7
 #endif /* ITT_ARCH_LOONGARCH64 */
@@ -209,6 +214,8 @@
 #    define ITT_ARCH ITT_ARCH_ARM64
 #  elif defined __powerpc64__
 #    define ITT_ARCH ITT_ARCH_PPC64
+#  elif
+#    define ITT_ARCH ITT_ARCH_GENERIC
 #  elif defined __loongarch__
 #    define ITT_ARCH ITT_ARCH_LOONGARCH64
 #  elif defined __s390__ || defined __s390x__