Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ebf008a commit 38e3e0fCopy full SHA for 38e3e0f
numpy/_core/tests/test_multithreading.py
@@ -0,0 +1,15 @@
1
+import concurrent.futures
2
+
3
+import numpy as np
4
5
6
+def test_parallel_errstate_creation():
7
+ # if the coercion cache is enabled and not thread-safe, creating RandomState
8
+ # instances simultaneously leads to a data race
9
+ def func(seed):
10
+ np.random.RandomState(seed)
11
12
+ with concurrent.futures.ThreadPoolExecutor(max_workers=8) as tpe:
13
+ futures = [tpe.submit(func, i) for i in range(500)]
14
+ for f in futures:
15
+ f.result()
0 commit comments