nixpkgs/pkgs/development/libraries/xgboost/default.nix

45 lines
1.4 KiB
Nix
Raw Normal View History

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