This output has been generated using Python 3.8 on macOS
, which is the first release of Py3 on macOS
to use spawn
as the default start_method
(more here)
❯ python multiprocessing_seed_numpy.py
Start Method: spawn
Main Process : Random State 123456
Pool Worker 0: Random State 2147483648
Pool Worker 1: Random State 2147483648
Pool Worker 3: Random State 2147483648
Pool Worker 2: Random State 2147483648
Pool Worker 4: Random State 2147483648
❯ python multiprocessing_seed_numpy.py --with-fork
Start Method: fork
Main Process : Random State 123456
Pool Worker 0: Random State 123456
Pool Worker 1: Random State 123456
Pool Worker 2: Random State 123456
Pool Worker 3: Random State 123456
Pool Worker 4: Random State 123456
❯ python multiprocessing_seed_torch.py
Start Method: spawn
Main Process : Random State 123456
Pool Worker 0: Random State 12008651253415256287
Pool Worker 1: Random State 12008651253415256287
Pool Worker 2: Random State 12008651253415256287
Pool Worker 3: Random State 12008651253415256287
Pool Worker 4: Random State 12008651253415256287
❯ python multiprocessing_seed_torch.py --with-fork
Start Method: fork
Main Process : Random State 123456
Pool Worker 0: Random State 123456
Pool Worker 1: Random State 123456
Pool Worker 2: Random State 123456
Pool Worker 3: Random State 123456
Pool Worker 4: Random State 123456