2021-05-08 19:17:56 +00:00
|
|
|
{ config
|
|
|
|
, stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, gtest
|
|
|
|
, doCheck ? true
|
|
|
|
, cudaSupport ? config.cudaSupport or false
|
|
|
|
, cudatoolkit
|
|
|
|
, ncclSupport ? false
|
|
|
|
, nccl
|
2018-03-15 01:17:55 +00:00
|
|
|
, llvmPackages
|
2018-03-05 01:55:24 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert ncclSupport -> cudaSupport;
|
2016-05-13 23:03:54 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "xgboost";
|
2021-10-28 05:20:57 +00:00
|
|
|
version = "1.5.0";
|
2021-05-08 19:17:56 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dmlc";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
fetchSubmodules = true;
|
2021-10-28 05:20:57 +00:00
|
|
|
sha256 = "sha256-xrRKpZ6NSBtEL2CBN7KggDwIvQKIPD8EBlA0oCJv8mw=";
|
2016-05-13 23:03:54 +00:00
|
|
|
};
|
|
|
|
|
2018-03-15 01:17:55 +00:00
|
|
|
nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.isDarwin llvmPackages.openmp;
|
2018-03-05 01:55:24 +00:00
|
|
|
|
2021-05-08 19:17:56 +00:00
|
|
|
buildInputs = [ gtest ] ++ lib.optional cudaSupport cudatoolkit
|
2018-03-05 01:55:24 +00:00
|
|
|
++ lib.optional ncclSupport nccl;
|
|
|
|
|
2021-05-08 19:17:56 +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;
|
2018-03-05 01:55:24 +00:00
|
|
|
|
2018-03-15 01:17:55 +00:00
|
|
|
installPhase = let
|
2019-06-15 08:42:19 +00:00
|
|
|
libname = "libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
|
2018-03-15 01:17:55 +00:00
|
|
|
in ''
|
2021-05-08 19:17:56 +00:00
|
|
|
runHook preInstall
|
2016-05-13 23:03:54 +00:00
|
|
|
mkdir -p $out
|
2018-03-05 01:55:24 +00:00
|
|
|
cp -r ../include $out
|
2018-03-15 01:17:55 +00:00
|
|
|
install -Dm755 ../lib/${libname} $out/lib/${libname}
|
2018-03-05 01:55:24 +00:00
|
|
|
install -Dm755 ../xgboost $out/bin/xgboost
|
2021-05-08 19:17:56 +00:00
|
|
|
runHook postInstall
|
2016-05-13 23:03:54 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2016-05-13 23:03:54 +00:00
|
|
|
description = "Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/dmlc/xgboost";
|
2016-05-13 23:38:12 +00:00
|
|
|
license = licenses.asl20;
|
2021-05-08 19:17:56 +00:00
|
|
|
platforms = platforms.unix;
|
2016-05-13 23:03:54 +00:00
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
};
|
|
|
|
}
|