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

[Feature Request] add cmake build method, make it easier for adding envpool as a third-party dependency in c++ environment #180

Open
walkacross opened this issue Jul 31, 2022 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@walkacross
Copy link

walkacross commented Jul 31, 2022

Motivation

thanks for this nice library, which is trying to provide is a general solution for various kinds of speeding-up RL environment parallelization. Currently, envpool treats the python users are first class citizens, ignoring and sacrificing the c++ user experience.

Solution

add cmake build method, make it easier for adding envpool as a third-party dependency in c++ environment, where users are not familiar with bazel or in condition which make the use of bazel infeasible.

@Trinkle23897 Trinkle23897 added the question Further information is requested label Jul 31, 2022
@Trinkle23897
Copy link
Collaborator

Trinkle23897 commented Jul 31, 2022

Previously, we were seriously considering using cmake instead of bazel to build the open-source version of envpool. A fun fact is that the first internal version of envpool is built with cmake. However, after spending some time developing envpool in c++, we finally realized it's a huge benefit to use bazel instead of cmake for other integration. Here are the reasons:

  1. It's easier to integrate new envs with bazel than cmake. Build mujoco from source code #141 is a great example (though it hasn't been merged yet, it works). You only need to find all source code's name list, and create a BUILD file, and that's done. I wrote a detailed tutorial to explain how it works: https://envpool.readthedocs.io/en/latest/content/build.html
  2. Bazel can support partial unit test can cache previous build/test result. This can save a lot of time for CI. Another example is ray. They also use bazel to build and test, even in rllib -- a pure python library. Bazel can easily discover the dependency of a specific test, while cmake can't.

Overall, in our opinion, bazel can do what cmake can do, and can also do what cmake can't do. So that's why we choose bazel for the open-source release instead of continuing using cmake. We are also using C++, and we don't think it's a sacrifice for C++ user experience -- otherwise, why Google uses bazel instead of cmake in all its product?

@Trinkle23897 Trinkle23897 added discussion and removed question Further information is requested labels Jul 31, 2022
@walkacross
Copy link
Author

hi there @Trinkle23897 , thanks for your quick and detail feedback.

I see the advantage of using bazel, specially in saving a lot of time for CI. what I'm wondering is can envpool do something further to improve the eas of use in c++ environment, considering cmake is the mainstream build system, which migh further enhance the envpool impact.

for example.

  1. envpool can provide a tutorial for usrs how to use envpool(built by bazel) in a cmake project.

  2. like grpc and tensorflow-lite, support bazel and cmake simultaneously, which may increase the maintenance burden.

@Trinkle23897
Copy link
Collaborator

Trinkle23897 commented Aug 1, 2022

I see. This is definitely worth to do. Thanks for your valuable suggestions!

use envpool(built by bazel) in a cmake project.

It's possible. Currently opencv and sdl2 are built with cmake under bazel, see

@Trinkle23897 Trinkle23897 added the enhancement New feature or request label Aug 1, 2022
@walkacross
Copy link
Author

google-cloud-cpp might be in the same situation, here is their thinking, just for reference.
https://github.com/googleapis/google-cloud-cpp/blob/main/doc/contributor/working-with-bazel-and-cmake.md

@Trinkle23897 Trinkle23897 added documentation Improvements or additions to documentation and removed discussion labels Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants