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

Request: allow user to specify the maximal amount of threads #11

Open
alexgit256 opened this issue Dec 28, 2023 · 1 comment
Open

Request: allow user to specify the maximal amount of threads #11

alexgit256 opened this issue Dec 28, 2023 · 1 comment
Assignees

Comments

@alexgit256
Copy link

Flatter seems to always occupy all the threads avaliable: https://github.com/keeganryan/flatter/blob/500e31df6b7308e8101b2a4a9cc816bf8f483417/src/computation_context.cpp#L10C20-L10C39. It would have been an important improvement if flatter had an option to cap the amount of threads.

@keeganryan keeganryan self-assigned this Dec 28, 2023
@keeganryan
Copy link
Owner

It is currently possible to limit the number of threads with the OMP_NUM_THREADS environment variable. This is most useful when calling flatter from the command line. If you're calling flatter as a library, you can pass the maximum number of threads to the constructor of the ComputationContext object, which will limit the number of threads in the same way.

The OMP_NUM_THREADS syntax seems to be common practice for programs using OpenMP, but it's hard to discover if you don't dig into the internals. Since multiple users have asked about limiting threads, I think it makes sense to add this as an optional command line argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants