Sync from SUSE:SLFO:Main tbb revision 90066a688a8833fa99fda8702229d016

This commit is contained in:
Adrian Schröter 2024-09-30 10:46:32 +02:00
parent 7f98e13466
commit b793d253f9
9 changed files with 150 additions and 201 deletions

View File

@ -1,78 +0,0 @@
From d9049c052c99162e26f86cf2a4982d026bf7dc57 Mon Sep 17 00:00:00 2001
From: Mo Zhou <cdluminate@gmail.com>
Date: Fri, 20 May 2022 09:02:53 -0400
Subject: [PATCH 1/2] Fix build failure for s390x and hppa architectures.
Signed-off-by: Mo Zhou <cdluminate@gmail.com>
---
src/tbb/tools_api/ittnotify_config.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/tbb/tools_api/ittnotify_config.h b/src/tbb/tools_api/ittnotify_config.h
index 5e7c0cdf5..411de0852 100644
--- a/src/tbb/tools_api/ittnotify_config.h
+++ b/src/tbb/tools_api/ittnotify_config.h
@@ -167,6 +167,14 @@
# define ITT_ARCH_LOONGARCH64 7
#endif /* ITT_ARCH_LOONGARCH64 */
+#ifndef ITT_ARCH_S390X
+# define ITT_ARCH_S390X 8
+#endif /* ITT_ARCH_S390X */
+
+#ifndef ITT_ARCH_HPPA
+# define ITT_ARCH_HPPA 9
+#endif /* ITT_ARCH_HPPA */
+
#ifndef ITT_ARCH
# if defined _M_IX86 || defined __i386__
# define ITT_ARCH ITT_ARCH_IA32
@@ -182,6 +190,10 @@
# define ITT_ARCH ITT_ARCH_PPC64
# elif defined __loongarch__
# define ITT_ARCH ITT_ARCH_LOONGARCH64
+# elif defined __s390__ || defined __s390x__
+# define ITT_ARCH ITT_ARCH_S390X
+# elif defined __hppa__
+# define ITT_ARCH ITT_ARCH_HPPA
# endif
#endif
From b0e9f8636e49c337836392d811fda403dc7102a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dirk=20M=C3=BCller?= <dirk@dmllr.de>
Date: Sat, 24 Sep 2022 14:27:24 +0200
Subject: [PATCH 2/2] Add riscv64 architecture detection
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Dirk Müller <dirk@dmllr.de>
---
src/tbb/tools_api/ittnotify_config.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/tbb/tools_api/ittnotify_config.h b/src/tbb/tools_api/ittnotify_config.h
index 411de0852..11422fd57 100644
--- a/src/tbb/tools_api/ittnotify_config.h
+++ b/src/tbb/tools_api/ittnotify_config.h
@@ -175,6 +175,10 @@
# define ITT_ARCH_HPPA 9
#endif /* ITT_ARCH_HPPA */
+#ifndef ITT_ARCH_RISCV64
+# define ITT_ARCH_RISCV64 10
+#endif /* ITT_ARCH_RISCV64 */
+
#ifndef ITT_ARCH
# if defined _M_IX86 || defined __i386__
# define ITT_ARCH ITT_ARCH_IA32
@@ -194,6 +198,8 @@
# define ITT_ARCH ITT_ARCH_S390X
# elif defined __hppa__
# define ITT_ARCH ITT_ARCH_HPPA
+# elif defined __riscv && __riscv_xlen == 64
+# define ITT_ARCH ITT_ARCH_RISCV64
# endif
#endif

View File

@ -9,13 +9,13 @@ Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
cmake/compilers/GNU.cmake | 16 ++++++++++++++++ cmake/compilers/GNU.cmake | 16 ++++++++++++++++
1 file changed, 16 insertions(+) 1 file changed, 16 insertions(+)
diff --git a/cmake/compilers/GNU.cmake b/cmake/compilers/GNU.cmake Index: oneTBB-2021.11.0/cmake/compilers/GNU.cmake
index cd76acfe..59f4e693 100644 ===================================================================
--- a/cmake/compilers/GNU.cmake --- oneTBB-2021.11.0.orig/cmake/compilers/GNU.cmake
+++ b/cmake/compilers/GNU.cmake +++ oneTBB-2021.11.0/cmake/compilers/GNU.cmake
@@ -44,6 +44,22 @@ if (NOT MINGW) @@ -42,6 +42,22 @@ endif()
set(TBB_COMMON_LINK_LIBS dl)
endif() set(TBB_COMMON_LINK_LIBS ${CMAKE_DL_LIBS})
+# Check whether code with full atomics can be built without libatomic +# Check whether code with full atomics can be built without libatomic
+# see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358 +# see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358
@ -36,6 +36,3 @@ index cd76acfe..59f4e693 100644
# Ignore -Werror set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled. # Ignore -Werror set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled.
if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag) if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
tbb_remove_compile_flag(-Werror) tbb_remove_compile_flag(-Werror)
--
2.30.2

