I have a python front end, and a fortran back end, using F2py to call a python wrapper function "gBulk_kZ" for a fortran function. I was comparing the time of two methods. The first with multiprocessing, the second just using the map function. Running the multiprocessing over just one processor gives x100 speed up. If I leave the processor choice empty then it runs in about 14.0ms. Why is multiprocessing so much faster than just map in the case that i'm just using one processor?
Method 1: time = 6.9ms
pool = multiprocessing.Pool(1)
g = partial(gBulk_kZ,m,n,s_lat)
glist = pool.map(g,Elist)
pool.close()
pool.join()
Method 2: time = 690.4ms
g = partial(gBulk_kZ,m,n,s_lat)
glist = map(g,Elist)
And then they both write out in the same way.