dgriff777 / rl_a3c_pytorch

A3C LSTM Atari with Pytorch plus A3G design
Apache License 2.0
563 stars 119 forks source link

Clarification needed regarding num_workers #38

Closed enochkan closed 3 years ago

enochkan commented 3 years ago

@dgriff777 thanks again for providing this amazing repo, was wondering if num_workers should be equal to the number of threads instead of the number of cores as suggested in README.md. I'm new to A3C so please bear with me if this is a naive question :P

dgriff777 commented 3 years ago

Thank you for the kind words.

So you don't have the static number of threads on your computer or server that you are using to run this, so number threads would not be a limiting factor here. As this is using python to achieve true parallelism we must use multiprocessing not multithreading as multithreading is the spawning of new threads within in a process and each process for python is run by its own python interpreter and the GIL (global interpreter lock) inhibits true parallel execution of threads within in a process and instead are executed orderly.

The num_workers parameter is just dictating the number of training processes where a model is trained on the game and then shares its updates by updating a shared model between its each process.

hope that helps

enochkan commented 3 years ago

Thank you for the clarification! Is this project accepting contributions? Would love to contribute if possible.