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

[Feature Request] Subinterpreters Support (PEP 554 & PEP 684) #103

Open
1 task done
XuehaiPan opened this issue Nov 12, 2023 · 0 comments
Open
1 task done

[Feature Request] Subinterpreters Support (PEP 554 & PEP 684) #103

XuehaiPan opened this issue Nov 12, 2023 · 0 comments
Labels
cxx Something related to the CXX source code enhancement New feature or request py Something related to the Python source code

Comments

@XuehaiPan
Copy link
Member

XuehaiPan commented Nov 12, 2023

Required prerequisites

  • I have searched the Issue Tracker that this hasn't already been reported. (comment there if it has.)

Motivation

The integration of subinterpreters support in optree, aligned with PEP 554 – Multiple Interpreters in the Stdlib and PEP 684 – A Per-Interpreter GIL, is motivated by the evolving landscape of Python's concurrency and multi-threading capabilities. Python 3.12's introduction of a per-interpreter GIL and the anticipated standard library support for multiple interpreters in Python 3.13 signify a shift towards more sophisticated concurrency models. This shift presents an opportunity for optree to stay at the forefront of Python's high-performance computing.

Incorporating subinterpreters support is crucial for optree to harness the benefits of improved isolation and concurrency control in Python. This enhancement will enable optree to better serve applications that require robust multi-threaded processing, particularly in high-performance computing environments.

The primary challenges in this endeavor include:

Managing the PyTree Registry in a Multi-Interpreter Context: Ensuring each subinterpreter has its own isolated PyTree registry is critical for thread safety and data integrity. Investigating efficient ways to manage these registries – their creation, access, and destruction – in tandem with the lifecycle of each subinterpreter, is a key challenge.

Ensuring Compatibility and Performance: The implementation must not only be compatible with the new interpreter architecture but also maintain, if not enhance, the current performance benchmarks of optree. Balancing compatibility with performance in a multi-interpreter setup will be a significant area of investigation.

Isolation vs. Interoperability: While isolation is a core benefit of subinterpreters, ensuring that optree remains interoperable and efficient across different interpreter instances is essential. This involves exploring mechanisms for data sharing and communication between PyTrees across subinterpreters without compromising on the isolation benefits.

By addressing these challenges, optree aims to leverage Python's advancements in concurrency, ensuring that the library remains a top choice for developers working in multi-threaded and high-performance computing scenarios.

Solution

No response

Alternatives

No response

Additional context

References:

@XuehaiPan XuehaiPan added enhancement New feature or request cxx Something related to the CXX source code py Something related to the Python source code labels Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cxx Something related to the CXX source code enhancement New feature or request py Something related to the Python source code
Projects
None yet
Development

No branches or pull requests

1 participant