-
Notifications
You must be signed in to change notification settings - Fork 724
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
Make SubprocVecEnv Thread Safe #218
Conversation
Only real downside of Before PR:
After PR:
Generated using:
|
Hello Adam, |
OK, thanks for letting me know, I don't think this is time sensitive. Using
|
Hey, I think you should add a hyperparameter to SubProcVecEnv, such as |
@AdamGleave you meant PR #207 ? That's a good thing you added a test.
There is a high probability your two PR will be merged ;) |
Yes I meant PR #207 -- sorry. No problem, I understand things can take a while. I'm happy using my fork until things get merged, so there's no rush. |
Updated with latest changes to master and added the test case. |
The failure on travis is due to a memory error. I suspect it to be related to what I experimented when trying to do hyperparameter search in the rl zoo. See fix here |
You can try to cherry-pick this comit: 987cfdf |
Thanks @araffin. I'm a little confused why we need to kill the processes explicitly -- shouldn't this happen when |
Good remark, I did not noticed that method (I thought it was related only to the render() method). Could you try calling it in the different EDIT: apparently, my fix was not enough :/ (see https://travis-ci.com/hill-a/stable-baselines/builds/103783111) |
I made the changes here: 6e655a7 |
@araffin thanks, closing the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appart from the minor typo in the changelog, LGTM, thanks =)
Hello @AdamGleave , Because of your good contributions, and as we need more people like you to help us improve stable-baselines, we would like to propose you to join us and become maintainer of this repository. You will have the ability to create branches, do code reviews and will be obviously credited in the README ;) With @hill-a and @erniejunior in CC EDIT related to your PR The cool thing with your PR is that the user has still the ability to change that behavior. EDIT: good write-up of the dilemma found by Ashley https://codewithoutrules.com/2018/09/04/python-multiprocessing/ |
Hi @araffin, Thanks for the offer of joining the team! Potentially interested depending on time constraints -- I'll send an e-mail to discuss this further in private. In terms of the PR, I'd be happy for the default behaviour to be switched to Were the problems you were experiencing related to MPI at all? In particular, if the segfault had anything involving |
Yes, that's my main concern, keeping things easy for users (and not breaking their code), even though it has some risk (which are hopefully rare).
Yes, some where with MPI, some where not, but surprisingly enough, it depends on the machine I'm working with.
I think that what they did recently in the Baselines repo. I assume that the number of users affected by those problems is low (we did not have any issue yet) compared to the complexity of making several tweaks to import mpi only when needed. |
As discussed in issue #217,
SubprocVecEnv
uses on Unix systems the non-thread-safefork
method of multiprocessing, which can cause issues e.g. when the parent process has an extant TensorFlow session. This PR changesSubprocVecEnv
to use the thread-safespawn
method.