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

Multi-context support for C extensions #437

Open
timfel opened this issue Oct 23, 2024 · 0 comments
Open

Multi-context support for C extensions #437

timfel opened this issue Oct 23, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@timfel
Copy link
Member

timfel commented Oct 23, 2024

TL;DR

Native extension libraries such as for popular DS and ML packages cannot be loaded multiple times into the same process, precluding their use in embeddings that use multiple GraalPy contexts. We will try to alleviate this issue for all native extensions.

Goals

The primary goal for allowing native extensions in multiple contexts is to enable the scaling of GraalPy embeddings. While each GraalPy context is subject to the Python global interpreter lock (GIL), multiple GraalPy contexts can be used to execute Python code in parallel on different Java threads while sharing compiled code caches. If we managed to allow native extensions to be loaded multiple times and used in different contexts, this scaling strategy could be extended to the vast majority of Python packages.

Non-Goals

  • Complete isolation between native extensions. The goal is to be able to load and run native extensions across contexts, but native code will have full access to the process memory and resources. Thus, ill-behaved native extensions can still affect other GraalPy contexts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

No branches or pull requests

2 participants