I am having trouble understanding the "chunksize" parameter in pool.map.
For the following codes, I get the same results whether I use '2' or nothing for the chunksize parameter.
import multiprocessing
from multiprocessing import Pool
lst_of_lst = [[1,2],[3,4],[5,6],[7,8]]
def count(lst):
return len(lst)
if __name__ == '__main__':
P = Pool(2)
for results in P.map(count,lst_of_lst,2):
print (results)
P.close()
P.join()
Result are always: "2 2 2 2"
With a chunksize of '2', I was expecting [[1,2],[3,4]]
to be sent to one worker and [[5,6],[7,8]]
to the second worker giving me "2 2" as an answer.
What am I missing? What does the chunksize do?