Skip to content

Commit 5689f3a

Browse files
committed
fix: use fork context instead of spawn to avoid forkserver crash and slowdown
1 parent 51a89dc commit 5689f3a

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

SigProfilerClusters/SigProfilerClusters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ def analysis(
12251225
original_samples_length = os.listdir(original_samples)
12261226
if processors > len(original_samples_length):
12271227
max_seed = len(original_samples_length)
1228-
pool = mp.Pool(max_seed)
1228+
pool = mp.get_context("fork").Pool(max_seed)
12291229
# pool_break = len(simulations)/max_seed
12301230
samples_parallel = [[] for i in range(max_seed)]
12311231
pool_bin = 0
@@ -1259,7 +1259,7 @@ def analysis(
12591259
# Parallelize and calculate distances for the simulated samples
12601260
if processors > len(simulations):
12611261
max_seed = len(simulations)
1262-
pool = mp.Pool(max_seed)
1262+
pool = mp.get_context("fork").Pool(max_seed)
12631263
# sim_break = len(simulations)/max_seed
12641264
simulations_parallel = [[] for i in range(max_seed)]
12651265
sim_bin = 0

SigProfilerClusters/SigProfilerHotSpots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ def analysis(
10291029
original_samples_length = os.listdir(original_samples)
10301030
if processors > len(original_samples_length):
10311031
max_seed = len(original_samples_length)
1032-
pool = mp.Pool(max_seed)
1032+
pool = mp.get_context("fork").Pool(max_seed)
10331033
# pool_break = len(simulations)/max_seed
10341034
samples_parallel = [[] for i in range(max_seed)]
10351035
pool_bin = 0
@@ -1063,7 +1063,7 @@ def analysis(
10631063
# Parallelize and calculate distances for the simulated samples
10641064
if processors > len(simulations):
10651065
max_seed = len(simulations)
1066-
pool = mp.Pool(max_seed)
1066+
pool = mp.get_context("fork").Pool(max_seed)
10671067
# sim_break = len(simulations)/max_seed
10681068
simulations_parallel = [[] for i in range(max_seed)]
10691069
sim_bin = 0

SigProfilerClusters/classifyFunctions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,7 @@ def findClustersOfClusters(
17131713
max_seed = len(subclasses)
17141714
else:
17151715
max_seed = processors
1716-
pool = mp.Pool(max_seed)
1716+
pool = mp.get_context("fork").Pool(max_seed)
17171717

17181718
subclasses_parallel = [[] for i in range(max_seed)]
17191719
subclass_bin = 0
@@ -2620,7 +2620,7 @@ def findClustersOfClusters_noVAF(
26202620
max_seed = len(subclasses)
26212621
else:
26222622
max_seed = processors
2623-
pool = mp.Pool(max_seed)
2623+
pool = mp.get_context("fork").Pool(max_seed)
26242624

26252625
subclasses_parallel = [[] for i in range(max_seed)]
26262626
subclass_bin = 0

0 commit comments

Comments
 (0)