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

Smarter default number of workers #74

Merged
merged 1 commit into from
May 9, 2022
Merged
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
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