-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Disabling threading completely for prediction (in C++) #6820
Comments
Thanks for using LightGBM. The most reliable way to do what you've asked is build without OpenMP enabled, as you mentioned. That'll have the nice benefit of also creating a library that is smaller and more portable. cmake -B build -S . -DUSE_OPENMP=OFF
# or '--target lightgbm' for the CLI
cmake --build build --target _lightgbm I don't think there are other sources of thread creation in If using a build of LightGBM with OpenMP support, you can pass Lines 2546 to 2553 in 768f642
Docs on that parameter: https://lightgbm.readthedocs.io/en/latest/Parameters.html#num_threads However, I'm not 100% sure if that setting If there is an underlying performance problem or other issue that's leading to this question, we'd appreciate a minimal, reproducible example demonstrating that problem. That might help us to provide a more useful answer. |
Thank you for such a detailed response! ❤ I will go with building without OMP then. |
Sure, happy to help! We'll close this for now, comment in the future if you have other questions related to this topic (or open new issues if you have new questions. Thanks again for using LightGBM! |
Hi,
My application is single-threaded and pinned to a core and I would like to make sure that the library does not create any threads and runs in the context of the caller. Other than compiling with OMP support disabled, is there anything else I need to do so that
LGBM_BoosterPredictForMatSingleRowFast()
runs in the context of the caller and does not dispatch work to any other threads?Thanks!
The text was updated successfully, but these errors were encountered: