xgboost: 0.90 -> 1.4.1
This commit is contained in:
parent
e604994fc4
commit
cb21e3d5e4
|
@ -1,6 +1,14 @@
|
||||||
{ config, stdenv, lib, fetchgit, cmake
|
{ config
|
||||||
, cudaSupport ? config.cudaSupport or false, cudatoolkit
|
, stdenv
|
||||||
, ncclSupport ? false, nccl
|
, lib
|
||||||
|
, fetchFromGitHub
|
||||||
|
, cmake
|
||||||
|
, gtest
|
||||||
|
, doCheck ? true
|
||||||
|
, cudaSupport ? config.cudaSupport or false
|
||||||
|
, cudatoolkit
|
||||||
|
, ncclSupport ? false
|
||||||
|
, nccl
|
||||||
, llvmPackages
|
, llvmPackages
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
@ -8,37 +16,43 @@ assert ncclSupport -> cudaSupport;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "xgboost";
|
pname = "xgboost";
|
||||||
version = "0.90";
|
version = "1.4.1";
|
||||||
|
|
||||||
# needs submodules
|
src = fetchFromGitHub {
|
||||||
src = fetchgit {
|
owner = "dmlc";
|
||||||
url = "https://github.com/dmlc/xgboost";
|
repo = pname;
|
||||||
rev = "refs/tags/v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "1zs15k9crkiq7bnr4gqq53mkn3w8z9dq4nwlavmfcr5xr5gw2pw4";
|
fetchSubmodules = true;
|
||||||
|
sha256 = "12b1417dg8jqyxd72kg5a3xhg5h11vz0k7bkv72mzrv83jvgn5ci";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.isDarwin llvmPackages.openmp;
|
nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.isDarwin llvmPackages.openmp;
|
||||||
|
|
||||||
buildInputs = lib.optional cudaSupport cudatoolkit
|
buildInputs = [ gtest ] ++ lib.optional cudaSupport cudatoolkit
|
||||||
++ lib.optional ncclSupport nccl;
|
++ lib.optional ncclSupport nccl;
|
||||||
|
|
||||||
cmakeFlags = lib.optionals cudaSupport [ "-DUSE_CUDA=ON" "-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc" ]
|
cmakeFlags = lib.optionals doCheck [ "-DGOOGLE_TEST=ON" ]
|
||||||
++ lib.optional ncclSupport "-DUSE_NCCL=ON";
|
++ lib.optionals cudaSupport [ "-DUSE_CUDA=ON" "-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc" ]
|
||||||
|
++ lib.optionals ncclSupport [ "-DUSE_NCCL=ON" ];
|
||||||
|
|
||||||
|
inherit doCheck;
|
||||||
|
|
||||||
installPhase = let
|
installPhase = let
|
||||||
libname = "libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
|
libname = "libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
|
||||||
in ''
|
in ''
|
||||||
|
runHook preInstall
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp -r ../include $out
|
cp -r ../include $out
|
||||||
install -Dm755 ../lib/${libname} $out/lib/${libname}
|
install -Dm755 ../lib/${libname} $out/lib/${libname}
|
||||||
install -Dm755 ../xgboost $out/bin/xgboost
|
install -Dm755 ../xgboost $out/bin/xgboost
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library";
|
description = "Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library";
|
||||||
homepage = "https://github.com/dmlc/xgboost";
|
homepage = "https://github.com/dmlc/xgboost";
|
||||||
license = licenses.asl20;
|
license = licenses.asl20;
|
||||||
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
|
platforms = platforms.unix;
|
||||||
maintainers = with maintainers; [ abbradar ];
|
maintainers = with maintainers; [ abbradar ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ buildPythonPackage
|
{ buildPythonPackage
|
||||||
, pytest
|
, pytestCheckHook
|
||||||
, nose
|
, cmake
|
||||||
, scipy
|
, scipy
|
||||||
, scikitlearn
|
, scikitlearn
|
||||||
, stdenv
|
, stdenv
|
||||||
|
@ -10,28 +10,52 @@
|
||||||
, matplotlib
|
, matplotlib
|
||||||
, graphviz
|
, graphviz
|
||||||
, datatable
|
, datatable
|
||||||
|
, hypothesis
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildPythonPackage {
|
buildPythonPackage {
|
||||||
pname = "xgboost";
|
pname = "xgboost";
|
||||||
inherit (xgboost) version src meta;
|
inherit (xgboost) version src meta;
|
||||||
|
|
||||||
patches = [
|
nativeBuildInputs = [ cmake ];
|
||||||
(substituteAll {
|
buildInputs = [ xgboost ];
|
||||||
src = ./lib-path-for-python.patch;
|
propagatedBuildInputs = [ scipy ];
|
||||||
libpath = "${xgboost}/lib";
|
checkInputs = [
|
||||||
extention = stdenv.hostPlatform.extensions.sharedLibrary;
|
pytestCheckHook
|
||||||
})
|
scikitlearn
|
||||||
|
pandas
|
||||||
|
matplotlib
|
||||||
|
graphviz
|
||||||
|
datatable
|
||||||
|
hypothesis
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = "cd python-package";
|
# Override existing logic for locating libxgboost.so which is not appropriate for Nix
|
||||||
|
prePatch = let
|
||||||
propagatedBuildInputs = [ scipy ];
|
libPath = "${xgboost}/lib/libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
|
||||||
buildInputs = [ xgboost ];
|
in ''
|
||||||
checkInputs = [ nose pytest scikitlearn pandas matplotlib graphviz datatable ];
|
echo 'find_lib_path = lambda: ["${libPath}"]' > python-package/xgboost/libpath.py
|
||||||
|
|
||||||
checkPhase = ''
|
|
||||||
ln -sf ../demo .
|
|
||||||
nosetests ../tests/python
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
dontUseCmakeConfigure = true;
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
cd python-package
|
||||||
|
'';
|
||||||
|
|
||||||
|
preCheck = ''
|
||||||
|
ln -sf ../demo .
|
||||||
|
ln -s ${xgboost}/bin/xgboost ../xgboost
|
||||||
|
'';
|
||||||
|
|
||||||
|
pytestFlagsArray = ["../tests/python"];
|
||||||
|
disabledTestPaths = [
|
||||||
|
# Requires internet access: https://github.com/dmlc/xgboost/blob/03cd087da180b7dff21bd8ef34997bf747016025/tests/python/test_ranking.py#L81
|
||||||
|
"../tests/python/test_ranking.py"
|
||||||
|
];
|
||||||
|
disabledTests = [
|
||||||
|
"test_cli_binary_classification"
|
||||||
|
"test_model_compatibility"
|
||||||
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
diff --git a/python-package/xgboost/libpath.py b/python-package/xgboost/libpath.py
|
|
||||||
index d87922c0..859a30fb 100644
|
|
||||||
--- a/python-package/xgboost/libpath.py
|
|
||||||
+++ b/python-package/xgboost/libpath.py
|
|
||||||
@@ -19,32 +19,4 @@ def find_lib_path():
|
|
||||||
lib_path: list(string)
|
|
||||||
List of all found library path to xgboost
|
|
||||||
"""
|
|
||||||
- curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
|
|
||||||
- # make pythonpack hack: copy this directory one level upper for setup.py
|
|
||||||
- dll_path = [curr_path, os.path.join(curr_path, '../../lib/'),
|
|
||||||
- os.path.join(curr_path, './lib/'),
|
|
||||||
- os.path.join(sys.prefix, 'xgboost')]
|
|
||||||
- if sys.platform == 'win32':
|
|
||||||
- if platform.architecture()[0] == '64bit':
|
|
||||||
- dll_path.append(os.path.join(curr_path, '../../windows/x64/Release/'))
|
|
||||||
- # hack for pip installation when copy all parent source directory here
|
|
||||||
- dll_path.append(os.path.join(curr_path, './windows/x64/Release/'))
|
|
||||||
- else:
|
|
||||||
- dll_path.append(os.path.join(curr_path, '../../windows/Release/'))
|
|
||||||
- # hack for pip installation when copy all parent source directory here
|
|
||||||
- dll_path.append(os.path.join(curr_path, './windows/Release/'))
|
|
||||||
- dll_path = [os.path.join(p, 'xgboost.dll') for p in dll_path]
|
|
||||||
- elif sys.platform.startswith('linux') or sys.platform.startswith('freebsd'):
|
|
||||||
- dll_path = [os.path.join(p, 'libxgboost.so') for p in dll_path]
|
|
||||||
- elif sys.platform == 'darwin':
|
|
||||||
- dll_path = [os.path.join(p, 'libxgboost.dylib') for p in dll_path]
|
|
||||||
-
|
|
||||||
- lib_path = [p for p in dll_path if os.path.exists(p) and os.path.isfile(p)]
|
|
||||||
-
|
|
||||||
- # From github issues, most of installation errors come from machines w/o compilers
|
|
||||||
- if not lib_path and not os.environ.get('XGBOOST_BUILD_DOC', False):
|
|
||||||
- raise XGBoostLibraryNotFound(
|
|
||||||
- 'Cannot find XGBoost Library in the candidate path, ' +
|
|
||||||
- 'did you install compilers and run build.sh in root path?\n'
|
|
||||||
- 'List of candidates:\n' + ('\n'.join(dll_path)))
|
|
||||||
- return lib_path
|
|
||||||
+ return ["@libpath@/libxgboost@extention@"]
|
|
Loading…
Reference in a new issue