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

Make MPI install optional #433

Merged
merged 11 commits into from
Aug 5, 2019
Merged

Make MPI install optional #433

merged 11 commits into from
Aug 5, 2019

Conversation

shwang
Copy link

@shwang shwang commented Aug 2, 2019

closes #430

@araffin
Copy link
Collaborator

araffin commented Aug 2, 2019

Hello,
Thanks for the PR. The failure on Travis seems to come from the recent update of the docker images... (Cf #428)
If the issue is not identified, i will rollback to the previous docker image.

@AdamGleave
Copy link
Collaborator

AdamGleave commented Aug 2, 2019

docs/misc/changelog.rst should be updated to mention this.

It'd be nice to test things work as expected with or without mpi4py installed. Ideal would be to run Travis in two environments, but that'd be quite expensive, and we'd need to go through and disable the tests that actually depend on MPI in the non-MPI environment.

Just checking you can import stable_baselines without import errors if mpi4py is not installed would catch a lot of potential issues. I think something like this should work:

import sys

def test_no_mpi():
  mpi = sys.modules['mpi4py']
  sys.modules['mpi4py'] = None
  import stable_baselines
  # ... maybe do some simple smoke test in something in stable_baselines
  sys.modules['mpi4py'] = mpi  # only need to do this if process reused

@araffin
Copy link
Collaborator

araffin commented Aug 2, 2019

@AdamGleave @shwang to test travis for now, you can use the v2.6.0 docker images (see d7e9591), I'm trying to find out what dependency makes it fail (it looks like it is pytest fault).

@araffin
Copy link
Collaborator

araffin commented Aug 3, 2019

I rolled back the docker images for now, travis should be working again

@AdamGleave
Copy link
Collaborator

@shwang is this ready for review?

@shwang
Copy link
Author

shwang commented Aug 4, 2019 via email

@AdamGleave
Copy link
Collaborator

Need to add a test, not yet. Thanks for the rollback, @araffin
OK, ping me when you want me to take a look.

@shwang
Copy link
Author

shwang commented Aug 5, 2019

del sys.modules["mpi4py"] actually matters in the test_logger because misc_util.mpi_rank_or_zero() imports mpi4py inside the function definition.

I also considered adding a disabled_mpi parametrization to test_ppo2 but that doesn't seem to add anything substantive.

@shwang shwang marked this pull request as ready for review August 5, 2019 04:37
@shwang
Copy link
Author

shwang commented Aug 5, 2019

@AdamGleave ready for review

Copy link
Collaborator

@AdamGleave AdamGleave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, will merge once tests pass.

@AdamGleave AdamGleave merged commit 9a76054 into hill-a:master Aug 5, 2019
@araffin
Copy link
Collaborator

araffin commented Aug 5, 2019

A bit late... I thought the README was also updated but this is not the case.
I also need to check colab notebook to ensure stable baselines with mpi is installed.

EDIT: another minor remark: the link is not showing properly in the doc https://stable-baselines.readthedocs.io/en/master/guide/install.html and we should put the "stable baselines with OpenMPI" bloc at the top I think.

@AdamGleave
Copy link
Collaborator

Ah, sorry for not catching that README.md wasn't updated, I've opened a new PR.

@AdamGleave AdamGleave mentioned this pull request Aug 6, 2019
@shwang shwang deleted the optional_mpi branch August 6, 2019 21:50
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

Successfully merging this pull request may close these issues.

[feature request] Import MPI only when needed
3 participants