From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id AGSDGBNGnWDYPAEAgWs5BA (envelope-from ) for ; Thu, 13 May 2021 17:30:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id qPk/FBNGnWBJbwAAB5/wlQ (envelope-from ) for ; Thu, 13 May 2021 15:30:27 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B2E1EFCAC for ; Thu, 13 May 2021 17:30:26 +0200 (CEST) Received: from localhost ([::1]:41352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhDI9-0005qG-Q7 for larch@yhetil.org; Thu, 13 May 2021 11:30:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhDHm-0005n0-Jq for guix-patches@gnu.org; Thu, 13 May 2021 11:30:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lhDHm-0001O9-3C for guix-patches@gnu.org; Thu, 13 May 2021 11:30:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lhDHl-0006RP-U6 for guix-patches@gnu.org; Thu, 13 May 2021 11:30:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48388] [PATCH v2 2/3] gnu: Add xgboost. References: <20210512235649.516594-1-monego@posteo.net> In-Reply-To: <20210512235649.516594-1-monego@posteo.net> Resent-From: Vinicius Monego Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 13 May 2021 15:30:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48388 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48388@debbugs.gnu.org Cc: Vinicius Monego Received: via spool by 48388-submit@debbugs.gnu.org id=B48388.162091979824725 (code B ref 48388); Thu, 13 May 2021 15:30:01 +0000 Received: (at 48388) by debbugs.gnu.org; 13 May 2021 15:29:58 +0000 Received: from localhost ([127.0.0.1]:44129 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lhDHe-0006Qd-7p for submit@debbugs.gnu.org; Thu, 13 May 2021 11:29:58 -0400 Received: from mout01.posteo.de ([185.67.36.65]:37709) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lhDHY-0006QJ-Ud for 48388@debbugs.gnu.org; Thu, 13 May 2021 11:29:52 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id AE9CF240028 for <48388@debbugs.gnu.org>; Thu, 13 May 2021 17:29:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1620919782; bh=0UDHA3OEHYrRaHc9HS6tInpd3VR8FZCRTbZ9AjtfKOM=; h=From:To:Cc:Subject:Date:From; b=HLmpVCdKJEe826H/YEp4QZNwGuQGsTTo7W+TdaOEYEzOLCfvR81GYChLi25l2aGyZ XXUIkp8jsEq0EYwf5y7zvObrRk9InGiEIgeUSmx1r82hSMWf0yWZ9HF561aeijj+LL ZXTQRufExM811PA1zkvBKz+a0EQ3sBdwy/O9h99/wx45l9f71Tdeu7ckI/RQXoGFwv 3QQCCMV2MDBxrWKE6GZ+kj2M0JvSsTJ7luLlu+wJJ8LI8UhED1p2iysEU7Zq5wxwVE XMAyQ4E6Sh7WImcLKpU45ngyZWh8hlIq0nhTQrgESn4c67dF9naCNvQqC0fS9NxPu9 k1y2OHVjL8riA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FgwZD4t5Gz9rxK; Thu, 13 May 2021 17:29:40 +0200 (CEST) From: Vinicius Monego Date: Thu, 13 May 2021 15:29:13 +0000 Message-Id: <20210513152914.573837-1-monego@posteo.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620919826; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=nxK/2Gl+3Re3N8LnRXhapVNxy066leiLV5HSLAK56nw=; b=YYDivNAMBbyg8IcUNIhNkA7GX+yATCP4pFbomI1AkPJUU30Nd2ekVEp0g0YXDDIPz5USfC kOQE2hNqYqzbBWJXJKHft0BcjKsbWit/+LNP/1xa66/+VuHI5qc3znbHRh+BEKNR+3BnYF g9xQYTiJowQtcW73UQjO5ODcRQpHUSwZierbQd92oOGxuE0BaCCHwE1ql+l5T0b2xnp/Zw NHEHaXYCfHUFlge59055KyCjfcgXUcdKpwMpMyhHhjuEa4ojTGMN2QfUUi08yJE6erQd6i TIy7A4r2dkYiUr1Il64yYlpvegj7mZ4V6MoVcuzNqND5Mb32Ny5nWIjUpLDa4A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620919826; a=rsa-sha256; cv=none; b=IvCzvED3d8W7HkbD4pAsZReCkp4fEgbMc57H9BcgM/VurcjXWSsiyHdTA3hpTPU2vcoGfP JKMDJt0zNrLrTqYezSqV7B5mdvEdx/ZMO7fUQ/mraT39ShlINV+kdQBaR+NLwDcDnh0TNO LrUDbRUIHianq9epHD3zIxAIkEdMtoJ9Bxa8HGphtO+KPrm6UJJ5+ZoQxP6eFhGkrWAH6V wJmySnXGEUvwg672kowhnhVm66NpmngfbBoLsnq2RSSwnTbZBn7G0NLQHwq7LaZpe4S7f9 dWHnD0BloH394oa7vR8azYqMx09JC/LMsD65d67h5vikOT185bu7FeTlxB8Fpw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=HLmpVCdK; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 3.65 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=HLmpVCdK; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: B2E1EFCAC X-Spam-Score: 3.65 X-Migadu-Scanner: scn0.migadu.com X-TUID: aTjkqyQfX6YK * gnu/packages/machine-learning.scm (xgboost): New variable. * gnu/packages/patches/xgboost-python-use-system-libxgboost.patch, gnu/packages/patches/xgboost-use-system-dmlc-core.patch: New files. * gnu/local.mk (dist_PATCH_DATA): Add them. --- Changed commit message to add patch files. gnu/local.mk | 2 + gnu/packages/machine-learning.scm | 33 +++++++++ ...xgboost-python-use-system-libxgboost.patch | 69 +++++++++++++++++++ .../xgboost-use-system-dmlc-core.patch | 35 ++++++++++ 4 files changed, 139 insertions(+) create mode 100644 gnu/packages/patches/xgboost-python-use-system-libxgboost.patch create mode 100644 gnu/packages/patches/xgboost-use-system-dmlc-core.patch diff --git a/gnu/local.mk b/gnu/local.mk index 37166bb2fc..e1d382c543 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1823,6 +1823,8 @@ dist_patch_DATA = \ %D%/packages/patches/xf86-video-voodoo-pcitag.patch \ %D%/packages/patches/xfce4-panel-plugins.patch \ %D%/packages/patches/xfce4-settings-defaults.patch \ + %D%/packages/patches/xgboost-python-use-system-libxgboost.patch \ + %D%/packages/patches/xgboost-use-system-dmlc-core.patch \ %D%/packages/patches/xmonad-dynamic-linking.patch \ %D%/packages/patches/xplanet-1.3.1-cxx11-eof.patch \ %D%/packages/patches/xplanet-1.3.1-libdisplay_DisplayOutput.cpp.patch \ diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 9d6c5505f7..d81370797f 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -1959,6 +1959,39 @@ offers the bricks to build efficient and scalable distributed machine learning libraries.") (license license:asl2.0)))) +(define-public xgboost + (package + (name "xgboost") + (version "1.4.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/dmlc/xgboost") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (patches (search-patches "xgboost-python-use-system-libxgboost.patch" + "xgboost-use-system-dmlc-core.patch")) + (sha256 + (base32 "0ixacmpcj844c09xigi1vd4rrckld84k32iarvhnvvm6yjih756y")))) + (build-system cmake-build-system) + (arguments + `(#:configure-flags (list "-DGOOGLE_TEST=ON"))) + (native-inputs + `(("googletest" ,googletest) + ("python" ,python-wrapper))) + (inputs + `(("dmlc-core" ,dmlc-core))) + (home-page "https://xgboost.ai/") + (synopsis "Gradient boosting (GBDT, GBRT or GBM) library in C++") + (description + "XGBoost is an optimized distributed gradient boosting library designed +to be highly efficient, flexible and portable. It implements machine learning +algorithms under the Gradient Boosting framework. XGBoost provides a parallel +tree boosting (also known as GBDT, GBM) that solve many data science problems +in a fast and accurate way.") + (license license:asl2.0))) + (define-public python-iml (package (name "python-iml") diff --git a/gnu/packages/patches/xgboost-python-use-system-libxgboost.patch b/gnu/packages/patches/xgboost-python-use-system-libxgboost.patch new file mode 100644 index 0000000000..992e6bb3fd --- /dev/null +++ b/gnu/packages/patches/xgboost-python-use-system-libxgboost.patch @@ -0,0 +1,69 @@ +From 768192b9c6700f0ae6b750c56b114d7022692a0b Mon Sep 17 00:00:00 2001 +From: Vinicius Monego +Date: Tue, 11 May 2021 19:30:55 -0300 +Subject: [PATCH] Python wrapper: use system libxgboost. + +--- +This patch was extended from the following Debian patch: https://sources.debian.org/src/xgboost/1.2.1-1/debian/patches/setup.py.patch/ + + python-package/setup.py | 4 ++-- + python-package/xgboost/__init__.py | 5 ++--- + python-package/xgboost/libpath.py | 5 +++++ + 3 files changed, 9 insertions(+), 5 deletions(-) + +diff --git a/python-package/setup.py b/python-package/setup.py +index a2feb766..b8b78429 100644 +--- a/python-package/setup.py ++++ b/python-package/setup.py +@@ -312,11 +312,11 @@ if __name__ == '__main__': + 'numpy', + 'scipy', + ], +- ext_modules=[CMakeExtension('libxgboost')], ++ # ext_modules=[CMakeExtension('libxgboost')], + cmdclass={ + 'build_ext': BuildExt, + 'sdist': Sdist, +- 'install_lib': InstallLib, ++ # 'install_lib': InstallLib, + 'install': Install + }, + extras_require={ +diff --git a/python-package/xgboost/__init__.py b/python-package/xgboost/__init__.py +index e0ff434d..658e84e6 100644 +--- a/python-package/xgboost/__init__.py ++++ b/python-package/xgboost/__init__.py +@@ -21,9 +21,8 @@ try: + except ImportError: + pass + +-VERSION_FILE = os.path.join(os.path.dirname(__file__), 'VERSION') +-with open(VERSION_FILE) as f: +- __version__ = f.read().strip() ++# This variable will be set during substitution. ++__version__ = '' + + __all__ = ['DMatrix', 'DeviceQuantileDMatrix', 'Booster', + 'train', 'cv', +diff --git a/python-package/xgboost/libpath.py b/python-package/xgboost/libpath.py +index f7a7d9cd..88d9d986 100644 +--- a/python-package/xgboost/libpath.py ++++ b/python-package/xgboost/libpath.py +@@ -19,9 +19,14 @@ def find_lib_path() -> List[str]: + lib_path + List of all found library path to xgboost + """ ++ ++ # This variable will be set during substitution. ++ XGBOOST_PATH = '' ++ + curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) + dll_path = [ + # normal, after installation `lib` is copied into Python package tree. ++ os.path.join(XGBOOST_PATH, 'lib'), + os.path.join(curr_path, 'lib'), + # editable installation, no copying is performed. + os.path.join(curr_path, os.path.pardir, os.path.pardir, 'lib'), +-- +2.31.1 + diff --git a/gnu/packages/patches/xgboost-use-system-dmlc-core.patch b/gnu/packages/patches/xgboost-use-system-dmlc-core.patch new file mode 100644 index 0000000000..6209ae1f10 --- /dev/null +++ b/gnu/packages/patches/xgboost-use-system-dmlc-core.patch @@ -0,0 +1,35 @@ +From 34167cc105e47589b86b6f62da76e0ab744002dd Mon Sep 17 00:00:00 2001 +From: Vinicius Monego +Date: Tue, 11 May 2021 19:35:30 -0300 +Subject: [PATCH] Use dmlc-core from Guix. + +--- +This patch is a subset from the following Debian patch: https://sources.debian.org/src/xgboost/1.2.1-1/debian/patches/cmake.patch/ + +Rabit is now developed as part of xgboost, so we don't build it separately. + + CMakeLists.txt | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6cc19fbd..3b42bc17 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -150,11 +150,9 @@ endif (USE_OPENMP) + + # dmlc-core + msvc_use_static_runtime() +-add_subdirectory(${xgboost_SOURCE_DIR}/dmlc-core) +-set_target_properties(dmlc PROPERTIES +- CXX_STANDARD 14 +- CXX_STANDARD_REQUIRED ON +- POSITION_INDEPENDENT_CODE ON) ++add_library(dmlc SHARED IMPORTED) ++find_library(DMLC_LIBRARY dmlc) ++set_property(TARGET dmlc PROPERTY IMPORTED_LOCATION "${DMLC_LIBRARY}") + if (MSVC) + target_compile_options(dmlc PRIVATE + -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE) +-- +2.31.1 + -- 2.31.1