Unverified Commit cf631de0 authored by Ankit Gola's avatar Ankit Gola Committed by GitHub
Browse files

Fix for hang due to mp.Pool in bootstrap_stderr (#3135)

parent 31895e5b
...@@ -505,7 +505,6 @@ def bootstrap_stderr( ...@@ -505,7 +505,6 @@ def bootstrap_stderr(
if not os.getenv("DISABLE_MULTIPROC"): if not os.getenv("DISABLE_MULTIPROC"):
import multiprocessing as mp import multiprocessing as mp
pool = mp.Pool(mp.cpu_count())
# this gives a biased estimate of the stderr (i.e w/ the mean, it gives something # this gives a biased estimate of the stderr (i.e w/ the mean, it gives something
# equivalent to stderr calculated without Bessel's correction in the stddev. # equivalent to stderr calculated without Bessel's correction in the stddev.
# Unfortunately, I haven't been able to figure out what the right correction is # Unfortunately, I haven't been able to figure out what the right correction is
...@@ -517,17 +516,16 @@ def bootstrap_stderr( ...@@ -517,17 +516,16 @@ def bootstrap_stderr(
from tqdm import tqdm from tqdm import tqdm
print("bootstrapping for stddev:", f.__name__) print("bootstrapping for stddev:", f.__name__)
for bootstrap in tqdm( with mp.Pool(mp.cpu_count()) as pool:
pool.imap( for bootstrap in tqdm(
_bootstrap_internal(f, chunk_size), pool.imap(
[(i, xs) for i in range(iters // chunk_size)], _bootstrap_internal(f, chunk_size),
), [(i, xs) for i in range(iters // chunk_size)],
total=iters // chunk_size, ),
): total=iters // chunk_size,
# sample w replacement ):
res.extend(bootstrap) # sample w replacement
res.extend(bootstrap)
pool.close()
else: else:
res = _bootstrap_internal_no_mp(f, xs, iters) res = _bootstrap_internal_no_mp(f, xs, iters)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment