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

remove unnecessary omp single that cause deadlock (fixes #6273) #6394

Merged
merged 3 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/utils/openmp_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ int OMP_NUM_THREADS() {
default_num_threads = LGBM_DEFAULT_NUM_THREADS;
} else {
// otherwise, default to OpenMP-global config
#pragma omp single
{ default_num_threads = omp_get_max_threads(); }
default_num_threads = omp_get_max_threads();
}

// ensure that if LGBM_SetMaxThreads() was ever called, LightGBM doesn't
Expand Down
10 changes: 10 additions & 0 deletions tests/python_package_test/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,16 @@ def test_dataset_construction_overwrites_user_provided_metadata_fields():
np_assert_array_equal(dtrain.get_field("weight"), expected_weight, strict=True)


def test_dataset_construction_with_high_cardinality_categorical_succeeds():
pd = pytest.importorskip("pandas")
X = pd.DataFrame({"x1": np.random.randint(0, 5_000, 10_000)})
y = np.random.rand(10_000)
ds = lgb.Dataset(X, y, categorical_feature=["x1"])
ds.construct()
assert ds.num_data() == 10_000
assert ds.num_feature() == 1


def test_choose_param_value():
original_params = {
"local_listen_port": 1234,
Expand Down
Loading