-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Move management of calls of "cmake --build" to setup_helper/cmake.py and refactor as a CMake class #21493
Conversation
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.
Sorry for the late review. I didn't get why do we need this refactor? Could you explain this a little bit?
Yeah, it would be really helpful to know the motivation behind the refactor. I personally think that one of our big antipatterns is how long our cmake invocations are; we really should strive to have as few arguments to cmake as possible (and not make it easier to add more and more arguments.) |
The purpose of this PR is a step toward better integration of the Python setup scripts and CMake. Ultimately, I would like to allow build options to be directly specified using options specified in CMakeLists.txt (without explicitly being processed in Python setup scripts), allow users to adjust build options directly via cmake-gui/ccmake/editing CMakeCache.txt (currently users must take care of both options in CMakeCache.txt and environmental variables passed to setup.py and ensure they are consistent upon rebuild), and remove a lot of system and library environment checks in Python setup scripts while CMake can already handle them pretty well. This PR makes it easier to manage CMake related code in Python setup scripts and paves a path towards these objectives. A well structured code base is important, because the next step is probably to look at one build option at a time PyTorch currently explicitly supports in setup.py. @ezyang I agree with you that there are many issues with current cmake invocation. The objective I described above subsumes many cmake invocation issues, because only what users have specified will be sent to CMake as arguments. |
@ezyang I should also stress that to address the long CMake invocation argument list, as stated above, I have to look into each build option one at a time. I would focus on those once we have some basic structure in Python setup scripts better organized. |
15d46b9
to
ae57b23
Compare
ae57b23
to
4d03d9c
Compare
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.
LGTM, waiting for @ezyang's response
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.
OK sure.
Things that you don't have to do this PR, but to think about for the future as you keep working on this code (a lot of these are preexisting conditions): Python nits:
General design thoughts:
|
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.
@ezyang is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@ezyang Thanks! Will keep these in mind. |
No description provided.