I have a function f that I want to compute on a certain large data in parallel. The data can be divided in many ways and I am trying to make a decision on how to divide it. I am trying to understand how "map" in multiprocessing.Pool distribute/divide the data exactly so that I make the right decision about splitting my data as well as choosing the number of processors. My input data is not simply a list, as in the below example, but rather list of dictionaries and a list of lists so understanding how Pool.map divides the data seems critical.
That being said, I think understanding the simple example would tell about the more complicated one.
The following scipt shows that we are choosing a Pool of 5 processes and the data in [1,2,3]. What is the implicit choice made here for dividing the data?
from multiprocessing import Pool
def f(x):
return x*x
if __name__ == '__main__':
p = Pool(5)
print(p.map(f, [1, 2, 3]))