Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on multiprocessing #22

Closed
pengzhi1998 opened this issue Jul 14, 2020 · 1 comment
Closed

Question on multiprocessing #22

pengzhi1998 opened this issue Jul 14, 2020 · 1 comment

Comments

@pengzhi1998
Copy link

Hi @Khrylx, thank you so much for this great repository!
But I found in the Readme:

PyTorch will create additional threads when performing computations which can damage the performance of multiprocessing. This problem is most serious with Linux, where multiprocessing can be even slower than a single thread

and found here you only set one process.
I'm a little bit confused, do you recommend using multiple processes to train the network?
But if it only uses one process to train the network, what's its advantage over memory buffer?
Thank you!

@Khrylx
Copy link
Owner

Khrylx commented Jul 14, 2020

The reason for setting OMP_NUM_THREADS=1 is because when we create multiple worker threads to sample trajectories, we want each worker thread to only use its own thread instead of taking resources from other threads, which can slow down the overall speed.

Also, for the code you referred to, I am actually using "self.num_threads" number of threads, which is a parameter to the agent.

@Khrylx Khrylx closed this as completed Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants