Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can try something like this:

import functools
import multiprocessing

N_CPU = multiprocessing.cpu_count()
print('CPUs:',N_CPU)

def myprod(g1,w,u2):
    return max(t*w*u2 for t in g1, key=lambda t: t.length())

with multiprocessing.Pool(processes=N_CPU) as pool:
    winner = max( pool.imap_unordered(functools.partial(myprod,g1,w), g2), key=lambda t: t.length() )