miyosuda / async_deep_reinforce

Asynchronous Methods for Deep Reinforcement Learning
Apache License 2.0
592 stars 192 forks source link

use Multiprocessing instead of Threading? #27

Open mw66 opened 7 years ago

mw66 commented 7 years ago

The current implementation use Python Threading. I just wonder if this can be switched using Multiprocessing?

Multiprocessing performs much better on multi-core CPUs than Threading in Python.

Is this possible? did I miss something?

ei-grad commented 7 years ago

It doesn't matter on single machine since most computations are produced in tensorflow and environment emulator which both don't suffer from GIL. But it could be really nice to investigate the ability to get a distributed async agent learning implementation somehow.

mw66 commented 7 years ago

Nowadays even a single machine have multiple cores, but python Threading only use 1, for many application (e.g. in my case) I want to use the extra core to speed up data-generating / loading.

ppwwyyxx commented 7 years ago

@mingwugmail python threading does not just use 1 core. Although it just very often use fewer cores than similar code written in multiprocessing. In the case of A3C I've tried both and multiprocessing is indeed faster.