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

59 lines
1.5 KiB
Nix
Raw Normal View History

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
, llvmPackages
}:
assert ncclSupport -> cudaSupport;
2016-05-13 23:03:54 +00:00
stdenv.mkDerivation rec {
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
};
nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.isDarwin llvmPackages.openmp;
2021-05-08 19:17:56 +00:00
buildInputs = [ gtest ] ++ lib.optional cudaSupport cudatoolkit
++ 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;
installPhase = let
libname = "libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
in ''
2021-05-08 19:17:56 +00:00
runHook preInstall
2016-05-13 23:03:54 +00:00
mkdir -p $out
cp -r ../include $out
install -Dm755 ../lib/${libname} $out/lib/${libname}
install -Dm755 ../xgboost $out/bin/xgboost
2021-05-08 19:17:56 +00:00
runHook postInstall
2016-05-13 23:03:54 +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";
homepage = "https://github.com/dmlc/xgboost";
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 ];
};
}