python-numba/update-tbb-backend-calls-2021.6.patch
Daniel Garcia bf674995ad - Update to 0.56.2
This release continues to add new features, bug fixes and stability
  improvements to Numba. Please note that this will be the last release that
  has support for Python 3.7 as the next release series (Numba 0.57) will
  support Python 3.11! Also note that, this will be the last release to support
  linux-32 packages produced by the Numba team.
- Remove fix-max-name-size.patch, it's included in the new version.
- Add update-tbb-backend-calls-2021.6.patch to make it compatible with the
  latest tbb-devel version.
- Add fix-cli-test.patch to disable one test that fails with OBS.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-numba?expand=0&rev=55
2022-10-03 13:07:28 +00:00

71 lines
2.2 KiB
Diff

Index: numba-0.56.2/numba/np/ufunc/tbbpool.cpp
===================================================================
--- numba-0.56.2.orig/numba/np/ufunc/tbbpool.cpp
+++ numba-0.56.2/numba/np/ufunc/tbbpool.cpp
@@ -12,6 +12,7 @@ Implement parallel vectorize workqueue o
#undef _XOPEN_SOURCE
#endif
+#include <tbb/version.h>
#include <tbb/tbb.h>
#include <string.h>
#include <stdio.h>
@@ -27,10 +28,28 @@ Implement parallel vectorize workqueue o
* from here:
* https://github.com/intel/tbb/blob/2019_U5/include/tbb/tbb_stddef.h#L29
*/
-#if (TBB_INTERFACE_VERSION >= 12060) || (TBB_INTERFACE_VERSION < 12010)
-#error "TBB version is incompatible, 2021.1 through to 2021.5 required, i.e. 12010 <= TBB_INTERFACE_VERSION < 12060"
+#if TBB_INTERFACE_VERSION < 12010
+#error "TBB version is too old, 2021 update 1, i.e. TBB_INTERFACE_VERSION >= 12010 required"
#endif
+static tbb::task_scheduler_handle tbb_tsh_attach()
+{
+#if TBB_INTERFACE_VERSION >= 12060
+ return tbb::attach();
+#else
+ return tbb::task_scheduler_handle::get();
+#endif
+}
+
+static void tbb_tsh_release(tbb::task_scheduler_handle& tsh)
+{
+#if TBB_INTERFACE_VERSION >= 12060
+ tsh.release();
+#else
+ tbb::task_scheduler_handle::release(tsh);
+#endif
+}
+
#define _DEBUG 0
#define _TRACE_SPLIT 0
@@ -235,7 +254,7 @@ static void prepare_fork(void)
{
if (!tbb::finalize(tsh, std::nothrow))
{
- tbb::task_scheduler_handle::release(tsh);
+ tbb_tsh_release(tsh);
puts("Unable to join threads to shut down before fork(). "
"This can break multithreading in child processes.\n");
}
@@ -260,7 +279,7 @@ static void reset_after_fork(void)
if(need_reinit_after_fork)
{
- tsh = tbb::task_scheduler_handle::get();
+ tbb_tsh_attach();
set_main_thread();
tsh_was_initialized = true;
need_reinit_after_fork = false;
@@ -298,7 +317,7 @@ static void launch_threads(int count)
if(count < 1)
count = tbb::task_arena::automatic;
- tsh = tbb::task_scheduler_handle::get();
+ tsh = tbb_tsh_attach();
tsh_was_initialized = true;
tg = new tbb::task_group;