Skip to content

Commit

Permalink
python3Packages.lightgbm: add GPU support
Browse files Browse the repository at this point in the history
  • Loading branch information
illustris committed Apr 2, 2023
1 parent c1329a1 commit 5fbdef5
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions pkgs/development/python-modules/lightgbm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
, scikit-learn
, llvmPackages ? null
, pythonOlder
, python
, ocl-icd
, opencl-headers
, boost
, gpuSupport ? true
}:

buildPythonPackage rec {
Expand All @@ -28,16 +33,24 @@ buildPythonPackage rec {

dontUseCmakeConfigure = true;

buildInputs = lib.optionals stdenv.cc.isClang [
buildInputs = (lib.optionals stdenv.cc.isClang [
llvmPackages.openmp
];
]) ++ (lib.optionals gpuSupport [
boost
ocl-icd
opencl-headers
]);

propagatedBuildInputs = [
numpy
scipy
scikit-learn
];

buildPhase = ''
${python.pythonForBuild.interpreter} setup.py bdist_wheel ${lib.optionalString gpuSupport "--gpu"}
'';

postConfigure = ''
export HOME=$(mktemp -d)
'';
Expand All @@ -51,11 +64,11 @@ buildPythonPackage rec {
"lightgbm"
];

meta = with lib; {
meta = {
description = "A fast, distributed, high performance gradient boosting (GBDT, GBRT, GBM or MART) framework";
homepage = "https://github.com/Microsoft/LightGBM";
changelog = "https://github.com/microsoft/LightGBM/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ teh costrouc ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ teh costrouc ];
};
}

0 comments on commit 5fbdef5

Please sign in to comment.