From patchwork Fri Oct 8 02:54:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vinicius Monego X-Patchwork-Id: 33684 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 3543D27BBE3; Fri, 8 Oct 2021 03:55:16 +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_H2,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 D62B327BBE1 for ; Fri, 8 Oct 2021 03:55:15 +0100 (BST) Received: from localhost ([::1]:57746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYg2U-00077U-Vi for patchwork@mira.cbaines.net; Thu, 07 Oct 2021 22:55:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYg2I-000775-If for guix-patches@gnu.org; Thu, 07 Oct 2021 22:55:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37281) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mYg2I-0005yS-B3 for guix-patches@gnu.org; Thu, 07 Oct 2021 22:55:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mYg2I-0008Gz-84 for guix-patches@gnu.org; Thu, 07 Oct 2021 22:55:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48785] [PATCH v3 1/3] gnu: Add fast-double-parser. References: <20210601220510.78230-1-monego@posteo.net> In-Reply-To: <20210601220510.78230-1-monego@posteo.net> Resent-From: Vinicius Monego Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 08 Oct 2021 02:55: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.163366167731755 (code B ref 48785); Fri, 08 Oct 2021 02:55:02 +0000 Received: (at 48785) by debbugs.gnu.org; 8 Oct 2021 02:54:37 +0000 Received: from localhost ([127.0.0.1]:48821 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYg1o-0008Fr-AP for submit@debbugs.gnu.org; Thu, 07 Oct 2021 22:54:37 -0400 Received: from mout01.posteo.de ([185.67.36.65]:47971) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYg1j-0008FW-8x for 48785@debbugs.gnu.org; Thu, 07 Oct 2021 22:54:31 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 77843240026 for <48785@debbugs.gnu.org>; Fri, 8 Oct 2021 04:54:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1633661660; bh=8cROjl+jM4DxxCglaFG+O8nPdRbaOZDSv9D7KVCWrlo=; h=From:To:Cc:Subject:Date:From; b=cmp5XLm5KYC0uk+m0s6JxSx/QO6boEepKuBOONK7J4lPFxb1B7DEikjDcHQI1V0YK C5XnPMxNDkt8Fpkes1wDygK5LAXQjBS8m6x7j//WyY+2SexZby1aEJYd7jbGwHLoD9 aGjUDiEPu5568HNwHUhwSNRLOGvzYbRkqbf4JTWPwxqf5bRKgA6OSeSyweCd9yiOFW nhIvW56BnArpeKUnDF5WmWS6W9pr4/LssBE8IoQZKEB/MYjuORRNDIKDtZ9CbDOMpX V9ttg0TvdNDxV1REdUyO1l+gl8UHM+0Z3ehVFPLkc37abFBnSgcbLQRjszCmKAqqGP gFdn7GBCXog4Q== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4HQXpM1lm1z9rxG; Fri, 8 Oct 2021 04:54:18 +0200 (CEST) From: Vinicius Monego Date: Fri, 8 Oct 2021 02:54:07 +0000 Message-Id: <20211008025409.80602-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/cpp.scm (fast-double-parser): New variable. --- Changed string to @code{} in description. gnu/packages/cpp.scm | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 4af71ba93a..4a8cd3a120 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -10,7 +10,7 @@ ;;; Copyright © 2020 Roel Janssen ;;; Copyright © 2020 Ricardo Wurmus ;;; Copyright © 2020 Brice Waegeneire -;;; Copyright © 2020 Vinicius Monego +;;; Copyright © 2020, 2021 Vinicius Monego ;;; Copyright © 2020 Marius Bakke ;;; Copyright © 2020 Michael Rohleder ;;; Copyright © 2020 Alexandros Theodotou @@ -331,6 +331,42 @@ functions, class methods, and stl containers. @end enumerate\n") (license license:bsd-3))) +(define-public fast-double-parser + (package + (name "fast-double-parser") + (version "0.5.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/lemire/fast_double_parser") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "10mfpy4i7lpavghb15s4d0920nlwsac1ri2sxkcqbrj9iq94qj71")))) + (build-system cmake-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (replace 'install ;no install target, have to do it manually + (lambda* (#:key outputs #:allow-other-keys) + (let ((out-include (string-append (assoc-ref outputs "out") + "/include"))) + (mkdir-p out-include) + (copy-file "../source/include/fast_double_parser.h" + (string-append out-include + "/fast_double_parser.h")))))))) + (home-page "https://github.com/lemire/fast_double_parser") + (synopsis "Parse strings into double (binary64) floating-point values") + (description "Fast function to parse strings containing decimal numbers +into double-precision (binary64) floating-point values. That is, given the +string @code{1.0e10}, it should return a 64-bit floating-point value equal to +10000000000. The function will match exactly (down the smallest bit) the +result of a standard function like @code{strtod}.") + ;; Dual-licensed, either license applies. + (license (list license:asl2.0 + license:boost1.0)))) + (define-public fifo-map (let* ((commit "0dfbf5dacbb15a32c43f912a7e66a54aae39d0f9") (revision "0") From patchwork Fri Oct 8 02:54:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Monego X-Patchwork-Id: 33685 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 6B2A327BBE3; Fri, 8 Oct 2021 03:55:18 +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_H2,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 C76F527BBE1 for ; Fri, 8 Oct 2021 03:55:17 +0100 (BST) Received: from localhost ([::1]:57752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYg2W-00077p-Uv for patchwork@mira.cbaines.net; Thu, 07 Oct 2021 22:55:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYg2I-00077D-UI for guix-patches@gnu.org; Thu, 07 Oct 2021 22:55:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37282) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mYg2I-0005yo-Mi for guix-patches@gnu.org; Thu, 07 Oct 2021 22:55:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mYg2I-0008H7-Lt for guix-patches@gnu.org; Thu, 07 Oct 2021 22:55:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48785] [PATCH v3 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: Fri, 08 Oct 2021 02:55: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.163366167831762 (code B ref 48785); Fri, 08 Oct 2021 02:55:02 +0000 Received: (at 48785) by debbugs.gnu.org; 8 Oct 2021 02:54:38 +0000 Received: from localhost ([127.0.0.1]:48825 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYg1t-0008G8-Bf for submit@debbugs.gnu.org; Thu, 07 Oct 2021 22:54:37 -0400 Received: from mout02.posteo.de ([185.67.36.66]:54983) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYg1m-0008Fb-KP for 48785@debbugs.gnu.org; Thu, 07 Oct 2021 22:54:32 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 6A8D4240101 for <48785@debbugs.gnu.org>; Fri, 8 Oct 2021 04:54:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1633661664; bh=Tjs3E5HXVLGNztk5l0oN24N0k+5V2drghuVWpxUqIFA=; h=From:To:Cc:Subject:Date:From; b=TM8e8dU0JyYWb/dTP3dZ4BLI/wXJTXPbmVluYcMChv+ebBuH7rW1jat9dbFtMXqme vHs6+K91lVtlnMPXvr8MSbzeXmbHdctG52odCEO6tDZF+hv0CJhD1CHyYUUynHptc1 ib9JLivR3nquZhpKEb/sAW1al3qbTpeXggp4B6aDK0OkmXPGqSHU75NlexSmaMVwG4 eMGgGPUBhWkzMeCjZYSiV0IRUXNeOMhOIXLfoZ98VnSaYTaS+BqUISxteJVhO6Z6hM 0ckL/wJWzl/xG4Qvp7siDb/4k3l3k2EChvMCJ/PdmlXALBz1x/VWiXw7Lvz6bIt6pf UInN1DFWyXadA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4HQXpR28dTz9rxG; Fri, 8 Oct 2021 04:54:23 +0200 (CEST) From: Vinicius Monego Date: Fri, 8 Oct 2021 02:54:08 +0000 Message-Id: <20211008025409.80602-2-monego@posteo.net> In-Reply-To: <20211008025409.80602-1-monego@posteo.net> References: <20211008025409.80602-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 patch. Make some cosmetic changes. [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. Remove custom 'check phase and skip running tests. * gnu/packages/patches/lightgbm-use-system-libraries.patch: New patch. * gnu/local.mk (dist_patch_DATA): Add it. --- Changed commit message slightly. gnu/local.mk | 1 + gnu/packages/machine-learning.scm | 55 ++++++++++-------- .../lightgbm-use-system-libraries.patch | 58 +++++++++++++++++++ 3 files changed, 90 insertions(+), 24 deletions(-) create mode 100644 gnu/packages/patches/lightgbm-use-system-libraries.patch diff --git a/gnu/local.mk b/gnu/local.mk index d415b892e9..35942e9188 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1420,6 +1420,7 @@ 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-use-system-libraries.patch \ %D%/packages/patches/linbox-fix-pkgconfig.patch \ %D%/packages/patches/linphone-desktop-without-sdk.patch \ %D%/packages/patches/linux-libre-support-for-Pinebook-Pro.patch \ diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 029422677a..99d864a25c 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -74,8 +74,10 @@ #:use-module (gnu packages ocaml) #:use-module (gnu packages onc-rpc) #:use-module (gnu packages parallel) + #: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) @@ -1221,33 +1223,38 @@ 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")) + (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-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 + From patchwork Fri Oct 8 02:54:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Monego X-Patchwork-Id: 33686 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 1641327BBE3; Fri, 8 Oct 2021 03:55:32 +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_H2,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 CD2FF27BBE1 for ; Fri, 8 Oct 2021 03:55:31 +0100 (BST) Received: from localhost ([::1]:58150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYg2k-0007P8-Up for patchwork@mira.cbaines.net; Thu, 07 Oct 2021 22:55:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYg2J-00077M-Ak for guix-patches@gnu.org; Thu, 07 Oct 2021 22:55:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37283) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mYg2J-0005zU-3A for guix-patches@gnu.org; Thu, 07 Oct 2021 22:55:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mYg2J-0008HF-2S for guix-patches@gnu.org; Thu, 07 Oct 2021 22:55:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48785] [PATCH v3 3/3] gnu: Add python-lightgbm. Resent-From: Vinicius Monego Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 08 Oct 2021 02:55:03 +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.163366167831769 (code B ref 48785); Fri, 08 Oct 2021 02:55:03 +0000 Received: (at 48785) by debbugs.gnu.org; 8 Oct 2021 02:54:38 +0000 Received: from localhost ([127.0.0.1]:48827 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYg1t-0008GF-UF for submit@debbugs.gnu.org; Thu, 07 Oct 2021 22:54:38 -0400 Received: from mout01.posteo.de ([185.67.36.65]:35741) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYg1p-0008Fg-PA for 48785@debbugs.gnu.org; Thu, 07 Oct 2021 22:54:34 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 23E79240026 for <48785@debbugs.gnu.org>; Fri, 8 Oct 2021 04:54:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1633661668; bh=fKv8AJpRvGIjhAg0SM7ANLDe6TuoGHeOy4B7aXtBRhg=; h=From:To:Cc:Subject:Date:From; b=i0Au1Z7Ci6oEGomrYukiHle4u3FyOUNIwK/s+nrXdBIZBcwq8Ugfadbfs0aaPB17E mC+TrQC/+clK0uP9sqLiw/jGUN6X5BLSR38EERJe4qpi1s1ztmG7F/KHHYE+mHIhwz 1GeXeTc4p8OkBdTN2zQA2aDN2SSYSiogoEXRkbG2U/HJq9UUo3qSXC1iCXCpc+244a 2oM4vrvZYCzBS0yWmuLCjvdhJstR28QpgL0jT3R5wFAljioxPAgU+USNpUpLzgf4jI x2IZ/oVZBxP5BtHJC5ddnCY3Xj/a2/dFPiTMOeLOVeT0RH3+G1P7uipo5pkcX7e5Eq KR54Gp3YIe0kw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4HQXpW2RYMz9rxG; Fri, 8 Oct 2021 04:54:27 +0200 (CEST) From: Vinicius Monego Date: Fri, 8 Oct 2021 02:54:09 +0000 Message-Id: <20211008025409.80602-3-monego@posteo.net> In-Reply-To: <20211008025409.80602-1-monego@posteo.net> References: <20211008025409.80602-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 (python-lightgbm): New variable. --- Rebase only. gnu/packages/machine-learning.scm | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 99d864a25c..e7ce107637 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -1271,6 +1271,65 @@ the following advantages: @end itemize\n") (license license:expat))) +(define-public python-lightgbm + (package + (inherit lightgbm) + (name "python-lightgbm") + (source (package-source lightgbm)) + (build-system python-build-system) + (arguments + `(#:configure-flags (list "--precompile") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'preparations + (lambda _ + (setenv "HOME" "/tmp") ;to write a log file + ;; Move Python files to source root to silence some warnings. + (rename-file "python-package/setup.py" "setup.py") + (rename-file "python-package/README.rst" "README.rst") + (rename-file "python-package/lightgbm" "lightgbm") + ;; Install version file to read the library's version. + (with-output-to-file "lightgbm/VERSION.txt" + (lambda () + (display ,(package-version lightgbm)))) + ;; Skip building the shared library. + (substitute* "setup.py" + (("'install_lib': CustomInstallLib,") "")))) + (add-after 'install 'install-liblightgbm + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (pylib (string-append out "/lib/python" + ,(version-major+minor + (package-version python)) + "/site-packages")) + (lgbdir (string-append pylib "/lightgbm")) + (lib-lightgbm (string-append (assoc-ref inputs "lightgbm") + "/lib/lib_lightgbm.so"))) + ;; This symlink is necessary for tests. + (symlink lib-lightgbm "lightgbm/lib_lightgbm.so") + ;; And this one for runtime. + (mkdir-p (string-append lgbdir "/lib")) + (symlink lib-lightgbm (string-append lgbdir + "/lib_lightgbm.so"))))) + (replace 'check + (lambda* (#:key inputs outputs tests? #:allow-other-keys) + (when tests? + (add-installed-pythonpath inputs outputs) + (invoke "python" "-m" "pytest" + "tests/python_package_test"))))))) + (native-inputs + `(("python-psutil" ,python-psutil) + ("python-pytest" ,python-pytest) + ("python-wheel" ,python-wheel))) + (inputs + `(("lightgbm" ,lightgbm))) + (propagated-inputs + `(("python-numpy" ,python-numpy) + ("python-pandas" ,python-pandas) + ("python-scikit-learn" ,python-scikit-learn) + ("python-scipy" ,python-scipy))) + (synopsis "Python frontend for LightGBM"))) + (define-public vowpal-wabbit ;; Language bindings not included. (package