Skip to content

Commit

Permalink
Merge pull request #20 from titsuki/use-1.7.6
Browse files Browse the repository at this point in the history
Use xgboost v1.7.6
  • Loading branch information
titsuki authored Aug 26, 2023
2 parents 05e57c1 + 8e9514d commit ee629c5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/Algorithm/XGBoost/CustomBuilder.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Algorithm::XGBoost::CustomBuilder:ver<0.0.5>:auth<cpan:TITSUKI> is Distrib
{ module => "Zef::Service::Shell::curl" },
];
my $fetcher = Zef::Fetch.new(:backends(@fetch-backends));
my $uri = 'https://github.com/dmlc/xgboost/releases/download/v1.4.2/xgboost.tar.gz';
my $uri = 'https://github.com/dmlc/xgboost/releases/download/v1.7.6/xgboost.tar.gz';
my $archive-file = "xgboost.tar.gz".IO.e
?? "xgboost.tar.gz"
!! $fetcher.fetch(Candidate.new(:$uri), "xgboost.tar.gz");
Expand All @@ -47,7 +47,12 @@ class Algorithm::XGBoost::CustomBuilder:ver<0.0.5>:auth<cpan:TITSUKI> is Distrib
my $archive-file-with-cwd = $*CWD.add($archive-file);
my $extract-dir = $extractor.extract(Candidate.new(:uri($archive-file-with-cwd)), $*CWD);
chdir("xgboost");
when self!is-osx { shell("brew install libomp && cmake . && make") }
when self!is-osx {
my $fh = open :w, "./cmake/xgboost-config.cmake.in";
$fh.say: "../../misc/xgboost-config.cmake.in".IO.slurp;
$fh.close;
shell("brew install libomp && cmake . && make")
}
when self!is-linux { shell("cmake . && make") }
}
method !is-osx(--> Bool) { shell("uname", :out).out.slurp.trim.lc eq "darwin" }
Expand Down
28 changes: 28 additions & 0 deletions misc/xgboost-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@PACKAGE_INIT@

set(USE_OPENMP @USE_OPENMP@)
set(USE_CUDA @USE_CUDA@)
set(USE_NCCL @USE_NCCL@)
set(XGBOOST_BUILD_STATIC_LIB @BUILD_STATIC_LIB@)

include(CMakeFindDependencyMacro)

if (XGBOOST_BUILD_STATIC_LIB)
find_dependency(Threads)
if(USE_OPENMP)
find_dependency(OpenMP)
endif()
if(OpenMP_CXX_FOUND)
target_link_libraries(MyTarget PUBLIC OpenMP::OpenMP_CXX)
endif()
if(USE_CUDA)
find_dependency(CUDA)
endif()
# nccl should be linked statically if xgboost is built as static library.
endif (XGBOOST_BUILD_STATIC_LIB)

if(NOT TARGET xgboost::xgboost)
include(${CMAKE_CURRENT_LIST_DIR}/XGBoostTargets.cmake)
endif()

message(STATUS "Found XGBoost (found version \"${xgboost_VERSION}\")")

0 comments on commit ee629c5

Please sign in to comment.