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

Dialog box pops up when using Debug build of LightGBM #3151

Closed
mjmckp opened this issue Jun 5, 2020 · 8 comments
Closed

Dialog box pops up when using Debug build of LightGBM #3151

mjmckp opened this issue Jun 5, 2020 · 8 comments

Comments

@mjmckp
Copy link
Contributor

mjmckp commented Jun 5, 2020

When I attempt to use a debug build of LightGBM, when I create the booster object with default parameters, I get the following dialog box pop up:

image

This doesn't happen with a release build. I think this is being generated by OpenMP, I've seen mention of it elsewhere in projects that use OpenMP.

Steps to reproduce:

  • Clone LightGBM.Net from https://github.com/rca22/LightGBM.Net
  • Switch to the update_jun_20 branch (No longer necessary, use master branch)
  • Put a Debug build of LightGBM (built from master) in the LightGBM.Net\native\Debug folder
  • Run the test BoosterTest.Create in LightGBMNet.Train.Test
@jameslamb
Copy link
Collaborator

Thanks for the report and for using LightGBM!

We do not maintain LightGBM.NET, could you please raise this issue in that project's issues page?

If you are able to reproduce this pop up using only LightGBM code here, please open a new issue and we'll be happy to help.

@mjmckp
Copy link
Contributor Author

mjmckp commented Jun 5, 2020

Sorry, I think you have misunderstood, the issue has nothing to do with LightGBM.Net, I maintain that project, and I am just using it as a way to explain how to replicate the issue. The error is being generated by the native lightgbm dll.

@jameslamb jameslamb reopened this Jun 5, 2020
@jameslamb
Copy link
Collaborator

oh I definitely did misunderstand. Can you please provide a reproducible example that doesn't rely on LightGBM.Net? That would help us to help you

@guolinke
Copy link
Collaborator

@mjmckp The `Debug' is the 'debug' mode of lightgbm.dll or LightGBM.net?

@mjmckp
Copy link
Contributor Author

mjmckp commented Jun 22, 2020

@guolinke The debug build of lightgbm.dll

@shiyu1994
Copy link
Collaborator

@mjmckp This is due to a bug in undefined "num_threads" of the TrainingShareStates. The num_threads of a TrainingShareStates is set in this function. However, when the bin is nullptr, num_threads of TrainingShareStates is not set.

void SetMultiValBin(MultiValBin* bin) {
if (bin == nullptr) {
return;
}
multi_val_bin.reset(bin);
num_threads = OMP_NUM_THREADS();
num_bin_aligned =
(bin->num_bin() + kAlignedSize - 1) / kAlignedSize * kAlignedSize;
size_t new_size = static_cast<size_t>(num_bin_aligned) * 2 * num_threads;
if (new_size > hist_buf.size()) {
hist_buf.resize(static_cast<size_t>(num_bin_aligned) * 2 * num_threads);
}
}

But later on, this num_threads will be passed to num_threads argument of omp here

#pragma omp parallel for schedule(static) num_threads(share_state->num_threads)

which causes the error.

Inserting num_threads = OMP_NUM_THREADS(); between line 297 and 298 of dataset.h resolve this issue.

We will resolve this with a pull request together with the problem in #3152.

@guolinke
Copy link
Collaborator

@shiyu1994 I think you can create a PR to fix this first.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants