You are not logged in.

#1 2021-09-08 14:15:38

loqs
Member
Registered: 2014-03-06
Posts: 13,940

PKGBUILD review request tbb2020

Threading Building Blocks deprecated a large number of features in its 2020 releases and removed those features in the 2021 releases.
This required many packages to be updated to updated for the 2021 release. * indicates uses old package name intel-tbb:
* embree supported
* opencascade custom patch
opencv supported
* openimagedenoise supported
* opensubdiv has pull request https://github.com/PixarAnimationStudio … 6ad7a7bdcb
* openvdb  support in master https://github.com/AcademySoftwareFound … 5d407141f5
openvkl supported
* ospray supported
* paraview support in master
* prusaslicer support in master except for update to FindTBB.cmake
rkcommon supported
root supported
suitesparse upstream will not support suggests disabling tbb https://github.com/DrTimothyAldenDavis/ … /issues/72
* sysdig supported
* vtr has custom patch or switch to serial execution
* usd not supported

So tbb could be updated apart from usd's lack of support 1 2.  Hence the creation of tbb2020

PKGBUILD for tbb2020

# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: Denis Martinez <deuns.martinez AT gmail.com>
# Contributor: Bogdan Burlacu <bogdan.burlacu AT pm.me>

pkgname=tbb2020
pkgver=2020.3
pkgrel=1
pkgdesc='High level abstract threading library'
arch=('x86_64')
url='https://www.threadingbuildingblocks.org/'
license=('Apache')
depends=('gcc-libs')
makedepends=('inetutils')
source=(https://github.com/oneapi-src/oneTBB/archive/v$pkgver/tbb-$pkgver.tar.gz)
sha512sums=('ea1ffd22c7234d715b8c46a4e51b40719c7a9b8837ab3166f1da5a2c6061167c2be2126b1d74fd361eec6975b8fce0df26829ca2e7af8029edbb52e40f23d630')

build() {
  cd oneTBB-$pkgver
  make
}

package() {
  cd oneTBB-$pkgver
  install -Dm755 build/linux_*/*.so* -t "$pkgdir"/usr/lib/$pkgname
  install -d "$pkgdir"/usr/include/$pkgname
  cp -a include/tbb "$pkgdir"/usr/include/$pkgname
}

git diff of PKGBUILD for usd

diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD
index fb66455..4f25a0d 100644
--- a/trunk/PKGBUILD
+++ b/trunk/PKGBUILD
@@ -7,8 +7,8 @@ pkgdesc="3D VFX pipeline interchange file format"
 arch=('x86_64')
 url="https://graphics.pixar.com/usd/docs/index.html"
 license=('Apache')
-depends=('boost-libs' 'glew' 'opensubdiv' 'python' 'pyside2' 'python-opengl' 'ptex')
-makedepends=('boost' 'cmake' 'intel-tbb' 'ninja' 'qt5-base')
+depends=('boost-libs' 'glew' 'opensubdiv' 'python' 'pyside2' 'python-opengl' 'ptex' 'tbb2020')
+makedepends=('boost' 'cmake' 'ninja' 'qt5-base')
 provides=("usd=${pkgver}")
 source=("$pkgname-$pkgver.tar.gz::https://github.com/PixarAnimationStudios/USD/archive/v${pkgver}.tar.gz"
         'gcc11.patch'
@@ -32,7 +32,9 @@ build() {
     -DPXR_BUILD_IMAGING=ON \
     -DPXR_BUILD_TESTS=OFF \
     -DPXR_BUILD_MONOLITHIC=ON \
-    -DPYSIDE_BIN_DIR="$srcdir"
+    -DPYSIDE_BIN_DIR="$srcdir" \
+    -DTBB_INCLUDE_DIR=/usr/include/tbb2020 \
+    -DTBB_LIBRARY=/usr/lib/tbb2020
   ninja -C build
 }
 

None upstreamed patches required for other packages to use tbb 2021
opencascade

diff --git a/src/OSD/OSD_Parallel_TBB.cxx b/src/OSD/OSD_Parallel_TBB.cxx
index 2344a6ca..470a27b8 100644
--- a/src/OSD/OSD_Parallel_TBB.cxx
+++ b/src/OSD/OSD_Parallel_TBB.cxx
@@ -21,12 +21,11 @@
 #include <OSD_ThreadPool.hxx>
 #include <Standard_ProgramError.hxx>
 
-Standard_DISABLE_DEPRECATION_WARNINGS
 #include <tbb/parallel_for.h>
 #include <tbb/parallel_for_each.h>
 #include <tbb/blocked_range.h>
-#include <tbb/task_scheduler_init.h>
-Standard_ENABLE_DEPRECATION_WARNINGS
+#include "tbb/task_group.h"
+#include "tbb/task_arena.h"
 
 //=======================================================================
 //function : forEachExternal
@@ -38,19 +37,17 @@ void OSD_Parallel::forEachExternal (UniversalIterator& theBegin,
                                     const FunctorInterface& theFunctor,
                                     Standard_Integer theNbItems)
 {
-  try
-  {
-    const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
-    const Standard_Integer aNbThreads = theNbItems > 0 ?
-      aThreadPool->NbDefaultThreadsToLaunch() : -1;
+  const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
+  const Standard_Integer aNbThreads = theNbItems > 0 ?
+    aThreadPool->NbDefaultThreadsToLaunch() : -1;
+  tbb::task_arena theArena(aNbThreads);
+  tbb::task_group theTaskGroup;
 
-    tbb::task_scheduler_init aScheduler (aNbThreads);
-    tbb::parallel_for_each (theBegin, theEnd, theFunctor);
-  }
-  catch (tbb::captured_exception& anException)
-  {
-    throw Standard_ProgramError (anException.what());
-  }
+  theArena.execute([&]{
+    theTaskGroup.run([&]{
+        tbb::parallel_for_each (theBegin, theEnd, theFunctor);
+    });
+  });
 }
 
 #endif /* HAVE_TBB */

vtr

diff --git a/vpr/src/base/vpr_api.cpp b/vpr/src/base/vpr_api.cpp
index 7b4f2df1c..9ed97062a 100644
--- a/vpr/src/base/vpr_api.cpp
+++ b/vpr/src/base/vpr_api.cpp
@@ -89,11 +89,8 @@
 #include "iostream"
 
 #ifdef VPR_USE_TBB
-#    include <tbb/task_scheduler_init.h>
-
-//We need to store the scheduler object so any concurrency
-//setting is persistent
-std::unique_ptr<tbb::task_scheduler_init> tbb_scheduler;
+#    include <tbb/global_control.h>
+#    include <tbb/task_arena.h>
 #endif
 
 /* Local subroutines */
@@ -213,11 +210,11 @@ void vpr_init_with_options(const t_options* options, t_vpr_setup* vpr_setup, t_a
     //Using Thread Building Blocks
     if (num_workers == 0) {
         //Use default concurrency (i.e. maximum conccurency)
-        num_workers = tbb::task_scheduler_init::default_num_threads();
+        num_workers = tbb::task_arena().max_concurrency();
     }
 
     VTR_LOG("Using up to %zu parallel worker(s)\n", num_workers);
-    tbb_scheduler = std::make_unique<tbb::task_scheduler_init>(num_workers);
+    tbb::global_control(tbb::global_control::max_allowed_parallelism, num_workers);
 #else
     //No parallel execution support
     if (num_workers != 1) {

Last edited by loqs (2021-09-08 14:42:57)

Offline

Board footer

Powered by FluxBB