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

xgboost 1.0.0 #50467

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Formula/xgboost.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class Xgboost < Formula
desc "Scalable, Portable and Distributed Gradient Boosting Library"
homepage "https://xgboost.ai/"
url "https://github.com/dmlc/xgboost.git",
:tag => "v0.90",
:revision => "515f5f5c4779ff5361dcd796e22d55937e1048ea"
:tag => "v1.0.0",
:revision => "d90e7b31170b86f97eafb6b9b64027abb6881a3e"

bottle do
cellar :any
Expand All @@ -13,10 +13,19 @@ class Xgboost < Formula
end

depends_on "cmake" => :build
depends_on "libomp"
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on my currently incomplete understanding of how Homebrew, OpenMP and formulae all interact, I think this formula should be compiled with GCC, and pull in GCCs native libgomp. Here is the relative text from a discussion among maintainers that I feel pretty OK/confident is correct:

The current stand on OpenMP is: use Apple’s clang + libomp (which is a hack) only for standalone formulas that strongly benefit from OpenMP and do not expose this to dependents (good example being imagemagick).

So if we take that as truth I think you need to do:

Suggested change
depends_on "libomp"
depends_on "gcc"
fails_with :clang # because this is an OpenMP enabled library like OpenBLAS


def install
mkdir "build" do
system "cmake", *std_cmake_args, "-DUSE_OPENMP=0", ".."
libomp = Formula["libomp"]
args = std_cmake_args
args << "-DOpenMP_C_FLAGS=\"-Xpreprocessor -fopenmp -I#{libomp.opt_include}\""
args << "-DOpenMP_C_LIB_NAMES=omp"
args << "-DOpenMP_CXX_FLAGS=\"-Xpreprocessor -fopenmp -I#{libomp.opt_include}\""
args << "-DOpenMP_CXX_LIB_NAMES=omp"
args << "-DOpenMP_omp_LIBRARY=#{libomp.opt_lib}/libomp.dylib"
Copy link
Contributor

Choose a reason for hiding this comment

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

Double check this, but if you make the changes I proposed above to enable OpenMP and in a manner such that it is consumable by other packages CMake should default to using gcc-9, g++-9 and pull in libgomp. You can run brew linkage xgboost locally after compiling to see what libraries are getting linked. You should see something like the output of running that command on OpenBLAS:

$ brew linkage openblas
System libraries:
  /usr/lib/libSystem.B.dylib
Homebrew libraries:
  /usr/local/opt/gcc/lib/gcc/9/libgfortran.5.dylib (gcc)
  /usr/local/opt/gcc/lib/gcc/9/libgomp.1.dylib (gcc)
  /usr/local/opt/gcc/lib/gcc/9/libquadmath.0.dylib (gcc)
Missing libraries:
  /usr/local/lib/gcc/9/libgcc_s.1.dylib


system "cmake", *args, ".."
system "make"
system "make", "install"
end
Expand Down