Skip to content
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 21 commits into from Jun 7, 2022
Merged

PKG Add Xgboost #2537

merged 21 commits into from Jun 7, 2022

Conversation

ryanking13
Copy link
Member

@ryanking13 ryanking13 commented May 10, 2022

Description

On top of #2488, add XGboost package.

Checklists

@ryanking13
Copy link
Member Author

CppException is very helpful btw, thanks @hoodmane.

@tunguz
Copy link

tunguz commented May 19, 2022

I've asked around, and there seems to be a way to install a single-threaded version of XGBoost. Apparently you just need to set the CMake flag USE_OPENMP=OFF. Works with and without GPU.

@ryanking13
Copy link
Member Author

cflags: |
-DDMLC_USE_FOPEN64=0
-DDMLC_ENABLE_STD_THREAD=0
-DDMLC_CXX11_THREAD_LOCAL=0
-DUSE_OPENMP=0

I think I disabled OPENMP already, but I'll recheck.

@ryanking13
Copy link
Member Author

I can see that OPENMP is disabled from the build log.

WARNING:XGBoost build_ext:Disabling OpenMP support.
INFO:XGBoost build_ext:Run CMake command: ['cmake', 'xgboost', '-GUnix Makefiles', '-DUSE_OPENMP=0', '-DUSE_CUDA=0', '-DUSE_NCCL=0', '-DBUILD_WITH_SHARED_NCCL=0', '-DHIDE_CXX_SYMBOLS=1', '-DUSE_HDFS=0', '-DUSE_AZURE=0', '-DUSE_S3=0', '-DPLUGIN_DENSE_PARSER=0']
Re-run cmake no build system arguments

Probably xgboost creates a thread somewhere even if we build it as a single-threaded version?

@trivialfis
Copy link

Thanks for working on this, I ran simple tests with numpy as input and there's no thread being launched by XGBoost. However the data fetching process inside the parser might spawn threads, will get back to this next week.

@trivialfis
Copy link

trivialfis commented May 23, 2022

Hi, I can confirm that the data parser is indeed creating new threads. Can we use normal numpy/scipy.sparse/pandas as inputs for tests instead of the data parser inside XGBoost?

@ryanking13
Copy link
Member Author

Thanks, @trivialfis! I was able to use numpy arrays and pandas dataframes in the test.

@ryanking13 ryanking13 marked this pull request as ready for review May 26, 2022 07:33
@ryanking13
Copy link
Member Author

ryanking13 commented May 26, 2022

Okay, then this can be reviewed now. Ideally, it would be great if we can add more tests. But frankly, I don't know much about the common examples for XGBoost.

@tunguz would you like to review this PR? Note that you can download build artifacts from CI and test XGBoost.

https://app.circleci.com/pipelines/github/ryanking13/pyodide/412/workflows/4c935399-5e5d-42c3-a4ce-7835fa6a7606/jobs/6246/artifacts

@ryanking13
Copy link
Member Author

Upstream patches in this PR are accepted: dmlc/xgboost#7954

Copy link
Member

@hoodmane hoodmane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me aside from some very minor comments.

@@ -0,0 +1,26 @@
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
Copy link
Member

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 called toolchains or something.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

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.

packages/xgboost/demo/dermatology.data Outdated Show resolved Hide resolved
@ryanking13
Copy link
Member Author

Thanks for the review!

@ryanking13 ryanking13 merged commit 587a73f into pyodide:main Jun 7, 2022
@ryanking13 ryanking13 deleted the xgboost branch June 7, 2022 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants