Skip to content

Commit

Permalink
Set XGBoost to use one thread to avoid spawning hundreds of OpenMP th…
Browse files Browse the repository at this point in the history
…reads

See #44923 for details
  • Loading branch information
mmusich committed May 24, 2024
1 parent 32dc277 commit f537906
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions RecoEgamma/PhotonIdentification/src/PhotonXGBoostEstimator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

PhotonXGBoostEstimator::PhotonXGBoostEstimator(const edm::FileInPath& weightsFile, int best_ntree_limit) {
XGBoosterCreate(NULL, 0, &booster_);
// Set number of threads to 1, to avoid spawning hundreds of OpenMP threads
// See https://github.com/cms-sw/cmssw/issues/44923 for details
XGBoosterSetParam(booster_, "nthread", "1");
XGBoosterLoadModel(booster_, weightsFile.fullPath().c_str());
best_ntree_limit_ = best_ntree_limit;

Expand Down

0 comments on commit f537906

Please sign in to comment.