Switched to Pooling and local aggregation
This commit is contained in:
@ -2,10 +2,12 @@ import multiprocessing as mp
|
||||
import time
|
||||
|
||||
|
||||
def run_n_in_parallel(f, n, **kwargs):
|
||||
def run_n_in_parallel(f, n, processes=0, **kwargs):
|
||||
processes = processes if processes else mp.cpu_count()
|
||||
output = mp.Queue()
|
||||
kwargs.update(output=output)
|
||||
# Setup a list of processes that we want to run
|
||||
|
||||
processes = [mp.Process(target=f, kwargs=kwargs) for _ in range(n)]
|
||||
# Run processes
|
||||
results = []
|
||||
|
Reference in New Issue
Block a user