Quantcast
Channel: Multiprocess or multiprocessing not working [EDIT] list(zip(a,b,)) behaviour - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Multiprocess or multiprocessing not working [EDIT] list(zip(a,b,)) behaviour

$
0
0

the following code

import multiprocessing as mpfrom multiprocessing.managers import SyncManagern_cores = mp.cpu_count()def parallel_fn(job_n, cache):    cache['job_b'] = job_n    return job_nif __name__=="__main__":    with SyncManager() as manager:        shared_cache = manager.dict()        args = list(zip(range(n_cores), shared_cache))        with mp.Pool(n_cores) as pool:            result = pool.starmap(parallel_fn, args)            print(result)        print(shared_cache)

returns

16Shared dict before: {}Pool return: []Shared dict after: {}

I was expecting 16 values in return from the pool and 16 values in the shared dictionary, but both are empty, anyone can help me out?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images