xgboost: OpenMP detection is still broken on MacOS
Despite an earlier PR claiming to fix it: https://github.com/dmlc/xgboost/pull/8684 It is still broken, at least with GCC:
checking whether OpenMP will work in a package... no
*****************************************************************************************
OpenMP is unavailable on this Mac OSX system. Training speed may be suboptimal.
To use all CPU cores for training jobs, you should install OpenMP by running\n
brew install libomp
Moreover, it gives a wrong recommendation (libomp is Clang-specific).
P. S. IMO it is a bad wording to use βshouldβ for an optional package manager. One does not need any β libomp, while not needed at all with GCC, can be installed directly. Also, there is Macports which has it, not just Homebrew.
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 26 (10 by maintainers)
@hcho3 @jameslamb I recently learned that thereβs an openmp macro in autotools
AC_OPENMP. I have tested it works well on Linux (Ubuntu + gcc-11.4), not sure if it can be useful for simplifying the logic.Regarding the static assert, we can change
size_ttouint64_t. The former is implementation defined while the later is standardized. No worries there, we can fix it.Ah, thank you for sharing.
Thank you for working on this!
@hcho3 would be great if you can have a look when you are available. π
Iβm not sure if we can fix it though, or if the fix is worth the effort. None of us have access to such device, itβs very likely that the next commit will just break it, especially now that xgboost is using c+Β±17 (CRAN is using c+Β±17 by default as well, AFAIK).
Thank you for looking into this. Out of curiosity, is mac ppc still available?
UPD. Tests mostly pass, there is one failure on
ppc32, which is a known problem, though it is not immediately obvious how to fix it in this case (mallocerrors usually happen with executables; those are caused by duplicatelibstdc++in older macOS with modern GCC installed):I will look into this a bit more. In most cases these are fixable. (It was quite bad initially due to
Ritself, but I have fixed it, now they almost never show up withRpackages.)P. S. This is without OpenMP, but it is inconsequential for the issue.
@barracuda156 Thanks for raising the issue. As you noticed, currently XGBoost has only been tested with the Apple Clang + Homebrew combination. It will be great if you can make it work with Macports.
Thank you for raising an issue! As suggested by @jameslamb , would be great if you can submit a fix, your expertise in this area is really appreciated.
@jameslamb Thank you for responding! I am interested to have this fixed so that we can have
xgboostforRin Macports. Allow me a day, perhaps, I need to make sure build is fixed (which includes 32-bit) and tests pass, and then figure out how to amend OpenMP checks so that they work for a) GCC and Clang and b) Homebrew and Macports cases.Thanks for tagging me and for the additional details. Are you interested in using your knowledge of this area to improve the project by opening a pull request? If not @trivialfis Iβd be happy to look into this in a few days.