Dirk Mueller
8de96c9b1f
- Add multiprocessing-context.patch fixing tests for Python 3.11.5 OBS-URL: https://build.opensuse.org/request/show/1112284 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-numba?expand=0&rev=73
62 lines
2.7 KiB
Diff
62 lines
2.7 KiB
Diff
From c59e46a177bf7134dec3a9a374ec75aec4576e31 Mon Sep 17 00:00:00 2001
|
|
From: Stuart Archibald <stuartarchibald@users.noreply.github.com>
|
|
Date: Thu, 7 Sep 2023 17:03:56 +0100
|
|
Subject: [PATCH] Fix issue with incompatible multiprocessing context in test.
|
|
|
|
This fixes an issue highlighted by a patch added to Python 3.11.5
|
|
which identifies if a semaphore created via one multiprocessing
|
|
context is in use by another (doing this is essentially a bug).
|
|
---
|
|
numba/tests/test_parallel_backend.py | 12 ++++++------
|
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/numba/tests/test_parallel_backend.py b/numba/tests/test_parallel_backend.py
|
|
index b1bee4fa94e..db64b6971e4 100644
|
|
--- a/numba/tests/test_parallel_backend.py
|
|
+++ b/numba/tests/test_parallel_backend.py
|
|
@@ -819,13 +819,13 @@ def test_par_parent_explicit_mp_fork_par_child(self):
|
|
body = """if 1:
|
|
X = np.arange(1000000.)
|
|
Y = np.arange(1000000.)
|
|
- q = multiprocessing.Queue()
|
|
+ ctx = multiprocessing.get_context('fork')
|
|
+ q = ctx.Queue()
|
|
|
|
# Start OpenMP runtime on parent via parallel function
|
|
Z = busy_func(X, Y, q)
|
|
|
|
# fork() underneath with no exec, will abort
|
|
- ctx = multiprocessing.get_context('fork')
|
|
proc = ctx.Process(target = busy_func, args=(X, Y, q))
|
|
proc.start()
|
|
proc.join()
|
|
@@ -851,12 +851,12 @@ def test_par_parent_mp_spawn_par_child_par_parent(self):
|
|
body = """if 1:
|
|
X = np.arange(1000000.)
|
|
Y = np.arange(1000000.)
|
|
- q = multiprocessing.Queue()
|
|
+ ctx = multiprocessing.get_context('spawn')
|
|
+ q = ctx.Queue()
|
|
|
|
# Start OpenMP runtime and run on parent via parallel function
|
|
Z = busy_func(X, Y, q)
|
|
procs = []
|
|
- ctx = multiprocessing.get_context('spawn')
|
|
for x in range(20): # start a lot to try and get overlap
|
|
## fork() + exec() to run some OpenMP on children
|
|
proc = ctx.Process(target = busy_func, args=(X, Y, q))
|
|
@@ -937,11 +937,11 @@ def test_serial_parent_explicit_mp_fork_par_child_then_par_parent(self):
|
|
body = """if 1:
|
|
X = np.arange(1000000.)
|
|
Y = np.arange(1000000.)
|
|
- q = multiprocessing.Queue()
|
|
+ ctx = multiprocessing.get_context('fork')
|
|
+ q = ctx.Queue()
|
|
|
|
# this is ok
|
|
procs = []
|
|
- ctx = multiprocessing.get_context('fork')
|
|
for x in range(10):
|
|
# fork() underneath with but no OpenMP in parent, this is ok
|
|
proc = ctx.Process(target = busy_func, args=(X, Y, q))
|