-
Notifications
You must be signed in to change notification settings - Fork 193
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
adding a pythran CLI flag to support free-threaded CPython #2258
Comments
Thanks for the extra pointers. This could be a config option, probably |
If you could handle it, that'd be great. The C module initialization part I did before, and it's the simplest part here probably - there is nothing more to it than the code snippets above. How to plumb it into Pythran and expose the CLI flag is most of the work I guess, and I'm not too sure about that. The other part is perhaps if you'd want a CI job for free-threading? That is probably a matter of:
|
perfect, I'll handle this |
This is the default, and can be changed through --config backend.freethreading_compatible=false or the equivalent pythranrc entry. Fix #2258
This is the default, and can be changed through --config backend.freethreading_compatible=false or the equivalent pythranrc entry. Fix #2258
For free-threaded CPython (xref PEP 703, https://py-free-threading.github.io/), Pythran seems to be working quite well already. We've tested Pythran-generated extension modules reasonably well within SciPy now with GIL-free multi-threaded tests, and so far everything looks healthy. There is one thing to do in Pythran though, namely adding a compile option to allow the user to request that the extension module is marked as compatible with free-threading.
That is pretty straightforward, it looks like this (see https://py-free-threading.github.io/porting/#declaring-free-threaded-support):
or for single-phase initialization:
The way this is done in Cython and
numpy.f2py
is similar, with an opt-in flag tocython
andf2py
:cython -Xfreethreading_compatible=True
(xref Add freethreading_compatible directive to set Py_mod_gil slot cython/cython#6242)f2py --freethreading-compatible
(xref https://github.com/numpy/numpy/pull/26981/files)For Pythran I'd propose the same, an opt-in flag that when given inserts one of the
#ifdef Py_GIL_DISABLED
snippets in the generated C++ code:The text was updated successfully, but these errors were encountered: