Skip to content

Commit

Permalink
Merge pull request #74 from erlingrj/smart-number-of-workers
Browse files Browse the repository at this point in the history
Smarter default number of workers
  • Loading branch information
lhstrh authored May 9, 2022
2 parents ebc4187 + 843caa5 commit 7cfe611
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/threaded/reactor_threaded.c
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,14 @@ void determine_number_of_workers(void) {
#if !defined(NUMBER_OF_WORKERS) || NUMBER_OF_WORKERS == 0
// Use the number of cores on the host machine.
_lf_number_of_workers = lf_available_cores();

// If reaction graph breadth is available. Cap number of workers
#if defined(LF_REACTION_GRAPH_BREADTH)
if (LF_REACTION_GRAPH_BREADTH < _lf_number_of_workers) {
_lf_number_of_workers = LF_REACTION_GRAPH_BREADTH;
}
#endif

#else
// Use the provided number of workers by the user
_lf_number_of_workers = NUMBER_OF_WORKERS;
Expand Down

0 comments on commit 7cfe611

Please sign in to comment.