-
-
Notifications
You must be signed in to change notification settings - Fork 776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PKG Add Xgboost #2537
Merged
Merged
PKG Add Xgboost #2537
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
0731260
Add xgboost
hoodmane d633b01
Merge branch 'main' of github.com:pyodide/pyodide into xgboost
hoodmane 93a7303
Reroute calls to cmake to emcmake
hoodmane 8a67c3a
mucking about
hoodmane e6d2ebc
Merge remote-tracking branch 'hoodmane/xgboost' into xgboost
ryanking13 97bce61
Revert changes in pywasmcross
ryanking13 56df48f
Update xgboost build script
ryanking13 fc55d32
Merge remote-tracking branch 'upstream/main' into xgboost
ryanking13 eddd0bb
Update build settings
ryanking13 efedbca
Revert removing .keep
ryanking13 639e77d
Merge remote-tracking branch 'upstream/main' into xgboost
ryanking13 be8eea8
Add tests for simple classification
ryanking13 8372d5f
Merge remote-tracking branch 'upstream/main' into xgboost
ryanking13 24167af
Update tests
ryanking13 b2895ad
Update changelog
ryanking13 ffd1d5a
Remove pandas from runtime dependency
ryanking13 14b08be
Merge remote-tracking branch 'upstream/main' into xgboost
ryanking13 5975b60
Apply upstream update
ryanking13 7e21294
Merge remote-tracking branch 'upstream/main' into xgboost
ryanking13 ca9f638
Merge remote-tracking branch 'upstream/main' into xgboost
ryanking13 beca895
Apply suggestions of hoodmane
ryanking13 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#.rst: | ||
# TestBigEndian | ||
# ------------- | ||
# | ||
# The TestBigEndian.cmake module that ships with CMake, which | ||
# checks if the system is big endian or little endian, assumes | ||
# that a binary is produced that will have bytes that correspond to the | ||
# endianness on the target system. Since emscripten produces Javascript, we | ||
# override the default behavior and always return little endian. | ||
# | ||
# :: | ||
# | ||
# TEST_BIG_ENDIAN(VARIABLE) | ||
# VARIABLE - variable to store the result to | ||
#============================================================================= | ||
# Copyright 2002-2009 Kitware, Inc. | ||
# | ||
# Distributed under the OSI-approved BSD License (the "License"); | ||
# see accompanying file Copyright.txt for details. | ||
# | ||
# This software is distributed WITHOUT ANY WARRANTY; without even the | ||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the License for more information. | ||
#============================================================================= | ||
# (To distribute this file outside of CMake, substitute the full | ||
# License text for the above reference.) | ||
|
||
function(TEST_BIG_ENDIAN VARIABLE) | ||
set(${VARIABLE} 0 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) | ||
set(CMAKE_SKIP_COMPATIBILITY_TESTS 1) | ||
set(CMAKE_SIZEOF_CHAR 1) | ||
set(CMAKE_SIZEOF_UNSIGNED_SHORT 2) | ||
set(CMAKE_SIZEOF_SHORT 2) | ||
set(CMAKE_SIZEOF_INT 4) | ||
set(CMAKE_SIZEOF_UNSIGNED_LONG 4) | ||
set(CMAKE_SIZEOF_UNSIGNED_INT 4) | ||
set(CMAKE_SIZEOF_LONG 4) | ||
set(CMAKE_SIZEOF_VOID_P 4) | ||
set(CMAKE_SIZEOF_FLOAT 4) | ||
set(CMAKE_SIZEOF_DOUBLE 8) | ||
set(CMAKE_C_SIZEOF_DATA_PTR 4) | ||
set(CMAKE_CXX_SIZEOF_DATA_PTR 4) | ||
set(CMAKE_HAVE_LIMITS_H 1) | ||
set(CMAKE_HAVE_UNISTD_H 1) | ||
set(CMAKE_HAVE_PTHREAD_H 1) | ||
set(CMAKE_HAVE_SYS_PRCTL_H 1) | ||
set(CMAKE_WORDS_BIGENDIAN 0) | ||
set(CMAKE_DL_LIBS) | ||
set(CMAKE_RANLIB echo) | ||
set(CMAKE_CROSSCOMPILING TRUE) | ||
set(CMAKE_SYSTEM_PROCESSOR x86) | ||
set(UNIX 1) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package: | ||
name: xgboost | ||
version: 1.6.0 | ||
source: | ||
url: https://files.pythonhosted.org/packages/77/89/92b399140a7688443fc182b54240822c903e906121d63446eb2f84350e99/xgboost-1.6.0.tar.gz | ||
sha256: 9c944c2495cb426b8a365021565755c39ee0b53156cf5e53a4346bdad2e3b734 | ||
patches: | ||
- patches/0001-Add-missing-template-type.patch | ||
- patches/0002-Add-library-loading-path.patch | ||
build: | ||
cflags: | | ||
-DDMLC_USE_FOPEN64=0 | ||
-DDMLC_ENABLE_STD_THREAD=0 | ||
-DDMLC_CXX11_THREAD_LOCAL=0 | ||
-DUSE_OPENMP=0 | ||
script: | | ||
# export VERBOSE=1 | ||
export CMAKE_TOOLCHAIN_FILE=$PYODIDE_ROOT/packages/xgboost/cmake/Toolchain.cmake | ||
requirements: | ||
run: | ||
- numpy | ||
- scipy | ||
- setuptools | ||
test: | ||
imports: | ||
- xgboost | ||
about: | ||
home: https://github.com/dmlc/xgboost | ||
PyPI: https://pypi.org/project/xgboost | ||
summary: XGBoost Python Package | ||
license: Apache-2.0 |
37 changes: 37 additions & 0 deletions
37
packages/xgboost/patches/0001-Add-missing-template-type.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
From 4ac9a00d9e16b0879b4e734a4b604c7ce672894e Mon Sep 17 00:00:00 2001 | ||
From: Gyeongjae Choi <def6488@gmail.com> | ||
Date: Mon, 9 May 2022 06:42:07 +0000 | ||
Subject: [PATCH 1/2] Add missing template type | ||
|
||
ryanking13 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TODO: Remove this patch when XGBoost version is updated. | ||
(Upstream PR: https://github.com/dmlc/xgboost/pull/7954) | ||
|
||
--- | ||
src/common/host_device_vector.cc | 5 ++++- | ||
1 file changed, 4 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/xgboost/src/common/host_device_vector.cc b/xgboost/src/common/host_device_vector.cc | ||
index 3a4a59db..fc33317b 100644 | ||
--- a/xgboost/src/common/host_device_vector.cc | ||
+++ b/xgboost/src/common/host_device_vector.cc | ||
@@ -180,13 +180,16 @@ template class HostDeviceVector<uint64_t>; // bst_row_t | ||
template class HostDeviceVector<uint32_t>; // bst_feature_t | ||
template class HostDeviceVector<RegTree::Segment>; | ||
|
||
-#if defined(__APPLE__) | ||
+#if defined(__APPLE__) || defined(__EMSCRIPTEN__) | ||
/* | ||
* On OSX: | ||
* | ||
* typedef unsigned int uint32_t; | ||
* typedef unsigned long long uint64_t; | ||
* typedef unsigned long __darwin_size_t; | ||
+ * | ||
+ * On Emscripten: | ||
+ * typedef unsigned long size_t; | ||
*/ | ||
template class HostDeviceVector<std::size_t>; | ||
#endif // defined(__APPLE__) | ||
-- | ||
2.35.1 | ||
|
29 changes: 29 additions & 0 deletions
29
packages/xgboost/patches/0002-Add-library-loading-path.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
From 54c2a9faeb0b0169172c5ab53367e6092f132c5a Mon Sep 17 00:00:00 2001 | ||
From: Gyeongjae Choi <def6488@gmail.com> | ||
Date: Mon, 9 May 2022 12:07:44 +0000 | ||
Subject: [PATCH 2/2] Add library loading path | ||
|
||
TODO: Remove this patch when XGBoost version is updated. | ||
(Upstream PR: https://github.com/dmlc/xgboost/pull/7954) | ||
|
||
--- | ||
python-package/xgboost/libpath.py | 3 +-- | ||
1 file changed, 1 insertion(+), 2 deletions(-) | ||
|
||
diff --git a/xgboost/libpath.py b/xgboost/libpath.py | ||
index f7a7d9cd..1ab41cbe 100644 | ||
--- a/xgboost/libpath.py | ||
+++ b/xgboost/libpath.py | ||
@@ -43,8 +43,7 @@ def find_lib_path() -> List[str]: | ||
# directory here | ||
dll_path.append(os.path.join(curr_path, './windows/Release/')) | ||
dll_path = [os.path.join(p, 'xgboost.dll') for p in dll_path] | ||
- elif sys.platform.startswith('linux') or sys.platform.startswith( | ||
- 'freebsd'): | ||
+ elif sys.platform.startswith(('linux', 'freebsd', 'emscripten')): | ||
dll_path = [os.path.join(p, 'libxgboost.so') for p in dll_path] | ||
elif sys.platform == 'darwin': | ||
dll_path = [os.path.join(p, 'libxgboost.dylib') for p in dll_path] | ||
-- | ||
2.35.1 | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it would be good to share this stuff with other CMake packages? Of course you would be better equipped to know about that than me. Perhaps as a followup to this PR or when you and @henryiii figure out more of the CMake stuff we could move this maybe to the
tools
directory and add a section to the package building docs about it?For comparison, in #2378 I put the toolchain file into
tools
. It's not clear that this is the best place for these files, they might be better off in a folder calledtoolchains
or something.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think I should update our build system to use emscripten's cmake toolchain file directly if possible, instead of making a custom toolchain file for each package. I think it is possible if we set some compiler variables correctly but I haven't checked yet.