Skip to content

Document using limiting APIs for Python thread pools - #234

Open
itamarst wants to merge 14 commits into
joblib:masterfrom
itamarst:215-limits-for-thread-pools
Open

Document using limiting APIs for Python thread pools#234
itamarst wants to merge 14 commits into
joblib:masterfrom
itamarst:215-limits-for-thread-pools

Conversation

@itamarst

@itamarst itamarst commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #215

@itamarst
itamarst marked this pull request as ready for review September 3, 2026 17:39
@itamarst

itamarst commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

I think once this merged maybe this could be released?

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A first pass of feedback. I think it would be helpful if someone else who did not review all your past PRs could have a fresh look at this. Maybe @cakedev0, @lesteve and/or @jeremiedbb?

Comment thread README.md
### Switching Back And Forth Between Main Thread and Python Threads

Unfortunately not all controlled libraries providing limiting APIs that are
thread-specific. Limiting some libraries' thread pool sizes can therefore impact

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be helpful to maintain a separate markdown file with a reference assesment of the known semantics of common libraries that we consolidated by running the helpers from #213 and #214 on our CI.

Here is my current understanding:

  • OpenMP (including BLAS runtimes configured with an OpenMP threading layer):
    • libgomp (GCC) and libomp (LLVM): thread-local limits and thread-pools as per the OpenMP 3.0+ spec
    • msvc: process-wide limits and shared thread-pool (as per the OpenMP 2.0 spec)
  • OpenBLAS with the pthreads threading layer: process-wide limits and shared thread-pool
  • OpenBLAS with the windows threading layer: process-wide limits and shared thread-pool
  • MKL (all threading layers?): thread-local limits and thread-pools

Alternatively, we could have a short README section that explains how to use the CLI and the Python script that allows the user to dynamically inspect the effective semantics as we do on our CI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with the second approach, let me know what you think.

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
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

Successfully merging this pull request may close these issues.

API for setting limits for use by Python thread pools

2 participants