diff --git a/bugfix-tbb-fix-__TBB_machine_fetchadd4-was-not-declared-on-.patch b/bugfix-tbb-fix-__TBB_machine_fetchadd4-was-not-declared-on-.patch index 02f1f23..8f27ce0 100644 --- a/bugfix-tbb-fix-__TBB_machine_fetchadd4-was-not-declared-on-.patch +++ b/bugfix-tbb-fix-__TBB_machine_fetchadd4-was-not-declared-on-.patch @@ -18,18 +18,18 @@ Signed-off-by: lvying6 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tbb/tools_api/ittnotify_config.h b/src/tbb/tools_api/ittnotify_config.h -index bdb4ec2..041ceb3 100644 +index 44edfd6..9e88501 100644 --- a/src/tbb/tools_api/ittnotify_config.h +++ b/src/tbb/tools_api/ittnotify_config.h -@@ -335,7 +335,7 @@ ITT_INLINE long +@@ -386,7 +386,7 @@ ITT_INLINE long __itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE; ITT_INLINE long __itt_interlocked_increment(volatile long* ptr) { - return __TBB_machine_fetchadd4(ptr, 1) + 1L; + return __atomic_fetch_add(ptr, 1L, __ATOMIC_SEQ_CST) + 1L; } - #endif /* ITT_SIMPLE_INIT */ - + ITT_INLINE long + __itt_interlocked_compare_exchange(volatile long* ptr, long exchange, long comperand) ITT_INLINE_ATTRIBUTE; -- -1.8.3.1 +2.33.0 diff --git a/tbb-2020.3.tar.gz b/tbb-2020.3.tar.gz deleted file mode 100644 index dcc893f..0000000 Binary files a/tbb-2020.3.tar.gz and /dev/null differ diff --git a/tbb-2021-Werror.patch b/tbb-2021-Werror.patch new file mode 100644 index 0000000..e820358 --- /dev/null +++ b/tbb-2021-Werror.patch @@ -0,0 +1,30 @@ +diff -up oneTBB-2021.11.0/cmake/compilers/Clang.cmake.orig oneTBB-2021.11.0/cmake/compilers/Clang.cmake +--- oneTBB-2021.11.0/cmake/compilers/Clang.cmake.orig 2023-11-17 09:23:05.000000000 -0700 ++++ oneTBB-2021.11.0/cmake/compilers/Clang.cmake 2023-12-28 20:35:24.422191660 -0700 +@@ -46,11 +46,6 @@ endif() + set(TBB_WARNING_LEVEL -Wall -Wextra $<$:-Werror>) + set(TBB_TEST_WARNING_FLAGS -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor) + +-# 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) +- tbb_remove_compile_flag(-Werror) +-endif() +- + # Enable Intel(R) Transactional Synchronization Extensions (-mrtm) and WAITPKG instructions support (-mwaitpkg) on relevant processors + if (CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|amd64|i.86|x86)") + set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm $<$>:-mwaitpkg>) +diff -up oneTBB-2021.11.0/cmake/compilers/GNU.cmake.orig oneTBB-2021.11.0/cmake/compilers/GNU.cmake +--- oneTBB-2021.11.0/cmake/compilers/GNU.cmake.orig 2023-11-17 09:23:05.000000000 -0700 ++++ oneTBB-2021.11.0/cmake/compilers/GNU.cmake 2023-12-28 20:37:54.828060692 -0700 +@@ -42,11 +42,6 @@ endif() + + set(TBB_COMMON_LINK_LIBS ${CMAKE_DL_LIBS}) + +-# 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) +- tbb_remove_compile_flag(-Werror) +-endif() +- + if (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL Intel) + # gcc 6.0 and later have -flifetime-dse option that controls elimination of stores done outside the object lifetime + set(TBB_DSE_FLAG $<$>:-flifetime-dse=1>) diff --git a/tbb-2021-strict-aliasing.patch b/tbb-2021-strict-aliasing.patch new file mode 100644 index 0000000..8d81ba3 --- /dev/null +++ b/tbb-2021-strict-aliasing.patch @@ -0,0 +1,12 @@ +diff -up oneTBB-2021.7.0/src/tbbmalloc/frontend.cpp.orig oneTBB-2021.7.0/src/tbbmalloc/frontend.cpp +--- oneTBB-2021.6.0/src/tbbmalloc/frontend.cpp.orig 2022-10-07 08:34:12.000000000 -0600 ++++ oneTBB-2021.6.0/src/tbbmalloc/frontend.cpp 2022-11-03 13:28:39.050045201 -0600 +@@ -1516,7 +1516,7 @@ bool Block::readyToShare() + { + MallocMutex::scoped_lock scoped_cs(publicFreeListLock); + if ( (oldVal=publicFreeList)==nullptr ) +- (intptr_t&)(publicFreeList) = UNUSABLE; ++ publicFreeList = reinterpret_cast(UNUSABLE); + } + #endif + return oldVal==nullptr; diff --git a/tbb-2021.11.0.tar.gz b/tbb-2021.11.0.tar.gz new file mode 100644 index 0000000..0742b41 Binary files /dev/null and b/tbb-2021.11.0.tar.gz differ diff --git a/tbb.pc b/tbb.pc deleted file mode 100644 index 10dc8df..0000000 --- a/tbb.pc +++ /dev/null @@ -1,5 +0,0 @@ -Name: Threading Building Blocks -Description: The Threading Building Blocks library abstracts low-level threading details -URL: http://www.threadingbuildingblocks.org/ -Version: _openEuler_VERSION -Libs: -ltbb diff --git a/tbb.spec b/tbb.spec index c5bc22e..e69fd3c 100644 --- a/tbb.spec +++ b/tbb.spec @@ -1,17 +1,20 @@ Name: tbb -Version: 2020.3 -Release: 5 +Version: 2021.11.0 +Release: 1 Summary: Threading Building Blocks lets you easily write parallel C++ programs License: ASL 2.0 URL: http://threadingbuildingblocks.org/ -Source0: https://github.com/intel/tbb/archive/v%{version}/%{name}-%{version}.tar.gz -Source6: tbb.pc +Source0: https://github.com/oneapi-src/oneTBB/archive/v%{version}/%{name}-%{version}.tar.gz Source7: tbbmalloc.pc Source8: tbbmalloc_proxy.pc +Patch0: tbb-2021-Werror.patch +Patch1: tbb-2021-strict-aliasing.patch + Patch9000: bugfix-tbb-fix-__TBB_machine_fetchadd4-was-not-declared-on-.patch -BuildRequires: gcc-c++ doxygen swig python3-devel +BuildRequires: gcc-c++ swig python3-devel hwloc hwloc-devel cmake python3-pip +BuildRequires: python3-setuptools python3-sphinx python3-sphinx_rtd_theme python3-wheel %description Threading Building Blocks (TBB) lets you easily write parallel C++ programs that @@ -20,15 +23,23 @@ have future-proof scalability. %package devel Summary: C++ headers and shared development libraries of TBB -Requires: tbb%{?_isa} = %{version}-%{release} +Requires: tbb = %{version}-%{release} +Requires: tbb-bind = %{version}-%{release} %description devel The Threading Building Blocks (TBB) C++ libraries including Header files and shared object symlinks. +%package bind +Summary: NUMA support library for TBB +Requires: %{name} = %{version}-%{release} + +%description bind +NUMA support library for TBB, allowing the binding of tasks to selected +CPU cores. + %package help Summary: Documents for tbb -Buildarch: noarch Requires: man info Provides: bundled(jquery) tbb-doc = %{version}-%{release} Obsoletes: tbb-doc < %{version}-%{release} @@ -46,113 +57,99 @@ TBB module of Python 3 %prep %autosetup -n oneTBB-%{version} -p1 -sed -i 's/"`hostname -s`" ("`uname -m`"/openEulerbuild (%{_arch}/' \ - build/version_info_linux.sh -sed -i 's/-mrtm//' build/linux.gcc.inc -sed -i 's,env python,python3,' python/TBB.py python/tbb/__*.py -sed -i '/^#!/d' python/tbb/{pool,test}.py +for fil in $(grep -Frl %{_bindir}/env python); do + sed -i.orig 's,env python3,python3,' $fil + touch -r $fil.orig $fil + rm $fil.orig +done + +sed -e "s|\('https://docs\.python\.org/': \)None|\1'%{_docdir}/python3-docs/html/objects.inv'|" \ + -i doc/GSG/conf.py doc/main/conf.py %build -%make_build tbb_build_prefix=obj stdver=c++14 \ - CXXFLAGS="%{optflags} -DDO_ITT_NOTIFY -DUSE_PTHREAD -fstack-protector-strong" \ - LDFLAGS="$RPM_LD_FLAGS -lpthread -fstack-protector-strong" -%define pcsource {%{SOURCE6} %{SOURCE7} %{SOURCE8}} -for pcfile in %{pcsource}; do - base=$(basename ${pcfile}) - sed 's/_openEuler_VERSION/%{version}/' ${pcfile} > ${base} - touch -r ${pcfile} ${base} -done +export TBBROOT=$PWD +export PYTHONPATH=$(sed "s,%{_prefix},$PWD/%{_vpath_builddir}/python/build," <<< %{python3_sitearch}) +%cmake \ + -DCMAKE_CXX_STANDARD=17 \ + -DTBB4PY_BUILD:BOOL=ON \ + -DTBB_STRICT:BOOL=OFF \ + -DCMAKE_HWLOC_2_4_LIBRARY_PATH=%{_libdir}/libhwloc.so \ + -DCMAKE_HWLOC_2_4_INCLUDE_PATH=%{_includedir}/hwloc \ -. build/obj_release/tbbvars.sh -pushd python -%make_build -C rml stdver=c++14 \ - CPLUS_FLAGS="%{optflags} -DDO_ITT_NOTIFY -DUSE_PTHREAD -fstack-protector-strong" \ - %ifarch riscv64 - LDFLAGS="$RPM_LD_FLAGS -lpthread -fstack-protector-strong -latomic" - %else - LDFLAGS="$RPM_LD_FLAGS -lpthread -fstack-protector-strong" - %endif -cp -p rml/libirml.so* . -%py3_build -popd +%make_build -make doxygen +unset PYTHONPATH +export LD_LIBRARY_PATH=$(ls -1d $PWD/*relwithdebinfo) +%ifarch riscv64 +pxport LDFLAGS="-L $LD_LIBRARY_PATH %{build_ldflags} -latomic" +%else +export LDFLAGS="-L $LD_LIBRARY_PATH %{build_ldflags}" +%endif +cd python +%pyproject_build +cd - -%check -#This test assumes it can create thread barriers for arbitrary numbers of -#threads, but tbb limits the number of threads spawned to a function of the -#number of CPUs available. Some of the koji builders have a small number of -#CPUs, so the test hangs waiting for threads that have not been created to -#arrive at the barrier. Skip this test until upstream fixes it. -sed -i '/test_task_scheduler_observer/d' build/Makefile.test -make test %{?_smp_mflags} tbb_build_prefix=obj stdver=c++14 CXXFLAGS="$RPM_OPT_FLAGS" +export BUILD_TYPE=oneapi +sphinx-build doc/GSG getting-started +sphinx-build doc/main html %install -mkdir -p %{buildroot}/%{_libdir} -mkdir -p %{buildroot}/%{_includedir} +%make_install -pushd build/obj_release - for file in libtbb{,malloc{,_proxy}}; do - install -p -D -m 755 ${file}.so.2 %{buildroot}/%{_libdir} - ln -s $file.so.2 %{buildroot}/%{_libdir}/$file.so - done -popd +rm -fr %{buildroot}%{python3_sitearch} +cd python +%pyproject_install +cd - -pushd include - find tbb -type f ! -name \*.htm\* -exec install -p -D -m 644 {} \ - %{buildroot}/%{_includedir}/{} \; -popd - -%define pcsource {%{SOURCE6} %{SOURCE7} %{SOURCE8}} -for file in %{pcsource}; do - install -p -D -m 644 $(basename ${file}) \ - %{buildroot}/%{_libdir}/pkgconfig/$(basename ${file}) +mkdir -p %{buildroot}/%{_libdir}/pkgconfig +for file in %{SOURCE7} %{SOURCE8}; do + target=%{buildroot}/%{_libdir}/pkgconfig/$(basename ${file}) + sed 's/_openEuler_VERSION/%{version}/' $file > $target + touch -r $file $target done -# Install the rml headers -mkdir -p %{buildroot}%{_includedir}/rml -cp -p src/rml/include/*.h %{buildroot}%{_includedir}/rml +if [ -f %{buildroot}/%{_libdir}/pkgconfig/%{name}32.pc ]; then + mv %{buildroot}/%{_libdir}/pkgconfig/%{name}32.pc %{buildroot}/%{_libdir}/pkgconfig/%{name}.pc +fi -. build/obj_release/tbbvars.sh -pushd python -%py3_install -chmod a+x %{buildroot}%{python3_sitearch}/TBB.py -chmod a+x %{buildroot}%{python3_sitearch}/tbb/__*.py -cp -p libirml.so.1 %{buildroot}%{_libdir} -ln -s libirml.so.1 $RPM_BUILD_ROOT%{_libdir}/libirml.so -popd +rm -fr %{buildroot}%{_datadir}/doc -mkdir -p %{buildroot}%{_libdir}/cmake -cp -a cmake %{buildroot}%{_libdir}/cmake/tbb -rm %{buildroot}%{_libdir}/cmake/tbb/README.rst - -%ldconfig_scriptlets libs +%check +ctest --output-on-failure --force-new-ctest-process %files %defattr(-,root,root) -%license LICENSE +%license LICENSE.txt %{_libdir}/libirml.so.1 -%{_libdir}/*.so.2 +%{_libdir}/libtbb.so.12* +%{_libdir}/libtbbmalloc.so.2* +%{_libdir}/libtbbmalloc_proxy.so.2* + +%files bind +%{_libdir}/libtbbbind_2_5.so.3* %files devel %defattr(-,root,root) %{_libdir}/pkgconfig/*.pc -%{_includedir}/tbb -%{_includedir}/rml +%{_includedir}/tbb/ +%{_includedir}/oneapi/ %{_libdir}/cmake/ %{_libdir}/*.so %files help %defattr(-,root,root) -%doc doc/Release_Notes.txt html README README.md cmake/README.rst CHANGES +%doc getting-started html README.md cmake/README.md %files -n python3-tbb -%doc python/index.html +%doc python/README.md %{python3_sitearch}/TBB* %{python3_sitearch}/tbb/ %{python3_sitearch}/__pycache__/TBB* %changelog +* Wed Mar 13 2024 liyanan - 2021.11.0-1 +- Update to 2021.11.0 + * Fri Jul 15 2022 chenchen - 2020.3-5 - disable buggy test_task_schedulerl_observer.