mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-18 02:05:51 +03:00
lightgbm: 3.3.5 -> 4.1.0
This commit is contained in:
parent
247432f9c3
commit
90fcaf79ee
@ -1,6 +1,8 @@
|
|||||||
{ config, stdenv, lib, fetchFromGitHub, cmake, gtest, doCheck ? true
|
{ config, stdenv, lib, fetchFromGitHub, cmake, gtest, doCheck ? true
|
||||||
, cudaSupport ? config.cudaSupport, openclSupport ? false, mpiSupport ? false, javaWrapper ? false, hdfsSupport ? false
|
, cudaSupport ? config.cudaSupport or false, openclSupport ? false
|
||||||
, rLibrary ? false, cudaPackages, opencl-headers, ocl-icd, boost, llvmPackages, openmpi, openjdk, swig, hadoop, R, rPackages }:
|
, mpiSupport ? false, javaWrapper ? false, hdfsSupport ? false, pythonLibrary ? false
|
||||||
|
, rLibrary ? false, cudaPackages, opencl-headers, ocl-icd, boost
|
||||||
|
, llvmPackages, openmpi, openjdk, swig, hadoop, R, rPackages, pandoc }:
|
||||||
|
|
||||||
assert doCheck -> mpiSupport != true;
|
assert doCheck -> mpiSupport != true;
|
||||||
assert openclSupport -> cudaSupport != true;
|
assert openclSupport -> cudaSupport != true;
|
||||||
@ -21,14 +23,14 @@ stdenv.mkDerivation rec {
|
|||||||
# in \
|
# in \
|
||||||
# rWrapper.override{ packages = [ lgbm ]; }"
|
# rWrapper.override{ packages = [ lgbm ]; }"
|
||||||
pname = lib.optionalString rLibrary "r-" + pnameBase;
|
pname = lib.optionalString rLibrary "r-" + pnameBase;
|
||||||
version = "3.3.5";
|
version = "4.1.0";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "microsoft";
|
owner = "microsoft";
|
||||||
repo = pnameBase;
|
repo = pnameBase;
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
hash = "sha256-QRuBbMVtD5J5ECw+bAp57bWaRc/fATMcTq+AKikhj1I=";
|
hash = "sha256-AhXe/Mlor/i0y84wI9jVPKSnyVbSyAV52Y4yiNm7yLQ=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ]
|
nativeBuildInputs = [ cmake ]
|
||||||
@ -38,13 +40,14 @@ stdenv.mkDerivation rec {
|
|||||||
++ lib.optionals hdfsSupport [ hadoop ]
|
++ lib.optionals hdfsSupport [ hadoop ]
|
||||||
++ lib.optionals (hdfsSupport || javaWrapper) [ openjdk ]
|
++ lib.optionals (hdfsSupport || javaWrapper) [ openjdk ]
|
||||||
++ lib.optionals javaWrapper [ swig ]
|
++ lib.optionals javaWrapper [ swig ]
|
||||||
++ lib.optionals rLibrary [ R ];
|
++ lib.optionals rLibrary [ R pandoc ];
|
||||||
|
|
||||||
buildInputs = [ gtest ]
|
buildInputs = [ gtest ]
|
||||||
++ lib.optional cudaSupport cudaPackages.cudatoolkit;
|
++ lib.optional cudaSupport cudaPackages.cudatoolkit;
|
||||||
|
|
||||||
propagatedBuildInputs = lib.optionals rLibrary [
|
propagatedBuildInputs = lib.optionals rLibrary [
|
||||||
rPackages.data_table
|
rPackages.data_table
|
||||||
|
rPackages.rmarkdown
|
||||||
rPackages.jsonlite
|
rPackages.jsonlite
|
||||||
rPackages.Matrix
|
rPackages.Matrix
|
||||||
rPackages.R6
|
rPackages.R6
|
||||||
@ -62,6 +65,7 @@ stdenv.mkDerivation rec {
|
|||||||
external_libs/compute/include/boost/compute/cl_ext.hpp \
|
external_libs/compute/include/boost/compute/cl_ext.hpp \
|
||||||
--replace "include <OpenCL/" "include <CL/"
|
--replace "include <OpenCL/" "include <CL/"
|
||||||
substituteInPlace build_r.R \
|
substituteInPlace build_r.R \
|
||||||
|
--replace "shQuote(normalizePath" "shQuote(type = 'cmd', string = normalizePath" \
|
||||||
--replace "file.path(getwd(), \"lightgbm_r\")" "'$out/tmp'" \
|
--replace "file.path(getwd(), \"lightgbm_r\")" "'$out/tmp'" \
|
||||||
--replace \
|
--replace \
|
||||||
"install_args <- c(\"CMD\", \"INSTALL\", \"--no-multiarch\", \"--with-keep.source\", tarball)" \
|
"install_args <- c(\"CMD\", \"INSTALL\", \"--no-multiarch\", \"--with-keep.source\", tarball)" \
|
||||||
@ -74,10 +78,14 @@ stdenv.mkDerivation rec {
|
|||||||
++ lib.optionals mpiSupport [ "-DUSE_MPI=ON" ]
|
++ lib.optionals mpiSupport [ "-DUSE_MPI=ON" ]
|
||||||
++ lib.optionals hdfsSupport [
|
++ lib.optionals hdfsSupport [
|
||||||
"-DUSE_HDFS=ON"
|
"-DUSE_HDFS=ON"
|
||||||
"-DHDFS_LIB=${hadoop}/lib/hadoop-3.3.1/lib/native/libhdfs.so"
|
"-DHDFS_LIB=${hadoop}/lib/hadoop-${hadoop.version}/lib/native/libhdfs.so"
|
||||||
"-DHDFS_INCLUDE_DIR=${hadoop}/lib/hadoop-3.3.1/include" ]
|
"-DHDFS_INCLUDE_DIR=${hadoop}/lib/hadoop-${hadoop.version}/include" ]
|
||||||
++ lib.optionals javaWrapper [ "-DUSE_SWIG=ON" ]
|
++ lib.optionals javaWrapper [
|
||||||
++ lib.optionals rLibrary [ "-D__BUILD_FOR_R=ON" ];
|
"-DUSE_SWIG=ON"
|
||||||
|
# RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
|
||||||
|
"-DCMAKE_SKIP_BUILD_RPATH=ON" ]
|
||||||
|
++ lib.optionals rLibrary [ "-D__BUILD_FOR_R=ON" ]
|
||||||
|
++ lib.optionals pythonLibrary [ "-D__BUILD_FOR_PYTHON=ON" ];
|
||||||
|
|
||||||
configurePhase = lib.optionals rLibrary ''
|
configurePhase = lib.optionals rLibrary ''
|
||||||
export R_LIBS_SITE="$out/library:$R_LIBS_SITE''${R_LIBS_SITE:+:}"
|
export R_LIBS_SITE="$out/library:$R_LIBS_SITE''${R_LIBS_SITE:+:}"
|
||||||
@ -98,28 +106,28 @@ stdenv.mkDerivation rec {
|
|||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp -r ../include $out
|
cp -r ../include $out
|
||||||
install -Dm755 ../lib_lightgbm.so $out/lib/lib_lightgbm.so
|
install -Dm755 ../lib_lightgbm.so $out/lib/lib_lightgbm.so
|
||||||
|
'' + lib.optionalString (!rLibrary && !pythonLibrary) ''
|
||||||
install -Dm755 ../lightgbm $out/bin/lightgbm
|
install -Dm755 ../lightgbm $out/bin/lightgbm
|
||||||
'' + lib.optionalString javaWrapper ''
|
'' + lib.optionalString javaWrapper ''
|
||||||
cp -r java $out
|
cp -r java $out
|
||||||
cp -r com $out
|
cp -r com $out
|
||||||
cp -r lightgbmlib.jar $out
|
cp -r lightgbmlib.jar $out
|
||||||
'' + ''
|
'' + ''
|
||||||
'' + lib.optionalString javaWrapper ''
|
|
||||||
cp -r java $out
|
|
||||||
cp -r com $out
|
|
||||||
cp -r lightgbmlib.jar $out
|
|
||||||
'' + lib.optionalString rLibrary ''
|
'' + lib.optionalString rLibrary ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
mkdir $out/tmp
|
mkdir $out/tmp
|
||||||
mkdir $out/library
|
mkdir $out/library
|
||||||
mkdir $out/library/lightgbm
|
mkdir $out/library/lightgbm
|
||||||
'' + lib.optionalString (rLibrary && (!openclSupport)) ''
|
'' + lib.optionalString (rLibrary && (!openclSupport)) ''
|
||||||
Rscript build_r.R
|
Rscript build_r.R \
|
||||||
|
-j$NIX_BUILD_CORES
|
||||||
rm -rf $out/tmp
|
rm -rf $out/tmp
|
||||||
'' + lib.optionalString (rLibrary && openclSupport) ''
|
'' + lib.optionalString (rLibrary && openclSupport) ''
|
||||||
Rscript build_r.R --use-gpu \
|
Rscript build_r.R --use-gpu \
|
||||||
--opencl-library=${ocl-icd}/lib/libOpenCL.so \
|
--opencl-library=${ocl-icd}/lib/libOpenCL.so \
|
||||||
--boost-librarydir=${boost}
|
--opencl-include-dir=${opencl-headers}/include \
|
||||||
|
--boost-librarydir=${boost} \
|
||||||
|
-j$NIX_BUILD_CORES
|
||||||
rm -rf $out/tmp
|
rm -rf $out/tmp
|
||||||
'' + ''
|
'' + ''
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
|
Loading…
Reference in New Issue
Block a user