-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Tracker]: free-threaded Python support #28611
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
Comments
I've tested this before, and it runs fine, but there's not really much we could plausibly do until |
Hmm, actually, I missed the fact that |
I have run the test suite locally with |
We're upgradingto
Since |
I was having issues with |
I have put a PR into kiwisolver to add free threading support as well. All of the other external dependencies looked like they already declared themselves ready for free threading support. So now I think we need to look at declaring our own internal modules as ready for free threading. |
I can do that, but hope to have the pybind11 conversion in first, since that makes it (ever so slightly) easier. |
I just hit a case where matplotlib reenables the GIL at runtime:
I'm on a Mac so I guess it defaults to the MacOS backend, and the extension it uses doesn't declare free-threaded support. No idea if that was left that way on purpose. |
I don't think so. I believe we probably just updated the pybind11 modules in #28819 and forgot to include the macos module. I know I tried it out on a mac before and had it working. I believe this is the place that needs updating if you care to test it out and PR it? Line 1897 in a9dc9ac
|
Thanks! I'll send in a PR. I see you work at LASP - I spent a few years in a cubicle deep inside the lab on Colorado Ave doing undergrad research at CU! Small world :) |
So, all of these variables are definitely not thread-safe: Lines 28 to 44 in ede8dc4
I bet if you tried to interact with any matplotlib windows on a mac from different python threads, bad things and/or weird things would happen. But I guess keyboard and mouse state is probably effectively global state most of the time? So maybe it doesn't matter much and we can just document this somewhere? The signal handler might be a more pernicious issue. |
👋 ironically, I am in a cube on Colorado Ave, but luckily have a window view of the ponds which is nice.
Is there a way to test this? The interactive windows rely on the MacOS toolkits and window managers and are running in the OS' own multi-threaded context already.
We have this page: https://matplotlib.org/stable/users/explain/figure/interactive_guide.html#threading I think our stance has generally been to try and follow numpy's lead, we will declare support for the free-threading build and not poison the imports. But, we also likely won't be able to make everything threadsafe and users will need to think about locks on their end as well. Several of us have tried the free threading build and it did "work", but I don't think anyone has truly stress tested it. |
Makes sense, I'll go ahead and send in a PR. |
This tracking issue aims to collect all the issues and PRs related for the upcoming free-threaded CPython 3.13 (a.k.a. "no-GIL") builds. Until now, as of #28610 all the test suite is passing (at least locally).
Right now, a complete triaging of all modules is required in order to detect any potential concurrency issues (C-thread safety issues), in order to either fix them or mark them as non-free-threaded compliant.
We invite the community and maintainers with extensive knowledge of the project to highlight the existence of any potential thread-safety issues that currently exist.
Here are some resources that might be useful in the context of free-threaded Python
Pull Requests
The text was updated successfully, but these errors were encountered: