guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/03: gnu: Add xgboost.


From: guix-commits
Subject: 02/03: gnu: Add xgboost.
Date: Sat, 25 Sep 2021 16:13:57 -0400 (EDT)

lfam pushed a commit to branch master
in repository guix.

commit 6e5e60a20c7e327e6d0d672bfdaaf85d45a70f5f
Author: Vinicius Monego <monego@posteo.net>
AuthorDate: Sat Sep 25 19:36:50 2021 +0000

    gnu: Add xgboost.
    
    * gnu/packages/machine-learning.scm (xgboost): New variable.
    * gnu/packages/patches/xgboost-use-system-dmlc-core.patch: New patch.
    * gnu/local.mk (dist_patch_DATA): Add it.
    
    Signed-off-by: Leo Famulari <leo@famulari.name>
---
 gnu/local.mk                                       |  1 +
 gnu/packages/machine-learning.scm                  | 32 ++++++++++++++++++++
 .../patches/xgboost-use-system-dmlc-core.patch     | 34 ++++++++++++++++++++++
 3 files changed, 67 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index 7d706f6..22fc393 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1888,6 +1888,7 @@ 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-use-system-dmlc-core.patch       \
   %D%/packages/patches/xmonad-dynamic-linking.patch            \
   %D%/packages/patches/xnnpack-system-libraries.patch          \
   %D%/packages/patches/xplanet-1.3.1-cxx11-eof.patch           \
diff --git a/gnu/packages/machine-learning.scm 
b/gnu/packages/machine-learning.scm
index a476821..454088b 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -2338,6 +2338,38 @@ 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.2")
+    (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-use-system-dmlc-core.patch"))
+       (sha256
+        (base32 "00liz816ahk9zj3jv3m2fqwlf6xxfbgvpmpl72iklx32vl192w5d"))))
+    (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")
+    (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-use-system-dmlc-core.patch 
b/gnu/packages/patches/xgboost-use-system-dmlc-core.patch
new file mode 100644
index 0000000..c654694
--- /dev/null
+++ b/gnu/packages/patches/xgboost-use-system-dmlc-core.patch
@@ -0,0 +1,34 @@
+From 34167cc105e47589b86b6f62da76e0ab744002dd Mon Sep 17 00:00:00 2001
+From: Vinicius Monego <monego@posteo.net>
+Date: Tue, 11 May 2021 19:35:30 -0300
+Subject: [PATCH] Use dmlc-core from Guix.
+
+---
+This patch is a subset of 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]