2021-05-20 23:08:51 +00:00
|
|
|
{ config
|
|
|
|
, stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, gtest
|
|
|
|
, doCheck ? true
|
|
|
|
, cudaSupport ? config.cudaSupport or false
|
|
|
|
, cudatoolkit
|
|
|
|
, ncclSupport ? false
|
|
|
|
, nccl
|
2020-04-24 23:36:52 +00:00
|
|
|
, llvmPackages
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert ncclSupport -> cudaSupport;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "xgboost";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "1.5.0";
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dmlc";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
fetchSubmodules = true;
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "sha256-xrRKpZ6NSBtEL2CBN7KggDwIvQKIPD8EBlA0oCJv8mw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.isDarwin llvmPackages.openmp;
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
buildInputs = [ gtest ] ++ lib.optional cudaSupport cudatoolkit
|
2020-04-24 23:36:52 +00:00
|
|
|
++ lib.optional ncclSupport nccl;
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
cmakeFlags = lib.optionals doCheck [ "-DGOOGLE_TEST=ON" ]
|
|
|
|
++ lib.optionals cudaSupport [ "-DUSE_CUDA=ON" "-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc" ]
|
|
|
|
++ lib.optionals ncclSupport [ "-DUSE_NCCL=ON" ];
|
|
|
|
|
|
|
|
inherit doCheck;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = let
|
|
|
|
libname = "libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
in ''
|
2021-05-20 23:08:51 +00:00
|
|
|
runHook preInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out
|
|
|
|
cp -r ../include $out
|
|
|
|
install -Dm755 ../lib/${libname} $out/lib/${libname}
|
|
|
|
install -Dm755 ../xgboost $out/bin/xgboost
|
2021-05-20 23:08:51 +00:00
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library";
|
|
|
|
homepage = "https://github.com/dmlc/xgboost";
|
|
|
|
license = licenses.asl20;
|
2021-05-20 23:08:51 +00:00
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
};
|
|
|
|
}
|