The problem is passing <class 'numpy.float64'>
instead of <class 'float'>
, which is the same according to this answer:
print(random_list[0].hex(), type(random_list[0]))
print(float(random_list[0]).hex(), type(float(random_list[0])))
0x1.7c61d92be8a60p-4 <class 'numpy.float64'>
0x1.7c61d92be8a60p-4 <class 'float'>
Use random_list = [float(x) for x in np.random.rand(N)]
as a workaround.
<class 'numpy.float64'> 0x1.4d5e3d424fca0p-3
<class 'float'> 0x1.4d5e3d424fca0p-3
1666667 [0.16277740343682456, 0.2236445811127703, 0.24302636516506426]
1666667 [0.9839224808778051, 0.7885649288285472, 0.5115890361207274]
1666667 [0.6110548657514351, 0.4254468671297228, 0.755695655477851]
1666667 [0.7875976996371834, 0.1860834865513915, 0.6425133427321916]
1666667 [0.7248206935294595, 0.912748881029397, 0.2777262300084712]
1666665 [0.5982501130550539, 0.8190458209204438, 0.36885142475263655]
start proccess
start multiplication
after start process
----------------------------------------------------------------
start proccess
end multiplication
start multiplication
end multiplication
after start process
----------------------------------------------------------------
start proccess
start multiplication
end multiplication
after start process
----------------------------------------------------------------
start proccess
start multiplication
end multiplication
after start process
----------------------------------------------------------------
start proccess
start multiplication
end multiplication
after start process
----------------------------------------------------------------
start proccess
start multiplication
end multiplication
after start process
----------------------------------------------------------------
44.44382
(venv)> python multiprocdemo.py
<class 'float'> 0x1.d819f64362c80p-8
<class 'float'> 0x1.d819f64362c80p-8
1666667 [0.00720369589124481, 0.2714234018047603, 0.2374615793977285]
1666667 [0.013831371021074346, 0.12480464518099776, 0.23994124785173276]
1666667 [0.6838916452098018, 0.4791172707405815, 0.8731298576461729]
1666667 [0.38914850916876287, 0.9744634265322073, 0.8872740902618148]
1666667 [0.2565996268152796, 0.8731909755923012, 0.29488407178637677]
1666665 [0.41678072679755296, 0.5166087260179636, 0.15102593638101824]
start proccess
after start process
----------------------------------------------------------------
start proccess
start multiplication
end multiplication
after start process
----------------------------------------------------------------
start proccess
start multiplication
end multiplication
after start process
----------------------------------------------------------------
start proccess
start multiplication
end multiplication
after start process
----------------------------------------------------------------
start proccess
start multiplication
end multiplication
after start process
----------------------------------------------------------------
start proccess
start multiplication
end multiplication
after start process
----------------------------------------------------------------
start multiplication
end multiplication
2.83933
Alternatively, skip multiprocessing
and use numpy for float64 on all cores.