-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Open
Labels
Build / CINeeds DecisionRequires decisionRequires decisionfree-threadingPRs and issues related to support for free-threaded CPython (a.k.a. nogil or no-GIL, PEP 703)PRs and issues related to support for free-threaded CPython (a.k.a. nogil or no-GIL, PEP 703)module:test-suiteeverything related to our testseverything related to our tests
Description
There is a new kid on the block that should help us find out whether scikit-learn and its dependencies can be reliably considered free-threading compatible:
https://pypi.org/project/pytest-freethreaded/
Let's try to adopt it in scikit-learn.
Here is a possible plan:
- first run the tests locally a few times and see if they are tests (or a set of interacting tests) that cause a crash or a failure, open an issue for each of them, possibly upstream and then mark them as skipped under free-threading builds with a reference to the issue in the "reason" field;
- then upgrade our nightly free-threading scheduled CI run to use
pytest-freethreaded
.
Any comments @lesteve @jeremiedbb @ngoldbaum?
EDIT: anyone interested in getting hands on the first item can find this resource useful:
https://py-free-threading.github.io/
EDIT 2: there is also the pytest-run-parallel plugin that can serve a similar purpose.
EDIT3: here is a TODO/plan for this problem:
- resync and simplify Make the test suite itself thread-safe to be able to detect thread-safety problems with or without free-threading #30041 to leverage Mark tests as single-threaded if warning handling takes place Quansight-Labs/pytest-run-parallel#19, Add a list of thread-unsafe fixtures and mark tests as thread-unsafe if usage is found Quansight-Labs/pytest-run-parallel#33 and Add a configuration file option to extend the thread-unsafe fixture list Quansight-Labs/pytest-run-parallel#34
- configure the
[free-threading]
CI to run withpytest-run-parallel
CI Run free-threaded test suite with pytest-run-parallel #32023 - enable the free-threading flag in Cython extension MNT Mark cython extensions as free-threaded compatible #31342
- investigate and fix crashes and test failures ;)
- benchmark the use of threading, in particular when we we expect nested parallelism between Python threads (e.g. in
GridSearchCV
with the "threading" backend of joblib) and BLAS or OpenMP native threading in the underlying estimators. - communicate results on a blog post / pydata presentation / social media.
Metadata
Metadata
Assignees
Labels
Build / CINeeds DecisionRequires decisionRequires decisionfree-threadingPRs and issues related to support for free-threaded CPython (a.k.a. nogil or no-GIL, PEP 703)PRs and issues related to support for free-threaded CPython (a.k.a. nogil or no-GIL, PEP 703)module:test-suiteeverything related to our testseverything related to our tests