From patchwork Tue Jun 1 22:06:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Monego X-Patchwork-Id: 29790 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1B12D27BC81; Tue, 1 Jun 2021 23:08:12 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 512F427BC78 for ; Tue, 1 Jun 2021 23:08:11 +0100 (BST) Received: from localhost ([::1]:37664 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1loCYU-00019d-Fd for patchwork@mira.cbaines.net; Tue, 01 Jun 2021 18:08:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loCYM-00018x-Q9 for guix-patches@gnu.org; Tue, 01 Jun 2021 18:08:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54812) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1loCYM-00010y-Ii for guix-patches@gnu.org; Tue, 01 Jun 2021 18:08:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1loCYM-0003RC-Ed for guix-patches@gnu.org; Tue, 01 Jun 2021 18:08:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48785] [PATCH 2/3] gnu: lightgbm: Update to 3.2.1. Resent-From: Vinicius Monego Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 01 Jun 2021 22:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48785 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48785@debbugs.gnu.org Cc: Vinicius Monego Received: via spool by 48785-submit@debbugs.gnu.org id=B48785.162258524213151 (code B ref 48785); Tue, 01 Jun 2021 22:08:02 +0000 Received: (at 48785) by debbugs.gnu.org; 1 Jun 2021 22:07:22 +0000 Received: from localhost ([127.0.0.1]:38121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loCXc-0003Pr-HL for submit@debbugs.gnu.org; Tue, 01 Jun 2021 18:07:21 -0400 Received: from mout01.posteo.de ([185.67.36.65]:34521) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loCXZ-0003PV-Ug for 48785@debbugs.gnu.org; Tue, 01 Jun 2021 18:07:14 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 0284B240026 for <48785@debbugs.gnu.org>; Wed, 2 Jun 2021 00:07:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1622585228; bh=kfPVRjbE42c/fOVdk4jSsXTh9dqDP8JE9rid5U8OSCQ=; h=From:To:Cc:Subject:Date:From; b=ULJpe+H2rwmD+rPAY/MjUskX6dzkeyZUJlgbWinnA6rUv9kydppZTVw4rs0anXzCR +J/pS8XgpVPb9aXkgR1PlUMiaIy1dRks2y0N0NJXPbZxdWqBixxxtk4VNnJuZAdNOY RcRZ2RndFhGAjwUG0S2Q1RdLWt1TXIQqeB7JKm3zqC27NlCYByDo1CmWnGHNnX8aTw HBoU+CRH+SAS0ygi3kzdabkn29X4YnoSkcLm+IStVgtnVDcuGir3604Hsx51wA90Eu 4iEs83auUAQmpU8bABoQaBl6mgsIb7dIiGZXR+u4rMTPvi1+2VKye9LRQCi5R+43pK 7FS0E2cN5wcUw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FvmV24C1Sz6tmQ; Wed, 2 Jun 2021 00:07:06 +0200 (CEST) From: Vinicius Monego Date: Tue, 1 Jun 2021 22:06:42 +0000 Message-Id: <20210601220643.78439-2-monego@posteo.net> In-Reply-To: <20210601220643.78439-1-monego@posteo.net> References: <20210601220643.78439-1-monego@posteo.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/machine-learning.scm (lightgbm): Update to 3.2.1. [source]: Add patches. [native-inputs]: Add googletest, opencl-headers. [inputs]: Add boost, eigen, fast-double-parser, fmt, ocl-icd. [propagated-inputs]: Remove. [arguments]: Add #:tests?, #:test-target. Pass "-DBUILD_CPP_TEST=OFF" and "-DUSE_GPU=ON" to #:configure-flags. Do not replace check phase. * gnu/packages/patches/lightgbm-use-system-libraries.patch, gnu/packages/patches/lightgbm-python-use-system-lib-lightgbm.patch: New files. * gnu/local.mk (dist_PATCH_DATA): Add them. --- gnu/local.mk | 2 + gnu/packages/machine-learning.scm | 57 ++++++++------ ...htgbm-python-use-system-lib-lightgbm.patch | 74 +++++++++++++++++++ .../lightgbm-use-system-libraries.patch | 58 +++++++++++++++ 4 files changed, 167 insertions(+), 24 deletions(-) create mode 100644 gnu/packages/patches/lightgbm-python-use-system-lib-lightgbm.patch create mode 100644 gnu/packages/patches/lightgbm-use-system-libraries.patch diff --git a/gnu/local.mk b/gnu/local.mk index 6a1e459e4e..0016ac12af 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1375,6 +1375,8 @@ dist_patch_DATA = \ %D%/packages/patches/lierolibre-newer-libconfig.patch \ %D%/packages/patches/lierolibre-remove-arch-warning.patch \ %D%/packages/patches/lierolibre-try-building-other-arch.patch \ + %D%/packages/patches/lightgbm-python-use-system-lib-lightgbm.patch \ + %D%/packages/patches/lightgbm-use-system-libraries.patch \ %D%/packages/patches/linbox-fix-pkgconfig.patch \ %D%/packages/patches/linkchecker-tests-require-network.patch \ %D%/packages/patches/linphone-desktop-without-sdk.patch \ diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index ead47a534a..1a3f647dde 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -56,6 +56,7 @@ #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages cmake) + #:use-module (gnu packages cpp) #:use-module (gnu packages cran) #:use-module (gnu packages databases) #:use-module (gnu packages dejagnu) @@ -70,8 +71,10 @@ #:use-module (gnu packages mpi) #:use-module (gnu packages ocaml) #:use-module (gnu packages onc-rpc) + #:use-module (gnu packages opencl) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) + #:use-module (gnu packages pretty-print) #:use-module (gnu packages protobuf) #:use-module (gnu packages python) #:use-module (gnu packages python-build) @@ -1058,33 +1061,39 @@ main intended application of Autograd is gradient-based optimization.") (define-public lightgbm (package (name "lightgbm") - (version "2.0.12") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/Microsoft/LightGBM") - (commit (string-append "v" version)))) - (sha256 - (base32 - "0jlvyn7k81dzrh9ij3zw576wbgiwmmr26rzpdxjn1dbpc3njpvzi")) - (file-name (git-file-name name version)))) + (version "3.2.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Microsoft/LightGBM") + (commit (string-append "v" version)))) + (patches + (search-patches "lightgbm-use-system-libraries.patch" + "lightgbm-python-use-system-lib-lightgbm.patch")) + (sha256 + (base32 "1fchiiwl3pz1kpi0kbfanif6c6b688wmmjjbqz4ff4djc6g2sg7z")) + (file-name (git-file-name name version)))) (native-inputs - `(("python-pytest" ,python-pytest) - ("python-nose" ,python-nose))) + `(("googletest" ,googletest) + ("opencl-headers" ,opencl-headers))) (inputs - `(("openmpi" ,openmpi))) - (propagated-inputs - `(("python-numpy" ,python-numpy) - ("python-scipy" ,python-scipy))) + `(("boost" ,boost) + ("eigen" ,eigen) + ("fast-double-parser" ,fast-double-parser) + ("fmt" ,fmt) + ("ocl-icd" ,ocl-icd) + ("openmpi" ,openmpi))) (arguments - `(#:configure-flags - '("-DUSE_MPI=ON") - #:phases - (modify-phases %standard-phases - (replace 'check - (lambda _ - (with-directory-excursion "../source" - (invoke "pytest" "tests/c_api_test/test_.py"))))))) + `(;; FIXME: With 'find_package(GTest CONFIG)' (default), googletest + ;; is not found by CMake. If we replace CONFIG with REQUIRED, the + ;; test files fail to link with googletest in the build phase. + #:tests? #f + #:test-target "testlightgbm" + #:configure-flags + (list "-DBUILD_CPP_TEST=OFF" + "-DUSE_GPU=ON" ;using OpenCL + "-DUSE_MPI=ON"))) (build-system cmake-build-system) (home-page "https://github.com/Microsoft/LightGBM") (synopsis "Gradient boosting framework based on decision tree algorithms") diff --git a/gnu/packages/patches/lightgbm-python-use-system-lib-lightgbm.patch b/gnu/packages/patches/lightgbm-python-use-system-lib-lightgbm.patch new file mode 100644 index 0000000000..69cb721daa --- /dev/null +++ b/gnu/packages/patches/lightgbm-python-use-system-lib-lightgbm.patch @@ -0,0 +1,74 @@ +From c73be84d8ec6ac71dfdaa71b7943ae344f5d7cde Mon Sep 17 00:00:00 2001 +From: Vinicius Monego +Date: Tue, 1 Jun 2021 00:24:38 -0300 +Subject: [PATCH] Use system lib_lightgbm. + +--- + python-package/lightgbm/libpath.py | 4 ++++ + python-package/setup.py | 12 ++++++++---- + 2 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/python-package/lightgbm/libpath.py b/python-package/lightgbm/libpath.py +index 6533792..27af2b9 100644 +--- a/python-package/lightgbm/libpath.py ++++ b/python-package/lightgbm/libpath.py +@@ -17,8 +17,12 @@ def find_lib_path() -> List[str]: + # we don't need lib_lightgbm while building docs + return [] + ++ # This variable will be set during substitution. ++ lib_lightgbm_path = '' ++ + curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) + dll_path = [curr_path, ++ lib_lightgbm_path, + os.path.join(curr_path, '../../'), + os.path.join(curr_path, 'compile'), + os.path.join(curr_path, '../compile'), +diff --git a/python-package/setup.py b/python-package/setup.py +index ee98b1a..2f7ce38 100644 +--- a/python-package/setup.py ++++ b/python-package/setup.py +@@ -231,7 +231,7 @@ class CustomInstall(install): + self.opencl_library = None + self.mpi = 0 + self.hdfs = 0 +- self.precompile = 0 ++ self.precompile = 1 + self.nomp = 0 + self.bit32 = 0 + +@@ -274,7 +274,7 @@ class CustomBdistWheel(bdist_wheel): + self.opencl_library = None + self.mpi = 0 + self.hdfs = 0 +- self.precompile = 0 ++ self.precompile = 1 + self.nomp = 0 + self.bit32 = 0 + +@@ -324,7 +324,10 @@ if __name__ == "__main__": + copy_file(os.path.join(CURRENT_DIR, os.path.pardir, 'VERSION.txt'), + os.path.join(CURRENT_DIR, 'lightgbm', 'VERSION.txt'), + verbose=0) # type:ignore +- version = open(os.path.join(CURRENT_DIR, 'lightgbm', 'VERSION.txt'), encoding='utf-8').read().strip() ++ ++ # This variable will be set during substitution. ++ version = '' ++ + readme = open(os.path.join(CURRENT_DIR, 'README.rst'), encoding='utf-8').read() + + sys.path.insert(0, CURRENT_DIR) +@@ -355,7 +358,8 @@ if __name__ == "__main__": + zip_safe=False, + cmdclass={ + 'install': CustomInstall, +- 'install_lib': CustomInstallLib, ++ # Lib will be loaded from the lightgbm package. ++ # 'install_lib': CustomInstallLib, + 'bdist_wheel': CustomBdistWheel, + 'sdist': CustomSdist, + }, +-- +2.31.1 + diff --git a/gnu/packages/patches/lightgbm-use-system-libraries.patch b/gnu/packages/patches/lightgbm-use-system-libraries.patch new file mode 100644 index 0000000000..115ca02775 --- /dev/null +++ b/gnu/packages/patches/lightgbm-use-system-libraries.patch @@ -0,0 +1,58 @@ +From 894648291b9629d51785e4fd1cae820d2858e039 Mon Sep 17 00:00:00 2001 +From: Vinicius Monego +Date: Mon, 31 May 2021 21:23:52 -0300 +Subject: [PATCH] Use system libraries. + +--- + CMakeLists.txt | 11 ++++++++--- + include/LightGBM/utils/common.h | 4 ++-- + 2 files changed, 10 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b845f36..560e477 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -93,9 +93,6 @@ if(USE_SWIG) + endif() + endif(USE_SWIG) + +-SET(EIGEN_DIR "${PROJECT_SOURCE_DIR}/external_libs/eigen") +-include_directories(${EIGEN_DIR}) +- + # See https://gitlab.com/libeigen/eigen/-/blob/master/COPYING.README + ADD_DEFINITIONS(-DEIGEN_MPL2_ONLY) + +@@ -399,6 +396,14 @@ if(USE_SWIG) + endif() + endif(USE_SWIG) + ++find_package (Eigen3 3.3 REQUIRED NO_MODULE) ++TARGET_LINK_LIBRARIES (lightgbm Eigen3::Eigen) ++TARGET_LINK_LIBRARIES (_lightgbm Eigen3::Eigen) ++ ++find_package(fmt) ++TARGET_LINK_LIBRARIES(lightgbm fmt::fmt) ++TARGET_LINK_LIBRARIES(_lightgbm fmt::fmt) ++ + if(USE_MPI) + TARGET_LINK_LIBRARIES(lightgbm ${MPI_CXX_LIBRARIES}) + TARGET_LINK_LIBRARIES(_lightgbm ${MPI_CXX_LIBRARIES}) +diff --git a/include/LightGBM/utils/common.h b/include/LightGBM/utils/common.h +index 4357357..00101a5 100644 +--- a/include/LightGBM/utils/common.h ++++ b/include/LightGBM/utils/common.h +@@ -32,9 +32,9 @@ + + #if (!((defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__)))) + #define FMT_HEADER_ONLY +-#include "../../../external_libs/fmt/include/fmt/format.h" ++#include "fmt/format.h" + #endif +-#include "../../../external_libs/fast_double_parser/include/fast_double_parser.h" ++#include "fast_double_parser.h" + + #ifdef _MSC_VER + #include +-- +2.31.1 +