2019-02-03 18:32:12 +03:00
|
|
|
{ config, stdenv, lib, fetchgit, cmake
|
|
|
|
, cudaSupport ? config.cudaSupport or false, cudatoolkit
|
2018-03-05 04:55:24 +03:00
|
|
|
, ncclSupport ? false, nccl
|
2018-03-15 04:17:55 +03:00
|
|
|
, llvmPackages
|
2018-03-05 04:55:24 +03:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert ncclSupport -> cudaSupport;
|
2016-05-14 02:03:54 +03:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "xgboost-${version}";
|
2018-07-19 14:27:09 +03:00
|
|
|
version = "0.72";
|
2016-05-14 02:03:54 +03:00
|
|
|
|
|
|
|
# needs submodules
|
|
|
|
src = fetchgit {
|
|
|
|
url = "https://github.com/dmlc/xgboost";
|
2016-08-13 03:09:01 +03:00
|
|
|
rev = "refs/tags/v${version}";
|
2018-07-19 14:27:09 +03:00
|
|
|
sha256 = "1d4kw2jm7d12g8qwi7p9r3429y7sjks9xp9yhvfpx5jh7qakkxj6";
|
2016-05-14 02:03:54 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2018-03-15 04:17:55 +03:00
|
|
|
nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.isDarwin llvmPackages.openmp;
|
2018-03-05 04:55:24 +03: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 04:17:55 +03:00
|
|
|
installPhase = let
|
|
|
|
libname = if stdenv.isDarwin then "libxgboost.dylib" else "libxgboost.so";
|
|
|
|
in ''
|
2016-05-14 02:03:54 +03:00
|
|
|
mkdir -p $out
|
2018-03-05 04:55:24 +03:00
|
|
|
cp -r ../include $out
|
2018-03-15 04:17:55 +03:00
|
|
|
install -Dm755 ../lib/${libname} $out/lib/${libname}
|
2018-03-05 04:55:24 +03:00
|
|
|
install -Dm755 ../xgboost $out/bin/xgboost
|
2016-05-14 02:03:54 +03:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library";
|
2017-08-01 23:03:30 +03:00
|
|
|
homepage = https://github.com/dmlc/xgboost;
|
2016-05-14 02:38:12 +03:00
|
|
|
license = licenses.asl20;
|
2018-03-15 04:17:55 +03:00
|
|
|
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
|
2016-05-14 02:03:54 +03:00
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
};
|
|
|
|
}
|