Python Multiprocessing Script Freezes Seemingly Without Error
I am trying to use the multiprocessing package to call a function (let's call it myfunc) in parallel, specifically using pool.map i.e. pool.map(myfunc, myarglist). When I simply lo
Solution 1:
Check whether all the processes are started or not.This will help you to debug it.Also add Pool.join() at the end of your code.
This is a sample code
def start_process():
print 'Starting', multiprocessing.current_process().name
if __name__ == '__main__':
pool_size =2
pool = multiprocessing.Pool(processes=pool_size,
initializer=start_process,
)
pool_outputs = pool.map(function_name,argument_list)
pool.close() # no more tasks
pool.join() # wrap up current tasks
Post a Comment for "Python Multiprocessing Script Freezes Seemingly Without Error"