2018-03-05 01:55:24 +00:00
|
|
|
{ stdenv, lib, fetchgit, cmake
|
|
|
|
, avxSupport ? false
|
|
|
|
, cudaSupport ? false, cudatoolkit
|
|
|
|
, ncclSupport ? false, nccl
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert ncclSupport -> cudaSupport;
|
2016-05-13 23:03:54 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "xgboost-${version}";
|
2018-03-05 01:55:24 +00:00
|
|
|
version = "0.7";
|
2016-05-13 23:03:54 +00:00
|
|
|
|
|
|
|
# needs submodules
|
|
|
|
src = fetchgit {
|
|
|
|
url = "https://github.com/dmlc/xgboost";
|
2016-08-13 00:09:01 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2018-03-05 01:55:24 +00:00
|
|
|
sha256 = "1wxh020l4q037hc5z7vgxflb70l41a97anl8g6y4wxb74l5zv61l";
|
2016-05-13 23:03:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2018-03-05 01:55:24 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
2016-05-13 23:03:54 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
2018-03-05 01:55:24 +00:00
|
|
|
cp -r ../include $out
|
|
|
|
install -Dm755 ../lib/libxgboost.so $out/lib/libxgboost.so
|
|
|
|
install -Dm755 ../xgboost $out/bin/xgboost
|
2016-05-13 23:03:54 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library";
|
2017-08-01 20:03:30 +00:00
|
|
|
homepage = https://github.com/dmlc/xgboost;
|
2016-05-13 23:38:12 +00:00
|
|
|
license = licenses.asl20;
|
2018-03-12 15:28:41 +00:00
|
|
|
platforms = [ "x86_64-linux" "i686-linux" ];
|
2016-05-13 23:03:54 +00:00
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
};
|
|
|
|
}
|