-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Refactor CMake scripts. #4323
Refactor CMake scripts. #4323
Conversation
@RAMitchell Thanks for the suggestion, I added your workaround for dmlc registrations. But the added |
Hi, it could install the python package in a dir relative to CMAKE_INSTALL_PREFIX (lib/pythonx.y/site-packages on unix and Lib/site-packages on win32). |
@jschueller That would be part of Python setuptools. I don't think CMake is the right tool to install Python package. |
Correct me if I'm wrong but it seems the python bindings is just made of a bunch of .py files, I guess cmake could copy them to the site dir. |
@jschueller setuptools does a lot more than copying scripts. It helps compile Python scripts into bytecodes, creates a Packages and handles its dependencies. |
@hcho3 Related to #4331. I bumped CMake to 3.8 but another attempt by @RAMitchell uses 3.9, see #4316. I'm not sure this PR will work out smoothly as you can see from the tests, my build failed in various ways depending on different platforms, while built perfectly on my machine. I believe there are lots of different bugs from different platforms. So please don't put too much weight on this PR for now, I'm not sure I can workaround all of them. It's a miracle that our machine works at all ... |
@trivialfis Okay, in that case, should we keep the current CMake version (3.6.0) for now? |
@hcho3 Yep, thanks. I will upgrade it when it's done. |
List of known issues in CMake CUDA lang:
List of other known issues:
Checked item means I can workaround it. |
As mentioned by @RAMitchell and @hcho3, I should write a short introduction about rationale about this rewrite. Here it's. ;-) Goaltl;dr: Enable C APIs with easy to use build system interface:
The above two lines should get include path and linking done. Why does it take a rewrite to accomplish thisThere's a trend about Modern CMake, where one specify build options target by target. The extra effort is not only to make the code look nicer, but a fundamental requirement for making a usable shared library. Since we are building C APIs, user of the interface should not know anything about what libraries xgboost needs, what extra flags are required to build a project with xgboost, nor the CXX standard we use. For instance, users of xgboost should not need to pass With What problems this won't solveSymbols visibility. For a shared library, providing restricted but stable ABI is important for easy distribution. In some cases one would pass flags like Extras
|
@RAMitchell Could you take a look at the above known issues? I felt like there are too many things to work around ... |
@trivialfis Can we just use a recent version of CMake to avoid known issues? Personally, I'd like to see parallel compilation enabled for Windows. |
@hcho3 Currently I build it with CMake 3.12, which ships with Ubuntu 18.10. Do you think it's a little too aggressive? @RAMitchell |
Currently it's the last item
I can't work around. I don't know how to link CUDA runtime manually. Another way to do it might be using static library with PIC for libxgboost at first then convert it into shared library later .. But it's getting more and more weird. |
@trivialfis I'm okay with using CMake 3.12 for CUDA code. |
@trivialfis I am ok with requiring cmake 3.12. I don't have any experience with your particular issue linking the run-time, but in the past I have built the project by combining GPU code into a static library and linking this into the xgboost shared library. This was a workaround for linking issues due to dmlc register, at the time I could not make it work using object libraries. |
b26627e
to
720d947
Compare
f26268c
to
df7b3e7
Compare
* Remove CMake CUDA wrapper. * Bump CMake version for CUDA. * Use CMake to handle Doxygen. * Split up CMakeList. * Export install target. * Use modern CMake. * Remove build.sh * Workaround for gpu_hist test. * Use cmake 3.12.
eba8bac
to
1a7718d
Compare
@hcho3 @RAMitchell Ready for another review. The build system is quite huge by now, CMake has its limitation. If you find anything that is not clear or over complicated in the code, please let me know. I don't want anyone get stumbled by the build system. |
Codecov Report
@@ Coverage Diff @@
## master #4323 +/- ##
==========================================
+ Coverage 67.92% 67.93% +<.01%
==========================================
Files 132 132
Lines 12240 12240
==========================================
+ Hits 8314 8315 +1
+ Misses 3926 3925 -1
Continue to review full report at Codecov.
|
Added a short intro in |
@RAMitchell Would you be able to try it on Windows with CUDA when time allows? |
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.
Looks good to me, although I cannot speak for the JVM or R packages.
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.
Approving for now, but we may want to add GPU test for R in the future.
Ping @CodingCat |
Thanks for all the help! |
TODOs: