2019-02-03 16:32:12 +01:00
|
|
|
{ config, stdenv, lib, fetchgit, cmake
|
|
|
|
, cudaSupport ? config.cudaSupport or false, cudatoolkit
|
2018-03-05 02:55:24 +01:00
|
|
|
, ncclSupport ? false, nccl
|
2018-03-15 02:17:55 +01:00
|
|
|
, llvmPackages
|
2018-03-05 02:55:24 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert ncclSupport -> cudaSupport;
|
2016-05-14 01:03:54 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "xgboost-${version}";
|
2019-06-03 17:18:03 +02:00
|
|
|
version = "0.90";
|
2016-05-14 01:03:54 +02:00
|
|
|
|
|
|
|
# needs submodules
|
|
|
|
src = fetchgit {
|
|
|
|
url = "https://github.com/dmlc/xgboost";
|
2016-08-13 02:09:01 +02:00
|
|
|
rev = "refs/tags/v${version}";
|
2019-06-03 17:18:03 +02:00
|
|
|
sha256 = "1zs15k9crkiq7bnr4gqq53mkn3w8z9dq4nwlavmfcr5xr5gw2pw4";
|
2016-05-14 01:03:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2018-03-15 02:17:55 +01:00
|
|
|
nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.isDarwin llvmPackages.openmp;
|
2018-03-05 02:55:24 +01:00
|
|
|
|
|
|
|
buildInputs = lib.optional cudaSupport cudatoolkit
|
|
|
|
++ lib.optional ncclSupport nccl;
|
|
|
|
|
|
|
|
cmakeFlags = lib.optionals cudaSupport [ "-DUSE_CUDA=ON" "-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc" ]
|
|
|
|
++ lib.optional ncclSupport "-DUSE_NCCL=ON";
|
|
|
|
|
2018-03-15 02:17:55 +01:00
|
|
|
installPhase = let
|
2019-06-15 10:42:19 +02:00
|
|
|
libname = "libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
|
2018-03-15 02:17:55 +01:00
|
|
|
in ''
|
2016-05-14 01:03:54 +02:00
|
|
|
mkdir -p $out
|
2018-03-05 02:55:24 +01:00
|
|
|
cp -r ../include $out
|
2018-03-15 02:17:55 +01:00
|
|
|
install -Dm755 ../lib/${libname} $out/lib/${libname}
|
2018-03-05 02:55:24 +01:00
|
|
|
install -Dm755 ../xgboost $out/bin/xgboost
|
2016-05-14 01:03:54 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library";
|
2017-08-01 22:03:30 +02:00
|
|
|
homepage = https://github.com/dmlc/xgboost;
|
2016-05-14 01:38:12 +02:00
|
|
|
license = licenses.asl20;
|
2018-03-15 02:17:55 +01:00
|
|
|
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
|
2016-05-14 01:03:54 +02:00
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
};
|
|
|
|
}
|