View File

@ -1,8 +1,8 @@
Index: oneTBB-2021.3.0/cmake/templates/TBBConfig.cmake.in Index: oneTBB-2021.11.0/cmake/templates/TBBConfig.cmake.in
=================================================================== ===================================================================
--- oneTBB-2021.3.0.orig/cmake/templates/TBBConfig.cmake.in --- oneTBB-2021.11.0.orig/cmake/templates/TBBConfig.cmake.in
+++ oneTBB-2021.3.0/cmake/templates/TBBConfig.cmake.in +++ oneTBB-2021.11.0/cmake/templates/TBBConfig.cmake.in
@@ -58,8 +58,6 @@ foreach (_tbb_component ${TBB_FIND_COMPO @@ -80,8 +80,6 @@ foreach (_tbb_component ${TBB_FIND_COMPO
add_library(TBB::${_tbb_component} SHARED IMPORTED) add_library(TBB::${_tbb_component} SHARED IMPORTED)
get_filename_component(_tbb_include_dir "${_tbb_root}/@TBB_INC_REL_PATH@" ABSOLUTE) get_filename_component(_tbb_include_dir "${_tbb_root}/@TBB_INC_REL_PATH@" ABSOLUTE)

View File

@ -1,63 +0,0 @@
From f12c93efd04991bc982a27e2fa6142538c33ca82 Mon Sep 17 00:00:00 2001
From: Rui Ueyama <ruiu@cs.stanford.edu>
Date: Sat, 7 May 2022 19:55:24 +0800
Subject: [PATCH] Retry if pthread_create fails with EAGAIN
On many Unix-like systems, pthread_create can fail spuriously even if
the running machine has enough resources to spawn a new thread.
Therefore, if EAGAIN is returned from pthread_create, we actually have
to try again.
I observed this issue when running the mold linker
(https://github.com/rui314/mold) under a heavy load. mold uses OneTBB
for parallelization.
As another data point, Go has the same logic to retry on EAGAIN:
https://go-review.googlesource.com/c/go/+/33894/
nanosleep is defined in POSIX 2001, so I believe that all Unix-like
systems support it.
Signed-off-by: Rui Ueyama <ruiu@cs.stanford.edu>
---
src/tbb/rml_thread_monitor.h | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/tbb/rml_thread_monitor.h b/src/tbb/rml_thread_monitor.h
index 13b556380..5b844b232 100644
--- a/src/tbb/rml_thread_monitor.h
+++ b/src/tbb/rml_thread_monitor.h
@@ -31,6 +31,7 @@
#include <pthread.h>
#include <cstring>
#include <cstdlib>
+#include <time.h>
#else
#error Unsupported platform
#endif
@@ -191,8 +192,24 @@ inline thread_monitor::handle_type thread_monitor::launch( void* (*thread_routin
check(pthread_attr_init( &s ), "pthread_attr_init has failed");
if( stack_size>0 )
check(pthread_attr_setstacksize( &s, stack_size ), "pthread_attr_setstack_size has failed" );
+
pthread_t handle;
- check( pthread_create( &handle, &s, thread_routine, arg ), "pthread_create has failed" );
+ int tries = 0;
+ for (;;) {
+ int error_code = pthread_create(&handle, &s, thread_routine, arg);
+ if (!error_code)
+ break;
+ if (error_code != EAGAIN || tries++ > 20) {
+ handle_perror(error_code, "pthread_create has failed");
+ break;
+ }
+
+ // pthreaed_create can spuriously fail on many Unix-like systems.
+ // Retry after tries * 1 millisecond.
+ struct timespec ts = {0, tries * 1000 * 1000};
+ nanosleep(&ts, NULL);
+ }
+
check( pthread_attr_destroy( &s ), "pthread_attr_destroy has failed" );
return handle;
}

BIN
tbb-2021.12.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
tbb-2021.8.0.tar.gz (Stored with Git LFS)

Binary file not shown.

View File

@ -1,3 +1,63 @@
-------------------------------------------------------------------
Fri Apr 19 03:16:09 UTC 2024 - Alessandro de Oliveira Faria <cabelo@opensuse.org>
- Update to version 2021.11.0:
* Fixed parallel_for_each algorithm behavior for iterators defining
iterator_concept trait instead of iterator_category.
* Fixed the incorrect binary search order in TBBConfig.cmake.
-------------------------------------------------------------------
Thu Jan 25 16:31:59 UTC 2024 - Ana Guerrero <ana.guerrero@suse.com>
- Fix build to handle changes in (open)SUSE specific cmake macros,
no user visible changes
-------------------------------------------------------------------
Fri Dec 1 08:24:32 UTC 2023 - Atri Bhattacharya <badshah400@gmail.com>
- Update to version 2021.11.0:
* Fixed tbb::this_task_arena() behavior for specific
tbb::task_arena{1,0}.
* Restored performance on the high-core count systems that
support _tpause.
- Refresh patches to apply cleanly:
* use-FORTIFY_SOURCE-from-distribution.patch
* add-cmake-check-for-libatomic-requirement-when-build.patch
- Update Summary and description tags to be consistent with
upstream's TBB -> oneTBB renaming.
-------------------------------------------------------------------
Thu Nov 23 09:53:18 UTC 2023 - Bernhard Wiedemann <bwiedemann@suse.com>
- Avoid stuck build/tests
-------------------------------------------------------------------
Tue Aug 1 19:25:15 UTC 2023 - Martin Liška <martin.liska@hey.com>
* Add use-FORTIFY_SOURCE-from-distribution.patch and use FS settings from distribution
(we use either =2 or =3).
-------------------------------------------------------------------
Tue Aug 1 01:27:35 UTC 2023 - Alessandro de Oliveira Faria <cabelo@opensuse.org>
- Update to 2021.10.0:
* Since C++17, parallel algorithms and Flow Graph nodes are allowed to accept
pointers to the member functions and member objects as the user-provided
callables.
* Added missed member functions, such as assignment operators and swap function,
to the concurrent_queue and concurrent_bounded_queue containers.
-------------------------------------------------------------------
Thu Jun 15 08:34:01 UTC 2023 - Paolo Stivanin <info@paolostivanin.com>
- Update to 2021.9.0:
* Hybrid CPU support is now a fully supported feature.
* Fixed the issue reported by the Address Sanitizer.
* Fixed the input_type alias exposed by flow_graph::join_node.
- Drop 917.patch (patch was upstreamed).
- Drop retry-pthread_create.patch (upstream fixed it by using a similar
approach).
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jan 4 20:08:08 UTC 2023 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com> Wed Jan 4 20:08:08 UTC 2023 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>

108
tbb.spec
View File

@ -1,7 +1,8 @@
# #
# spec file for package tbb # spec file for package tbb
# #
# Copyright (c) 2022 SUSE LLC # Copyright (c) 2024 SUSE LLC
# Copyright (c) 2023 Alessandro de Oliveira Faria (A.K.A. CABELO)
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -40,19 +41,18 @@
%bcond_with python3 %bcond_with python3
%endif %endif
Name: tbb Name: tbb
Version: 2021.8.0 Version: 2021.12.0
Release: 0 Release: 0
Summary: Threading Building Blocks (TBB) Summary: oneAPI Threading Building Blocks (oneTBB)
License: Apache-2.0 License: Apache-2.0
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
URL: https://www.threadingbuildingblocks.org/ URL: https://oneapi-src.github.io/oneTBB/
Source0: https://github.com/oneapi-src/oneTBB/archive/v%{version}.tar.gz#/tbb-%{version}.tar.gz Source0: https://github.com/oneapi-src/oneTBB/archive/v%{version}.tar.gz#/tbb-%{version}.tar.gz
Source99: tbb-rpmlintrc Source99: tbb-rpmlintrc
Patch1: https://github.com/oneapi-src/oneTBB/pull/917.patch
# PATCH-FIX-OPENSUSE cmake-remove-include-path.patch -- openCV include error # PATCH-FIX-OPENSUSE cmake-remove-include-path.patch -- openCV include error
Patch2: cmake-remove-include-path.patch Patch2: cmake-remove-include-path.patch
Patch3: retry-pthread_create.patch
Patch4: add-cmake-check-for-libatomic-requirement-when-build.patch Patch4: add-cmake-check-for-libatomic-requirement-when-build.patch
Patch5: use-FORTIFY_SOURCE-from-distribution.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: gcc-c++ BuildRequires: gcc-c++
@ -75,12 +75,11 @@ BuildRequires: swig >= 3.0.6
%endif %endif
%description %description
Threading Building Blocks (TBB) offers a rich and complete approach to oneTBB (previously known as TBB) is a flexible C++ library that simplifies the
expressing parallelism in a C++ program. It is a library that helps you take work of adding parallelism to complex applications. The library lets you easily
advantage of multi-core processor performance without having to be a threading write parallel programs that take full advantage of the multi-core performance.
expert. Threading Building Blocks is not just a threads-replacement library. It oneTBB provides you with functions, interfaces, and classes to parallelize and
represents a higher-level, task-based parallelism that abstracts platform scale the code.
details and threading mechanism for performance and scalability.
%package -n libtbb%{so_ver} %package -n libtbb%{so_ver}
Summary: Threading Building Blocks (TBB) Summary: Threading Building Blocks (TBB)
@ -89,12 +88,13 @@ Provides: %{name} = %{version}
Obsoletes: %{name} < %{version} Obsoletes: %{name} < %{version}
%description -n libtbb%{so_ver} %description -n libtbb%{so_ver}
Threading Building Blocks (TBB) offers a rich and complete approach to oneTBB (previously known as TBB) is a flexible C++ library that simplifies the
expressing parallelism in a C++ program. It is a library that helps you take work of adding parallelism to complex applications. The library lets you easily
advantage of multi-core processor performance without having to be a threading write parallel programs that take full advantage of the multi-core performance.
expert. Threading Building Blocks is not just a threads-replacement library. It oneTBB provides you with functions, interfaces, and classes to parallelize and
represents a higher-level, task-based parallelism that abstracts platform scale the code.
details and threading mechanism for performance and scalability.
This package provides the core shared library corresponding to oneTBB.
%package -n libtbbmalloc%{so_ver_malloc} %package -n libtbbmalloc%{so_ver_malloc}
Summary: Threading Building Blocks (TBB) Summary: Threading Building Blocks (TBB)
@ -103,53 +103,76 @@ Provides: %{name} = %{version}
Obsoletes: %{name} < %{version} Obsoletes: %{name} < %{version}
%description -n libtbbmalloc%{so_ver_malloc} %description -n libtbbmalloc%{so_ver_malloc}
This subpackage contains the two TBB memory allocator templates that oneTBB (previously known as TBB) is a flexible C++ library that simplifies the
are similar to the STL template class std::allocator. These two work of adding parallelism to complex applications. The library lets you easily
templates, scalable_allocator<T> and cache_aligned_allocator<T>, write parallel programs that take full advantage of the multi-core performance.
address critical issues in parallel programming: scalability and oneTBB provides you with functions, interfaces, and classes to parallelize and
false sharing. scale the code.
This package provides the oneTBB memory allocator shared library.
%package -n libirml%{so_ver_irml} %package -n libirml%{so_ver_irml}
Summary: Threading Building Blocks (TBB) - IPC Library Summary: Threading Building Blocks (TBB) - IPC Library
Group: System/Libraries Group: System/Libraries
%description -n libirml%{so_ver_irml} %description -n libirml%{so_ver_irml}
oneTBB (previously known as TBB) is a flexible C++ library that simplifies the
work of adding parallelism to complex applications. The library lets you easily
write parallel programs that take full advantage of the multi-core performance.
oneTBB provides you with functions, interfaces, and classes to parallelize and
scale the code.
This subpackage provides the library required in order to enable inter-process This subpackage provides the library required in order to enable inter-process
(IPC) coordination between oneTBB schedulers for the TBB python module. (IPC) coordination between oneTBB schedulers for the oneTBB python module.
%package -n libtbbbind%{tbbbind_suffix}-%{so_ver_bind} %package -n libtbbbind%{tbbbind_suffix}-%{so_ver_bind}
Summary: Threading Building Blocks (TBB) NUMA support library Summary: NUMA support library for oneAPI Threading Building Blocks (oneTBB)
Group: System/Libraries Group: System/Libraries
%description -n libtbbbind%{tbbbind_suffix}-%{so_ver_bind} %description -n libtbbbind%{tbbbind_suffix}-%{so_ver_bind}
The NUMA support library for Threading Building Blocks (TBB) oneTBB (previously known as TBB) is a flexible C++ library that simplifies the
work of adding parallelism to complex applications. The library lets you easily
write parallel programs that take full advantage of the multi-core performance.
oneTBB provides you with functions, interfaces, and classes to parallelize and
scale the code.
The NUMA support library for oneTBB.
%if 0%{?python_subpackage_only} %if 0%{?python_subpackage_only}
%package -n python-%{name} %package -n python-%{name}
Summary: Python %{python_version} support for Threading Building Blocks (TBB) Summary: Python %{python_version} support for oneAPI Threading Building Blocks (oneTBB)
Group: Development/Languages/Python Group: Development/Languages/Python
Requires: libirml%{so_ver_irml} Requires: libirml%{so_ver_irml}
%description -n python-%{name} %description -n python-%{name}
This package contains python %{python_version} bindings for Threading Building Blocks oneTBB (previously known as TBB) is a flexible C++ library that simplifies the
(TBB). work of adding parallelism to complex applications. The library lets you easily
write parallel programs that take full advantage of the multi-core performance.
oneTBB provides you with functions, interfaces, and classes to parallelize and
scale the code.
This package contains python %{python_version} bindings for oneTBB.
%else %else
%package -n python3-%{name} %package -n python3-%{name}
Summary: Python 3 support for Threading Building Blocks (TBB) Summary: Python 3 support for oneAPI Threading Building Blocks (oneTBB)
Group: Development/Languages/Python Group: Development/Languages/Python
Requires: libirml%{so_ver_irml} Requires: libirml%{so_ver_irml}
%description -n python3-%{name} %description -n python3-%{name}
This package contains python 3 bindings for Threading Building Blocks oneTBB (previously known as TBB) is a flexible C++ library that simplifies the
(TBB). work of adding parallelism to complex applications. The library lets you easily
write parallel programs that take full advantage of the multi-core performance.
oneTBB provides you with functions, interfaces, and classes to parallelize and
scale the code.
This package contains python 3 bindings for oneAPI Threading Building Blocks
(oneTBB).
%endif %endif
%package devel %package devel
Summary: Development Files for Threading Building Blocks (TBB) Summary: Development Files for oneAPI Threading Building Blocks (oneTBB)
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Requires: c++_compiler Requires: c++_compiler
Requires: libirml%{so_ver_irml} = %{version} Requires: libirml%{so_ver_irml} = %{version}
@ -158,14 +181,13 @@ Requires: libtbbbind%{tbbbind_suffix}-%{so_ver_bind} = %{version}
Requires: libtbbmalloc%{so_ver_malloc} = %{version} Requires: libtbbmalloc%{so_ver_malloc} = %{version}
%description devel %description devel
Threading Building Blocks (TBB) offers a rich and complete approach to oneTBB (previously known as TBB) is a flexible C++ library that simplifies the
expressing parallelism in a C++ program. It is a library that helps you take work of adding parallelism to complex applications. The library lets you easily
advantage of multi-core processor performance without having to be a threading write parallel programs that take full advantage of the multi-core performance.
expert. Threading Building Blocks is not just a threads-replacement library. It oneTBB provides you with functions, interfaces, and classes to parallelize and
represents a higher-level, task-based parallelism that abstracts platform scale the code.
details and threading mechanism for performance and scalability.
This package contains the header files needed for development with tbb. This package contains the header files needed for development with oneTBB.
%prep %prep
%setup -q -n oneTBB-%{version} %setup -q -n oneTBB-%{version}
@ -222,7 +244,7 @@ popd
%endif %endif
# we install it into the devel package docdir # we install it into the devel package docdir
rm -r %{buildroot}%{_datadir}/doc/TBB rm -rf %{buildroot}%{_datadir}/doc/
# Rename tbb32.pc to tbb.pc (same as 64-bit) so that applications depending on tbb # Rename tbb32.pc to tbb.pc (same as 64-bit) so that applications depending on tbb
# do not have to call different pkgconfig modules based on arch # do not have to call different pkgconfig modules based on arch
@ -238,7 +260,7 @@ test -f %{buildroot}%{_libdir}/pkgconfig/tbb32.pc && mv %{buildroot}%{_libdir}/p
mkdir python-test mkdir python-test
pushd python-test pushd python-test
export LD_LIBRARY_PATH="%{buildroot}%{_libdir}" export LD_LIBRARY_PATH="%{buildroot}%{_libdir}"
%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python -m tbb test -v %python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} timeout 5m $python -m tbb test -v
popd popd
%endif %endif

View File

@ -0,0 +1,11 @@
diff -uNr oneTBB-2021.12.0.orig/cmake/compilers/GNU.cmake oneTBB-2021.12.0/cmake/compilers/GNU.cmake
--- oneTBB-2021.12.0.orig/cmake/compilers/GNU.cmake 2024-02-13 08:49:20.000000000 -0300
+++ oneTBB-2021.12.0/cmake/compilers/GNU.cmake 2024-04-19 03:55:56.178055557 -0300
@@ -75,7 +75,6 @@
if (NOT APPLE AND NOT MINGW)
set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} -Wl,-z,relro,-z,now,-z,noexecstack)
endif()
-set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} $<$<NOT:$<CONFIG:Debug>>:-D_FORTIFY_SOURCE=2> )
# TBB malloc settings